Power grid source load prediction method based on mRMR-DeepSeek large model

By employing a power grid source-load prediction method based on the mRMR-DeepSeek large model, and utilizing KNN, DTW, VMD, and RAG techniques to filter outliers, cluster, and decompose data, the problem of user load prediction was solved, achieving high-precision prediction of power grid source-load and improving the stability and efficiency of power grid operation.

CN121524872APending Publication Date: 2026-02-13STATE GRID HENAN ELECTRIC POWER +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511651426.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-12
Publication Date
2026-02-13

AI Technical Summary

Technical Problem

Existing technologies struggle to accurately predict user load, impacting the stable operation of the power grid. Furthermore, traditional methods are inefficient and memory-intensive when processing massive amounts of data, and are ill-suited for handling high-dimensional features.

Method used

A power grid source-load prediction method based on the mRMR-DeepSeek large model is adopted. By screening outliers, clustering and mode decomposition, and combining KNN, DTW, VMD and mRMR algorithms, the power grid source-load prediction model is constructed using RAG technology.

Benefits of technology

It improves the accuracy of power grid source-load prediction, generates more accurate prediction results, and enhances the stability and efficiency of power grid operation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121524872A_ABST
    Figure CN121524872A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of electric power systems, in particular to a power grid source load prediction method based on an mRMR-DeepSeek large model, which is characterized by comprising the following steps: step 1, screening abnormal values of historical source load data of a power grid, correcting the abnormal values based on a KNN algorithm to obtain high-quality preprocessed data, and carrying out prediction on the preprocessed data; 2, carrying out clustering and variational mode decomposition on the preprocessed source load data, and screening out a feature subset which is highly related to source load prediction and is low in redundancy through an mRMR algorithm; and step 3, inputting the screened features into a DeepSeek large model, constructing a power grid source load prediction historical database in combination with an RAG technology, and generating an accurate source load prediction result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of power system technology, and in particular to a power grid source-load prediction method based on the mRMR-DeepSeek large model. Background Technology

[0002] Users' electricity consumption behavior is influenced by factors such as weather conditions and production plans, causing user load curves to exhibit strong randomness and volatility relative to system-level load curves, which can significantly impact the stable operation of the power grid. The periodicity and regularity of user load curves are also poor, increasing the difficulty of user load forecasting. Furthermore, the diverse patterns, rich types, and non-stationary sequences of user load curves necessitate personalized treatment when building forecasting models, resulting in poor model adaptability. When conducting monthly transactions, electricity sales companies face even greater variability in production plans and weather conditions, making accurate judgments difficult and further complicating user load forecasting.

[0003] Current research on user load forecasting is limited, primarily focusing on predicting industrial load, air conditioning load, and building load. Industrial users, compared to ordinary residential and commercial users, are characterized by large electricity consumption and electricity costs accounting for a significant proportion of their total costs. These include high-energy-consuming industrial enterprises such as steel, cement, aluminum smelting, metallurgy, and mining. With the introduction of national policies related to environmental protection, industrial upgrading, and improving energy efficiency, these large-scale industrial users are gradually upgrading their equipment to high-capacity, high-parameter automated control systems to reduce unit energy consumption and electricity costs. High-capacity equipment operates at higher voltage levels, and frequent start-ups and shutdowns can cause varying degrees of impact and harmonic effects on the power grid. Simultaneously, the significant increase in the number of large user loads is having an increasingly significant impact on the power grid, highlighting its growing importance. Furthermore, external factors such as meteorological conditions and economic and political conditions, as well as internal factors such as changes in production processes and plans, all affect user load, leading to drastic changes in load curves with strong randomness and volatility. Scientific, reasonable, and accurate user load forecasting can better grasp changes in users' electricity consumption patterns over a certain period of time. This helps power grid companies formulate corresponding power supply plans, optimize the power supply and distribution structure, improve grid efficiency, and cope with the destructive impacts and harmonics caused by load changes on the power grid. Clearly, user load forecasting has significant practical importance in guiding the stable, economical, and efficient operation of the power system.

[0004] Accurate load forecasting is beneficial for understanding users' electricity consumption patterns, guiding power grid companies to provide personalized services, and improving power supply reliability. Simultaneously, load forecasting also provides scientific guidance for planned outage management, electrical equipment maintenance, optimized dispatching, effectively addressing the destructive impact of large user load changes on the power grid, controlling grid stability, and ensuring economical and efficient operation. Furthermore, traditional load forecasting methods such as support vector machines and Gaussian process regression have significant drawbacks when processing massive amounts of data, such as slow processing speed, large memory consumption, and difficulty in handling high-dimensional features. Therefore, load forecasting presents significant challenges but also holds immense value for academic research and field applications. Summary of the Invention

[0005] The technical problem to be solved by this invention is to provide a power grid source load prediction method based on the mRMR-DeepSeek large model, which improves the accuracy of power grid source load prediction and has strong practicality.

[0006] To achieve the above objectives, this invention provides a power grid source-load prediction method based on the mRMR-DeepSeek large model, comprising the following steps: Step 1: Filter out the outliers in the historical source-load data of the power grid and correct the outliers based on KNN; Step 2: Cluster and mode decomposition are performed on the preprocessed source load data, and source load prediction features are selected using the mRMR algorithm; Step 3: Utilize DeepSeek model combined with RAG technology to predict power grid source load.

[0007] In step 1, when processing the raw data from the multi-channel input system, a box plot is constructed to filter out outliers using the quartile principle. A schematic diagram of the box plot is shown below. Figure 2 As shown. In the box plot, the main parameters are: (1) Lower quartile Q1; (2) Median Q2; (3) Upper quartile Q3; (4) Upper limit (upper edge): Interquartile range IQR = Q3 - Q1, then the upper limit value = Q3 + 1.5IQR; (5) Lower limit (lower edge): Lower limit value = Q1 - 1.5IQR; (6) Upper limit: Upper limit value = Q3 + 3IQR; (7) Upper limit: Lower limit = Q1 - 3IQR; (8) Outliers: Values ​​located between the upper quartile and the upper limit, and between the lower quartile and the lower limit are outliers, indicated by '+'; values ​​located between the upper limit and the extreme upper limit, and between the lower limit and the extreme lower limit are mild outliers, indicated by ' '; values ​​located below the extreme lower limit and above the extreme upper limit are extreme outliers, indicated by '*'.

[0008] Box plots clearly reveal the shape of each batch of data, including the median, tail length, outliers, and distribution intervals. They also show the interquartile range of each batch, whether the distribution of normal values ​​is concentrated or dispersed, and provide a concise overview of the box segments and their lengths. Box plots can also reveal the skewness of the data distribution, allowing for analysis of the median and outlier locations. Combining box plots with the aforementioned analytical methods enables effective and rapid identification of outliers.

[0009] After outliers are identified through box plots, an outlier correction system based on the K-Nearest Neighbor (KNN) machine learning method is built to achieve data correction and interpolation technology under network or device interruption conditions, solving the problem of cleaning and correcting raw data of different types and channels.

[0010] The KNN algorithm is a nonparametric statistical algorithm in supervised machine learning for solving classification and regression problems. After filtering out bad data, a KNN-based machine learning model is trained. The original data is normalized using an established evaluation index system and a multi-objective optimization function, and the data is processed to obtain a labeled sample set. The KNN algorithm then finds... k The sample that is closest to the test sample, and then from this... k Find the most similar sample among the samples and assign the category of that sample to the test sample.

[0011] In step 2, a suitable similarity measurement method is crucial for accurate clustering of load data. This invention first measures the morphological similarity between load data based on Dynamic Time Warping (DTW) distance. DTW distance considers scale variations, displacement variations, and noise variations in the time series, extending and shortening the time series to achieve morphological similarity measurement. Considering the absolute distance and morphological differences between load data, this invention employs a dual-scale distance method based on Euclidean distance and DTW to calculate the differences between features of different load data, using this as input for the clustering algorithm. The different distance calculation formulas are as follows: Euclidean distance between load data A and B: ; DTW distance: ; Two-scale distance: ; In the formula, Calculate the DTW distance between load data curves A and B; I The dimension of the load curve; α The weights are Euclidean distances. β As for DTW weights, in this project α = β =0.5.

[0012] In terms of clustering algorithms, this invention uses the K-means++ method to select cluster centers, selecting them one by one. K There are several cluster centers, and data sample points that are farther away from other cluster centers are more likely to be selected as cluster centers. The main process is as follows: Figure 3 As shown. The steps of this method are as follows: Step a: From the dataset X One data sample is randomly selected from the data. x (Vector) is used as the first initial cluster center c.

[0013] Step b: Calculate the shortest distance between each data sample and the current cluster center. D ( x Then calculate the probability that each data sample will be selected as the next cluster center. P ( x Select the data sample with the highest probability as the next cluster center: ;

[0014] ; In the formula, This is used for Euclidean distance calculation between data.

[0015] Step c: Repeat step b until K Cluster center selection complete.

[0016] The K-means algorithm requires manually specifying the number of clusters. However, in unlabeled datasets, the data categories are undetermined, and the choice of the number of clusters affects the clustering results. Clustering performance evaluation metrics include the sum of squared errors (SSE), silhouette coefficient (SC), and aggregation return metrics. This invention uses the aggregation return metric to determine the optimal number of clusters for unlabeled datasets. Compared to other clustering evaluation metrics, this metric provides a more intuitive way to find the optimal number of clusters.

[0017] Aggregate return metrics I re Error reduction coefficient ISSE Profile coefficient I sc composition: ; ; ; ; In the formula: This is the sum of the Euclidean distances from all data points to their respective cluster centers; c i For category i Cluster centers of data; G i For category i Total number of data samples; a ( x j ) for data x j With category i The average distance of other data, b ( x j ) for data x j The minimum distance to data from different classes. The error reduction coefficient reflects intra-class similarity, while the silhouette coefficient reflects inter-class separation. When aggregated, the return metrics... I re The optimal clustering result is determined by maximizing the clustering time. K value.

[0018] After clustering the source load data, the variational mode decomposition (VMD) algorithm is used to decompose the load sequence into its constituent parts. P An amplitude-frequency modulated (AM-FM) sub-signal. VMD characterizes the Intrinsic Mode Function (IMF) as an AM-FM signal, which can be expressed as: ; In the formula: The phase is a non-decaying function and satisfies ;make express The instantaneous frequency; for The instantaneous amplitude and satisfy . and Relative to phase In other words, the change is slow, meaning it occurs over a sufficiently long time interval. Inside, it can be considered It is a pure harmonic signal with an amplitude of The frequency is .

[0019] Variational mode decomposition (VMD) assumes that the obtained "modes" are a series of finite bandwidths with different center frequencies during data separation. This involves decomposing the original user load sequence into a series of sub-signals (modes). When initializing finite bandwidth parameters Based on the center angular frequency, the signal decomposition process is transformed into a non-recursive, variational problem solution process, and the results are obtained. P One estimated center angular frequency VMD signal decomposition is actually an optimization process, the purpose of which is to solve... P Modal functions And it is required that the sum of these modal functions equals f The objective function is to minimize the sum of the estimated bandwidths for each mode. The specific implementation steps for constructing the variational problem are as follows: Step 1: For each mode The corresponding analytic signal is calculated using the Hilbert transform, thus obtaining the one-sided spectrum as follows: ; In the formula: It is a Dirac distribution; This is a convolution operation.

[0020] Step 2: For each mode Through the exponential term corresponding to its center frequency Aliasing converts the spectrum of a mode into a "fundamental frequency band": ; Step 3: To calculate the bandwidth of each mode, construct and solve the optimization equation for the variational problem. The objective function expression is as follows: ; In the formula: For the common problem that needs to be solved P One mode; These are the center frequencies corresponding to each mode. Step 4: Introduce the extended Lagrangian function to transform the constrained variational problem into an unconstrained variational problem, thereby solving the aforementioned constrained variational problem. The specific expression of the Lagrangian function is: ; In the formula: α It is a secondary penalty factor; It is a Lagrange multiplication operator.

[0021] Step 5: VMD updates alternately using the alternating direction multiplier algorithm. This enables the solution of saddle points for the extended Lagrange function.

[0022] Modal function The update expression is: In the formula: Equivalent to ; Equivalent to .

[0023] By square L 2 Parseval / Plancherel and Fourier isometric transforms under the norm can transform this problem into the frequency domain: ; use Replace the first item We can obtain: ; Rewritten in non-negative frequency interval integral form: ; The solution to this quadratic optimization problem is: ; Regarding the center frequency The update problem can be described as follows: ; The same method is used to transform the value selection problem into the frequency domain: ; The solution to this quadratic problem is as follows: ; The steps for time series decomposition of source and load data based on VMD are as follows: Step 1: Parameter initialization, and n Set to 0; Step Two: Let n = n +1, start the loop process; Step 3: Order p = p +1, execute the inner loop, and update according to formula (19). The value is updated according to formula (22). The value; Step 4: Repeat step 3. When p = P This ends the inner loop process; Step 5: Update The value is: ; Step Six: Repeat steps two through five; when the error condition is met... When the time is right, the VMD decomposition process can be terminated, and the output will be generated. P IMF component time series data.

[0024] The VMD algorithm implementation process is as follows: Figure 4 As shown.

[0025] Decompose the source and load data into P After the amplitude-modulated and frequency-modulated sub-signals are obtained, the mRMR theory is used to screen the input variables so that they have a high correlation with the load value at the time to be predicted, while minimizing the redundancy between the input variables.

[0026] For two discrete random variables, the mutual information value can be expressed as: :; where: n For random variables X Total number of data points m For random variables Y Total number of data items.

[0027] If two variables X and Y A large amount of shared information between two variables indicates a strong correlation; conversely, a small amount of shared information, or even zero, indicates a weak correlation, or even independence. Mutual information theory, combined with different evaluation criteria and heuristic search strategies, can lead to various variable selection methods. Among them, mRMR uses mutual information to measure the relevance and redundancy of features. It selects a certain number of feature subsets from the initial set of all variables and removes redundant or interfering information, thus obtaining a reduced-dimensional set of input variables. Maximum correlation refers to a high correlation between the selected input variables and the output target, while minimum redundancy refers to the minimum correlation among the selected input variables. The measures of maximum correlation and minimum redundancy are defined as follows: ; ; In the formula: S For the selected set of input variables, | S | represents the number of input variables. c To output the target value. D Describe the set of input variables S Input variables x i With output target c The mean mutual information between the input variables reflects the correlation between the set of input variables and the output target. R Represents the set of input variablesS The magnitude of mutual information between variables describes the redundancy among input variables.

[0028] The goal of mRMR is to maximize the correlation between the feature set and the categories while minimizing redundancy among features. The initial set of input variables is set as follows: X Selected m -1 feature subsets of input variables are denoted as S m-1 The goal of mRMR is to extract features from the remaining feature subset { X - S m-1 Select the first one in} m A feature should maximize the objective function, meaning that the feature should satisfy: ; set up X The original set of input variables contains N One feature; S This represents the set of features that have been selected. F The steps for selecting the input variable set using mRMR, representing the set of features to be selected, are as follows: Step 1: Initialize the selected feature set S The set is empty, and the set of features to be selected is... X ,Right now ; Step Two: [Regarding...] ,calculate With target class c correlation ;remember To meet The characteristics of the conditions, let ; Step 3: Set ,from F m-1 Find the largest feature that makes equation (27) true and denote it as ,make ; Step 4: Repeat step 3 until... F for The resulting candidate feature set S and will S Features in The values ​​are sorted in descending order.

[0029] mRMR selects highly correlated input variables while avoiding redundant information. Therefore, the mRMR algorithm is first used to sort all input variables. Secondly, based on the wrapper working mode, variables from the mRMR-sorted input variable set are added to the selected feature set one by one using a forward search strategy. Then, a source-load prediction model based on mRMR-DeepSeek is built on the selected feature set. By comparing the prediction errors, the optimal input variables are determined.

[0030] In step 3, by combining the DeepSeek model with RAG technology, a historical database for power grid source-load prediction is constructed, thereby generating source-load prediction results.

[0031] RAG (Related Aspects of Generative Language) is an artificial intelligence framework that combines external knowledge retrieval with the generative capabilities of a large model. Its core idea is to retrieve relevant, up-to-date information fragments from one or more external knowledge sources (such as databases, document collections, etc.) before the large language model processes a user query and generates an answer. This retrieved information is then injected as additional context into the large model's prompts, guiding it to generate more accurate, relevant, and factual content.

[0032] The RAG architecture mainly includes a data preparation and indexing module, a query and retrieval module, and an enhancement and generation module.

[0033] The data preparation and indexing module is the cornerstone of the RAG system. It is responsible for transforming raw data (such as PDF documents, Word files, HTML web pages, plain text, database records, etc.) scattered across various sources and formats into a structured or semi-structured form that can be efficiently retrieved, and for building corresponding indexes. This module mainly includes the following: 1. Data loading: Use the appropriate loader to read raw data from different data sources (file system, Uniform Resource Locator (URL), database, Application Programming Interface (API) etc.).

[0034] 2. Text Segmentation: Due to the limited context window size of large models and the fact that smaller text units typically yield more accurate retrieval results, long documents need to be segmented into appropriately sized, semantically complete text blocks. Segmentation strategies are crucial; simple fixed-length segmentation may compromise semantic integrity, while more advanced methods consider sentence boundaries, paragraph structure, and even semantic coherence. Common block sizes can range from several hundred to a thousand tokens.

[0035] 3. Vectorization: Each text block is converted into a high-dimensional floating-point vector using a text embedding model (such as OpenAI's text-embedding-ada-002, the SentenceTransformers series such as all-MiniLM-L6-v2, or BAAI / bge-large-zh-v1.5, moka-ai / m3e-base, etc. for Chinese scenarios). This vector can capture the semantic information of the text block.

[0036] 4. Index Storage: The original text blocks and their corresponding vector representations are stored in a dedicated vector database. This database builds efficient indexes for these vectors (such as Hierarchical Navigable SmallWorldgraphs (HNSW), IVF_PQ, etc.) to facilitate fast similarity searches. In addition to vectors, the original content of the text blocks and related metadata (such as source document ID, page number, title, etc.) are typically stored. This process is usually performed offline in batches, but incremental updates are also supported.

[0037] The query and retrieval module retrieves the most relevant information fragments from the pre-built index in real time when a user initiates a query. This module mainly includes the following: 1. User Query Processing: User natural language queries first need to be vectorized using the same (or compatible) embedding model as those used during document indexing, transforming them into query vectors. Sometimes, query expansion or rewriting is also performed to improve retrieval recall.

[0038] 2. Similarity Retrieval: Perform a similarity search in the vector database using the query vector (e.g., find the highest cosine similarity or the closest Euclidean distance). K (Number of vectors). Vector databases utilize their internal indexes (such as HNSW graphs) to accelerate this process, avoiding full comparisons. The retrieval results are the IDs or references of the Top-K most relevant text blocks, along with their similarity scores.

[0039] 3. Re-ranking: The initial Top-K results may contain some less precise or less relevant document blocks. The re-ranking step uses a more powerful, and often more computationally expensive, model to re-score and rank these initial results, aiming to place the truly most relevant document blocks at the top, thereby improving the context quality of the final submission to the larger model.

[0040] The core of the enhancement and generation module is to effectively combine the retrieved information with the user's original question and use a large model to generate the final, high-quality answer. This module mainly includes the following: 1. Cue Word Construction: Relevant text blocks retrieved (and possibly reordered), the user's original question, and possible dialogue history, role settings, and task instructions (such as "Please answer the question based on the following information," "If the information is insufficient, please say you don't know," etc.) are assembled into a complete, structured cue word according to a pre-designed template. This cue word is the direct input for the large model to perform the generation task.

[0041] 2. Large Model Call: Send the constructed enhanced prompts to the selected large model.

[0042] 3. Answer Generation and Post-processing: The large model generates answers based on the enhanced prompts in the input. The generated raw answers may require further post-processing, such as: removing redundant information, formatting the output (e.g., generating Markdown or JSON), filtering sensitive content, and adding source citations (if the prompt design supports this and the large model can do so), to ensure that the final answer presented to the user is user-friendly, accurate, and useful.

[0043] This invention mainly uses the DeepSeek large model combined with RAG technology to achieve source load prediction, and its technical route is as follows: Figure 5 As shown, the unstructured historical load data is first structured and stored, then vectorized using LanceDB and stored in the historical database. Next, using RAG technology, the historical load database is embedded into the DeepSeek model, and global cue words are designed to clarify the task background, content, and objectives, thus obtaining a DeepSeek-based source load prediction model. Finally, based on the obtained source load prediction model, meteorological data is input to generate the required forecast data and typical daily load data.

[0044] The beneficial effects of this invention are as follows: First, outliers in historical power grid source-load data are screened, and then corrected based on KNN. Next, the preprocessed source-load data is clustered and subjected to mode decomposition, and source-load prediction features are screened using the mRMR algorithm. Finally, power grid source-load prediction is achieved based on the DeepSeek model combined with RAG technology, generating power grid source-load prediction results and typical daily historical source-load data. Based on historical power grid source-load data, this invention constructs a box plot, uses the quartile principle to screen outliers in the original data, and corrects them using the KNN nearest neighbor algorithm. Simultaneously, a k-means++ algorithm based on dual-scale distance is constructed to classify the preprocessed data, and a variational mode decomposition algorithm is used to decompose the data, constructing an mRMR-DeepSeek large model to achieve accurate power grid source-load prediction. This method effectively improves the accuracy of power grid source-load prediction and can output historical source-load data as a reference based on input meteorological data, enhancing the accuracy and reliability of the generated results.

[0045] In addition to the objectives, features, and advantages described above, the present invention has other objectives, features, and advantages. The invention will now be described in further detail with reference to the figures. Attached Figure Description

[0046] Figure 1 This is a schematic diagram of the method flow of the present invention.

[0047] Figure 2 This is a schematic diagram of the box-type structure of the present invention.

[0048] Figure 3 This is the main flowchart of the k-means++ invention.

[0049] Figure 4 This is a flowchart of the VMD algorithm implementation of the present invention.

[0050] Figure 5 This invention presents a technical approach for predicting power grid source and load based on DeepSeek. Detailed Implementation

[0051] like Figure 1 As shown, a power grid source-load prediction method based on the mRMR-DeepSeek large model includes the following steps: Step 1: Filter out the outliers in the historical source-load data of the power grid and correct the outliers based on KNN; Step 2: Cluster and mode decomposition are performed on the preprocessed source load data, and source load prediction features are selected using the mRMR algorithm; Step 3: Utilize DeepSeek model combined with RAG technology to predict power grid source load.

[0052] In step 1, when processing the raw data from the multi-channel input system, a box plot is constructed to filter out outliers using the quartile principle. A schematic diagram of the box plot is shown below. Figure 2 As shown. In the box plot, the main parameters are: (1) Lower quartile Q1; (2) Median Q2; (3) Upper quartile Q3; (4) Upper limit (upper edge): Interquartile range IQR = Q3 - Q1, then the upper limit value = Q3 + 1.5IQR; (5) Lower limit (lower edge): Lower limit value = Q1 - 1.5IQR; (6) Upper limit: Upper limit value = Q3 + 3IQR; (7) Upper limit: Lower limit = Q1 - 3IQR; (8) Outliers: Values ​​located between the upper quartile and the upper limit, and between the lower quartile and the lower limit are outliers, indicated by '+'; values ​​located between the upper limit and the extreme upper limit, and between the lower limit and the extreme lower limit are mild outliers, indicated by ' '; values ​​located below the extreme lower limit and above the extreme upper limit are extreme outliers, indicated by '*'.

[0053] Box plots clearly reveal the shape of each batch of data, including the median, tail length, outliers, and distribution intervals. They also show the interquartile range of each batch, whether the distribution of normal values ​​is concentrated or dispersed, and provide a concise overview of the lengths of the boxes and line segments. Box plots can also reveal the skewness of the data distribution, allowing for analysis of the median and outlier locations. Combining box plots with the aforementioned analytical methods enables effective and rapid identification of outliers.

[0054] After outliers are identified through box plots, an outlier correction system based on the K-Nearest Neighbor (KNN) machine learning method is built to achieve data correction and interpolation technology under network or device interruption conditions, solving the problem of cleaning and correcting raw data of different types and channels.

[0055] The KNN algorithm is a nonparametric statistical algorithm in supervised machine learning for solving classification and regression problems. Based on the screening out of bad data, a machine learning model based on KNN is trained. The original data is normalized and the data is solved using the established evaluation index system and multi-objective optimization function to obtain a labeled sample set. The KNN algorithm finds the k closest samples to the test sample from the labeled sample set, then finds the most similar sample from these k samples, and assigns the category of the sample to the test sample.

[0056] In step 2, a suitable similarity measurement method is crucial for accurate clustering of load data. This invention first measures the morphological similarity between load data based on Dynamic Time Warping (DTW) distance. DTW distance considers scale variations, displacement variations, and noise variations in the time series, extending and shortening the time series to achieve morphological similarity measurement. Considering the absolute distance and morphological differences between load data, this invention employs a dual-scale distance method based on Euclidean distance and DTW to calculate the differences between features of different load data, using this as input for the clustering algorithm. The different distance calculation formulas are as follows: Euclidean distance between load data A and B: ; DTW distance: ; Two-scale distance: ; In the formula, This is used to calculate the DTW distance between load data curves A and B; I is the dimension of the load curve; α is the Euclidean distance weight, and β is the DTW weight. In this project, α=β=0.5.

[0057] In terms of clustering algorithms, this invention uses the K-means++ method to select cluster centers, selecting K cluster centers one by one. Data sample points that are farther away from other cluster centers are more likely to be selected as cluster centers. The main process is as follows: Figure 3 As shown. The steps of this method are as follows: Step a: Randomly select one data sample x (vector) from the dataset X as the first initial cluster center c.

[0058] Step b: Calculate the shortest distance D(x) between each data sample and the current cluster center, then calculate the probability P(x) of each data sample being selected as the next cluster center, and select the data sample with the highest probability as the next cluster center. ; ; In the formula, This is used for Euclidean distance calculation between data.

[0059] Step c: Repeat step b until the selection of K cluster centers is complete.

[0060] The K-means algorithm requires manually specifying the number of clusters. However, in unlabeled datasets, the data categories are undetermined, and the choice of the number of clusters affects the clustering results. Clustering performance evaluation metrics include the sum of squared errors (SSE), silhouette coefficient (SC), and aggregation reward metrics. This invention uses the aggregation reward metric to determine the optimal number of clusters for unlabeled datasets; compared to other clustering evaluation metrics, this metric provides a more intuitive way to find the optimal number of clusters.

[0061] The aggregate return metric Ire consists of the error reduction coefficient ISSE and the profile coefficient Isc. ; ; ; ; In the formula: K is the sum of Euclidean distances from all data points to their cluster centers; ci is the cluster center of data in category i; Gi is the total number of data samples in category i; a(xj) is the average distance between data xj and other data in category i; and b(xj) is the minimum distance between data xj and data from different classes. The error reduction coefficient reflects intra-class similarity, and the silhouette coefficient reflects inter-class separation. The clustering result is optimal when the aggregation return index Ire is maximized, and this is used to determine the K value.

[0062] After clustering the source load data, the variational mode decomposition (VMD) algorithm is used to decompose the load sequence into P amplitude-modulated (AM-FM) sub-signals. VMD characterizes the intrinsic mode function (IMF) as an AM-FM signal, which can be expressed as: ; In the formula: The phase is a non-decaying function and satisfies ;make express The instantaneous frequency; for The instantaneous amplitude and satisfy . and Relative to phase In other words, the change is slow, meaning it occurs over a sufficiently long time interval. Inside, it can be considered It is a pure harmonic signal with an amplitude of The frequency is .

[0063] In the process of data separation, variational mode decomposition assumes that each obtained "mode" is a series of finite bandwidths with different center frequencies; it decomposes the original user load sequence into a series of sub-signals (modes). When initializing finite bandwidth parameters Based on the center angular frequency, the signal decomposition process is transformed into a non-recursive, variational problem solution process, and P estimated center angular frequencies are obtained. VMD signal decomposition is actually an optimization process, the purpose of which is to solve for P mode functions. Furthermore, the sum of these mode functions is required to equal f, and the objective function is to minimize the sum of the estimated bandwidths of each mode; the specific implementation steps for constructing the variational problem are as follows: Step 1: For each mode The corresponding analytic signal is calculated using the Hilbert transform, thus obtaining the one-sided spectrum as follows: ; In the formula: It is a Dirac distribution; This is a convolution operation.

[0064] Step 2: For each mode Through the exponential term corresponding to its center frequency Aliasing converts the spectrum of a mode into a "fundamental frequency band": ; Step 3: To calculate the bandwidth of each mode, construct and solve the optimization equation for the variational problem. The objective function expression is as follows: ; In the formula: There are a total of P modes that need to be solved; These are the center frequencies corresponding to each mode. Step 4: Introduce the extended Lagrangian function to transform the constrained variational problem into an unconstrained variational problem, thereby solving the aforementioned constrained variational problem. The specific expression of the Lagrangian function is: ; In the formula: α is the quadratic penalty factor; It is a Lagrange multiplication operator.

[0065] Step 5: VMD updates alternately using the alternating direction multiplier algorithm. This enables the solution of saddle points for the extended Lagrange function.

[0066] Modal function The update expression is: In the formula: Equivalent to ; Equivalent to .

[0067] This problem can be transformed into the frequency domain using Parseval / Plancherel and Fourier isometric transforms under the squared L2 norm: ; use Replace the first item We can obtain: ; Rewritten in non-negative frequency interval integral form: ; The solution to this quadratic optimization problem is: ; Regarding the center frequency The update problem can be described as follows: ; The same method is used to transform the value selection problem into the frequency domain: ; The solution to this quadratic problem is as follows: ; The steps for time series decomposition of source and load data based on VMD are as follows: Step 1: Parameter initialization, And n is set to 0; Step 2: Let n = n + 1, and begin the loop process; Step 3: Let p = p + 1, execute the inner loop, and update according to formula (19). The value is updated according to formula (22). The value; Step 4: Repeat Step 3. When p = P, end the inner loop process; Step 5: Update The value is: ; Step Six: Repeat steps two through five; when the error condition is met... When the time is up, the VMD decomposition process can be terminated, thus outputting P IMF component time series data.

[0068] The VMD algorithm implementation process is as follows: Figure 4 As shown.

[0069] After the source load data is decomposed into P amplitude-modulated and frequency-modulated sub-signals, the mRMR theory is used to screen the input variables so that they have a high correlation with the load value at the time to be predicted, while minimizing the redundancy between the input variables.

[0070] For two discrete random variables, the mutual information value can be expressed as: In the formula: n is the total number of data points for random variable X, and m is the total number of data points for random variable Y.

[0071] If two variables X and Y share a large amount of information, it indicates a strong correlation between them; conversely, if the shared information is small, or even zero, it indicates a weak correlation, or even independence. Mutual information theory, combined with different evaluation criteria, can lead to various variable selection methods using heuristic search strategies. Among these, mRMR uses mutual information to measure the relevance and redundancy of features. It selects a certain number of feature subsets from the initial set of all variables and removes redundant or interfering information, thus obtaining a reduced set of input variables. Maximum relevance refers to a high correlation between the selected input variables and the output target, while minimum redundancy refers to the minimum correlation among the selected input variables. The metrics for maximum relevance and minimum redundancy are defined as follows: ; ; In the formula: S is the selected set of input variables, |S| is the number of input variables, and c is the output target value. D describes the mean mutual information between each input variable xi in the input variable set S and the output target c, reflecting the correlation between the input variable set and the output target. R represents the magnitude of the mutual information among the variables in the input variable set S, describing the redundancy among the input variables.

[0072] The goal of mRMR is to maximize the correlation between the feature set and the categories while minimizing redundancy among features. Let the initial set of input variables be X, and the selected m-1 feature subsets be Sm-1. The mRMR objective is to select the m-th feature from the remaining feature subset {X-Sm-1} that maximizes the objective function; that is, the feature should satisfy: ; Let X be the original set of input variables containing N features; S represent the set of features already selected; and F represent the set of features to be selected. The steps for selecting the set of input variables using mRMR are as follows: Step 1: Initialize the selected feature set S as an empty set, and the feature set to be selected is X, i.e. ; Step Two: [Regarding...] ,calculate Relevance to target class c ;remember To meet The characteristics of the conditions, let ; Step 3: Set Find the largest feature in Fm-1 that makes equation (27) true and denote it as ,make ; Step 4: Repeat step 3 until F is... Then the candidate feature set S is obtained, and the features in S are sorted according to... The values ​​are sorted in descending order.

[0073] While selecting highly correlated input variables, mRMR avoids redundant information; therefore, the mRMR algorithm is first used to sort all input variables. Secondly, based on the wrapper working mode, variables from the mRMR-sorted input variable set are added to the selected feature set one by one using a forward search strategy. Then, a source-load prediction model based on mRMR-DeepSeek is established for the selected feature set. By comparing the prediction errors, the optimal input variables are determined.

[0074] In step 3, by combining the DeepSeek model with RAG technology, a historical database for power grid source-load prediction is constructed, thereby generating source-load prediction results.

[0075] RAG (Related Aspects of Generative Language) is an artificial intelligence framework that combines external knowledge retrieval with the generative capabilities of a large model. Its core idea is to retrieve relevant, up-to-date information fragments from one or more external knowledge sources (such as databases, document collections, etc.) before the large language model processes a user query and generates an answer. This retrieved information is then injected as additional context into the large model's prompts, guiding it to generate more accurate, relevant, and factual content.

[0076] The RAG architecture mainly includes a data preparation and indexing module, a query and retrieval module, and an enhancement and generation module.

[0077] The data preparation and indexing module is the cornerstone of the RAG system. It is responsible for transforming raw data (such as PDF documents, Word files, HTML web pages, plain text, database records, etc.) scattered across various sources and formats into a structured or semi-structured form that can be efficiently retrieved, and for building corresponding indexes. This module mainly includes the following: 1. Data loading: Use the appropriate loader to read raw data from different data sources (file system, Uniform Resource Locator (URL), database, Application Programming Interface (API) etc.).

[0078] 2. Text Segmentation: Due to the limited context window size of large models and the fact that smaller text units typically yield more accurate retrieval results, long documents need to be segmented into appropriately sized, semantically complete text blocks. Segmentation strategies are crucial; simple fixed-length segmentation may compromise semantic integrity, while more advanced methods consider sentence boundaries, paragraph structure, and even semantic coherence. Common block sizes can range from several hundred to a thousand tokens.

[0079] 3. Vectorization: Each text block is converted into a high-dimensional floating-point vector using a text embedding model (such as OpenAI's text-embedding-ada-002, the SentenceTransformers series such as all-MiniLM-L6-v2, or BAAI / bge-large-zh-v1.5, moka-ai / m3e-base, etc. for Chinese scenarios). This vector can capture the semantic information of the text block.

[0080] 4. Index Storage: The original text blocks and their corresponding vector representations are stored in a dedicated vector database. This database builds efficient indexes for these vectors (such as Hierarchical Navigable SmallWorldgraphs (HNSW), IVF_PQ, etc.) to facilitate fast similarity searches. In addition to vectors, the original content of the text blocks and related metadata (such as source document ID, page number, title, etc.) are typically stored. This process is usually performed offline in batches, but incremental updates are also supported.

[0081] The query and retrieval module retrieves the most relevant information fragments from the pre-built index in real time when a user initiates a query. This module mainly includes the following: 1. User Query Processing: User natural language queries first need to be vectorized using the same (or compatible) embedding model as those used during document indexing, transforming them into query vectors. Sometimes, query expansion or rewriting is also performed to improve retrieval recall.

[0082] 2. Similarity Retrieval: A similarity search is performed in the vector database using the query vector (e.g., finding the K vectors with the highest cosine similarity or the closest Euclidean distance). The vector database utilizes its internal indexes (such as HNSW graphs) to speed up this process, avoiding a full comparison. The retrieval results are the IDs or references of the Top-K most relevant text blocks, along with their similarity scores.

[0083] 3. Re-ranking: The initial Top-K results may contain some less precise or less relevant document blocks. The re-ranking step uses a more powerful, and often more computationally expensive, model to re-score and rank these initial results, aiming to place the truly most relevant document blocks at the top, thereby improving the context quality of the final submission to the larger model.

[0084] The core of the enhancement and generation module is to effectively combine the retrieved information with the user's original question and use a large model to generate the final, high-quality answer. This module mainly includes the following: 1. Cue Word Construction: Relevant text blocks retrieved (and possibly reordered), the user's original question, and possible dialogue history, role settings, and task instructions (such as "Please answer the question based on the following information," "If the information is insufficient, please say you don't know," etc.) are assembled into a complete, structured cue word according to a pre-designed template. This cue word is the direct input for the large model to perform the generation task.

[0085] 2. Large Model Call: Send the constructed enhanced prompts to the selected large model.

[0086] 3. Answer Generation and Post-processing: The large model generates answers based on the enhanced prompts in the input. The generated raw answers may require further post-processing, such as: removing redundant information, formatting the output (e.g., generating Markdown or JSON), filtering sensitive content, and adding source citations (if the prompt design supports this and the large model can do so), to ensure that the final answer presented to the user is user-friendly, accurate, and useful.

[0087] This invention mainly uses the DeepSeek large model combined with RAG technology to achieve source load prediction, and its technical route is as follows: Figure 5 As shown, the unstructured historical load data is first structured and stored, then vectorized using LanceDB and stored in the historical database. Next, using RAG technology, the historical load database is embedded into the DeepSeek model, and global cue words are designed to clarify the task background, content, and objectives, thus obtaining a DeepSeek-based source load prediction model. Finally, based on the obtained source load prediction model, meteorological data is input to generate the required forecast data and typical daily load data.

[0088] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely preferred examples and are not intended to limit the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the present invention as claimed. The scope of protection of the present invention is defined by the appended claims and their equivalents.

Claims

1. A power grid source-load prediction method based on an mRMR-DeepSeek large model, characterized in that, Comprise the following steps: Step one, abnormal value screening is performed on the historical source load data of the power grid, and the abnormal values are corrected based on the KNN algorithm to obtain high-quality pretreated data; Step two, clustering and variational mode decomposition are carried out on the pretreated source load data, and then the mRMR algorithm is used to screen out a feature subset that is highly related to source load prediction and has low redundancy; Step three, input the screened features into the DeepSeek large model, and combine the RAG technology to construct a power grid source load prediction historical database to generate accurate source load prediction results.

2. The power grid source-load prediction method based on the mRMR-DeepSeek large model according to claim 1, characterized in that: Receive historical source load data, and arrange the historical source load data in ascending order, and then set an abnormal value classification rule to judge normal data and abnormal data; Receive abnormal data as a test sample, and corresponding normal data as a labeled sample, sequentially calculate the distance between the test sample and all labeled samples to obtain multiple distances; sort the multiple distances in descending order, and select the k smallest distances; then match the most similar normal sample from the k normal samples, and assign the class of the most similar normal sample to the test sample, and the specific expression is: The distance metric between the received sample and the labeled sample is: .​​ 3. The power grid source-load prediction method based on the mRMR-DeepSeek large model according to claim 2, characterized in that: A dual-scale distance method combining Euclidean distance and DTW is used to calculate the difference between different load data features as the input of the clustering algorithm, where the different distances are: Euclidean distance between load data A and B: ; DTW distance: ; Biscale distance: ; wherein: is the DTW distance between load data curves A and B; I is the dimension of the load curve; Alpha is the Euclidean distance weight, beta is the DTW weight, and the Euclidean distance weight alpha and the DTW weight beta are both equal to 0.

5.

4. The power grid source-load prediction method based on the mRMR-DeepSeek large model according to claim 3, characterized in that: In the clustering center selection link, the K-means++ algorithm is used to iteratively determine K clustering centers, and the core logic is to make the selected clustering centers as dispersed as possible, and the specific working steps are: Step a, randomly select 1 load data x from the load data set X as the 1st initial clustering center c; Step b, calculate the shortest distance between each load data and the current cluster center wherein is the Euclidean distance operation between load data; The probability of each load data being selected as the next cluster center is calculated based on the shortest distance D(x) and the load data with the maximum probability is selected as the next cluster center Step c, repeat step b until the selection of K clustering centers is completed.

5. The power grid source-load prediction method based on the mRMR-DeepSeek large model according to claim 4, characterized in that: An aggregated return index is used to determine the optimal number of clusters for the unlabeled data set, and the aggregated return index Ire is composed of the error reduction coefficient ISSE and the silhouette coefficient Isc; and when the aggregated return index Ire is maximum, the clustering result is optimal, thereby determining the value of K; The error reduction coefficient is wherein the error sum of squares denotes the sum of the Euclidean distances of all load data to their cluster centers, and ci is the cluster center of the load data of class i; profile coefficient where Gi is the total number of class i load data, a(xj) is the average distance of data xj from other load data of class i, and b(xj) is the minimum distance of load data xj from different class load data. Final aggregate return metric .

6. The power grid source-load prediction method based on the mRMR-DeepSeek large model according to claim 5, characterized in that: After clustering the source load data, the VMD algorithm is used for load sequence decomposition, which is decomposed into P amplitude-frequency modulation sub-signals; The VMD algorithm represents the IMFs as amplitude- frequency-modulated signals: ; Among them, phase It is a non-decaying function and satisfies ;make express The instantaneous frequency; The instantaneous amplitude, and satisfying ; and Relative to phase In other words, the change is slow, meaning it occurs over a sufficiently long time interval. Inside, it is believed It is a pure harmonic signal with an amplitude of The frequency is ; The variational mode decomposition assumes that each mode has a finite bandwidth and a different center frequency in the data separation process, and decomposes the original power consumption load sequence into a series of modes ; Specifically, on the basis of initializing the finite bandwidth parameter and the central angular frequency, the signal decomposition process is converted into a non-recursive, variational problem solving process, and P estimated central angular frequencies are obtained. The VMD signal decomposition is actually an optimization process, whose purpose is to solve P modal functions and requires that the sum of the modal functions equals the original signal f, while minimizing the sum of the estimated bandwidths of each mode, and the specific implementation steps are: Step one: for each modality , the analytic signal is calculated using the Hilbert transform to obtain the one-sided spectrum ; wherein is the Dirac distribution; is a convolution operation; Step two: for each modality , the spectrum of the modality is converted to the base frequency band: ;​ Step three: build and solve the optimization equation of the variational problem, and the objective function is: ; wherein, are P modes to be solved for; are the center frequencies of the respective modes. Step four: introduce an extended Lagrange function to transform the constrained variational problem into an unconstrained variational problem: ; where a is a quadratic penalty factor; is a Lagrange multiplier. Step five: VMD updates by alternating direction multiplier algorithm ; For the update of the modal functions of the form ; wherein is equivalent to ; is equivalent to ; Through the Parseval / Plancherel, Fourier equidistant transformation under the square L2 norm: ; Using replacing the first term , we obtain ; and write it as a non-negative frequency interval integral ; The solution to this quadratic optimization problem is: ; Regarding the update of the center frequency , the problem is formulated as: ; Using the same frequency domain conversion method, we get: The solution is: ; The VMD-based source load data time series decomposition steps are as follows: Step 1: Parameter initialization, initialize the sequence of modal functions , the sequence of center frequencies , the sequence of Lagrange multiplier operators , and the iteration number n to 0; Step two: iterative loop, let n=n+1, start the loop process; Step three: update the inner loop, let p = p + 1, execute the inner loop, update the value of the modal function according to update the value of the center frequency according to ; Step four: terminate the inner loop, repeat step three, when p=P (P is the preset mode number), end the inner loop process; Step five: Update the value of ; Step six: decomposition process termination judgment, repeat steps 2 to step 5, when the error condition is satisfied , that is, the error condition is less than the error threshold, end the VMD decomposition process, and output P intrinsic mode function IMF component time series data.

7. The power grid source-load prediction method based on the mRMR-DeepSeek large model according to claim 6, characterized in that: After the source load data is decomposed into P amplitude-frequency modulation sub-signals, the input variables are screened using the mRMR theory; For two discrete random variables, the mutual information value is: ; Wherein, n is the total number of random variable X data, m is the total number of random variable Y data; mutual information reflects the common information between variables, the greater the common information, the stronger the correlation, otherwise the weaker or even independent; The mRMR theory selects the feature subset from the initial variable set and removes the redundant interference information by measuring the correlation and redundancy of the features, and the measurement indexes of the maximum correlation and the minimum redundancy are: Maximum correlation: where S is the selected input variable set, |S| is the number of input variables, c is the output target value, and D reflects the correlation between the input variable set and the output target. Minimizing redundancy: ; where R describes the redundancy among the input variables.

8. The power grid source-load prediction method based on the mRMR-DeepSeek large model according to claim 7, characterized in that: The goal of mRMR is to maximize the correlation between the feature set and the class and minimize the redundancy between the features: Let the initial input variable set be X, and the selected m-1 input variable feature subset be Sm-1, then when selecting the mth feature from the remaining feature subset {X-Sm-1}, the following condition is met The optimal feature subset is iteratively constructed in this way. Let X be the original input variable set containing N features, S be the selected feature set, and F be the feature set to be selected. The steps of applying mRMR to select the input variable set are as follows: Step one: initialization, set the selected feature set S to an empty set, and initialize the candidate feature set F as X, i.e. ; Step two: first select features, for any , compute the relevance to the target class c ; record as features that meet the condition, let ; Step three: Iteratively select features, set , Find the largest feature from Fm-1 and call it Let ; Step four: termination and sorting: repeat step three until the set of candidate features F is , obtaining the set of candidate features S, and arranging the features in the set of candidate features S in descending order of value; mRMR selects input variables with high correlation, first sorts all input variables using the mRMR algorithm; second, based on the wrapper working mode, adds variables to the selected feature set one by one through the forward search strategy, then builds a source-load prediction model based on mRMR-DeepSeek for the selected feature set, and determines the optimal input variable by comparing the prediction error size.

9. The power grid source-load prediction method based on the mRMR-DeepSeek large model according to claim 1, characterized in that: By combining DeepSeek model with RAG technology, a power grid source-load prediction historical database is constructed, and the source-load prediction result is generated; The RAG architecture mainly includes data preparation and indexing module, query and retrieval module, and enhancement and generation module; Data preparation and indexing module: convert multi-source and multi-format raw data into structured / semi-structured form for efficient retrieval and establish index, including data loading, text segmentation, vectorization, and index storage; Query and retrieval module: real-time retrieval of the most relevant information when the user queries, including user query processing, similarity retrieval, and reordering; Enhancement and generation module: generate high-quality answers by combining retrieval information and user questions, including prompt word construction, large model invocation, answer generation, and post-processing.

10. The power grid source-load prediction method based on the mRMR-DeepSeek large model according to claim 9, characterized in that: Based on DeepSeek large model combined with RAG technology to realize source-load prediction: first, structure the unstructured historical load data, store it in the historical database after vectorization by LanceDB; then embed the database into the DeepSeek model through RAG technology, design global prompts to clarify task information, and build a prediction model; finally, input meteorological data to generate prediction data and typical daily load data.