A harmonic prediction modeling method and system based on random forest optimization algorithm
Through the harmonic source modeling method based on the random forest optimization algorithm, the problems of weak adaptability and complex modeling of the harmonic prediction model in the existing technology are solved, the accurate prediction of the harmonic current of industrial users is achieved, and the power efficiency is improved. Efficiency and accuracy of system power quality analysis.
Patent Information
- Application Number
- CN202210620824.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-02
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2042-06-02
AI Technical Summary
The existing harmonic prediction models are not adaptable, have complex modeling and run slowly, making it difficult to effectively predict the harmonic currents of industrial users, resulting in difficulties in power quality management of the power grid.
Using the harmonic source modeling method based on the random forest optimization algorithm, through preprocessing and feature matrix construction of power quality monitoring data, combined with the Bagging and Wrapper algorithms, a random forest model is established to achieve accurate prediction of harmonic currents.
It improves the accuracy and efficiency of harmonic prediction, identifies important harmonic characteristics, reduces data dimensions, simplifies the modeling process, can process high-dimensional data, and provides a theoretical analysis of factors affecting power quality of power systems.
Smart Images

Figure CN114880948B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of harmonic prediction modeling, and in particular to a harmonic prediction modeling method and system based on a random forest optimization algorithm. Background Art
[0002] In recent years, with the rapid development of power electronics technology, power electronic devices have been widely used in life, showing new characteristics of high power electronics. Since most nonlinear loads lack unified harmonic emission limit standards and have not yet installed harmonic filtering devices, the harmonic currents they generate are directly injected into the power grid, exacerbating the harmonic pollution in the power grid. For household users, due to the small power of a single load, the harmonic current injected into the power grid is negligible, and the impact can be ignored. However, for a large-capacity industrial user, the nonlinear loads it contains are characterized by large number, wide distribution, and strong randomness, resulting in high harmonic current content in industrial users and random fluctuation characteristics. The harmonic problems caused to the power grid cannot be ignored. Through actual measurement data, it is found that the current distortion generated by loads containing power electronic devices is very serious, and the total harmonic distortion rate of some loads can even exceed 100%. If the harmonics are not reasonably and effectively intervened, they will flow into a higher-level power system and cause a series of related power quality problems, making it difficult to design power quality management solutions. Therefore, it is very necessary to establish an accurate harmonic model for it.
[0003] At present, there have been many studies on the modeling of harmonic prediction at home and abroad. The existing harmonic prediction models mainly include constant current source model, model based on cross-frequency admittance matrix, Norton equivalent model, and simplified model based on least squares method. With the increase of harmonic prediction types and the improvement of topological structure complexity, neural network modeling methods have emerged that do not consider the internal mechanism of harmonic prediction.
[0004] The above methods still have problems such as limited applicable scenarios, weak adaptability, complex modeling, and slow operation. Summary of the invention
[0005] The purpose of the present invention is to provide a harmonic prediction modeling method and system based on a random forest optimization algorithm to address the above-mentioned problems; the present invention solves the problem of poor adaptability of the harmonic prediction model; and solves the problem of complex modeling and slow operation.
[0006] In view of the above-mentioned defects of the prior art, the present invention takes the harmonic characteristics of industrial users as the research content, and provides a harmonic source modeling method based on the random forest optimization algorithm to achieve accurate prediction of harmonic current under steady-state conditions. First, the harmonic voltage, current and power data of industrial users are obtained through the power quality monitoring device, and the monitoring data is preprocessed to obtain the effective value of each harmonic; then, the harmonic voltage and current feature matrix is constructed, and the harmonic data is sampled using the idea of Bagging (Bootstrap aggregating, guided aggregation algorithm), and a decision tree data set is constructed to achieve regression analysis of unknown harmonic voltage and current values; finally, the random forest harmonic source model is established based on the Wrapper algorithm (wrapping method) and the whale optimization algorithm to achieve the prediction result of a certain harmonic current. Based on this result, the influence of different harmonic voltages on harmonic currents can be accurately evaluated and predicted, which is beneficial to provide a theoretical basis for preventing harmonic pollution and analyzing the influencing factors of power quality characteristics of power systems.
[0007] The technical solution adopted by the present invention is as follows:
[0008] A harmonic prediction modeling method based on a random forest optimization algorithm comprises: obtaining power quality monitoring data, preprocessing the monitoring data, and constructing a harmonic voltage and current feature set; sampling random forest training samples according to the harmonic voltage and current feature set; establishing a regression decision tree according to the sampled samples; constructing a random forest model according to the decision tree; optimizing the random forest model; and obtaining a random forest harmonic prediction model based on harmonic feature optimization after optimization.
[0009] Furthermore, the data preprocessing is data cleaning, including data deletion and abnormal data processing.
[0010] Furthermore, the harmonic voltage and current feature set is constructed as follows:
[0011] Where N represents the number of sampling points in each column; V hj Indicates the value of the jth sampling point of the hth harmonic voltage; I hj Represents the jth sampling point value of the hth harmonic current.
[0012] Furthermore, the random forest training sample sampling method is: randomly extract k harmonic samples with replacement from the original harmonic feature sets X, Y, where k is the total number of data in the harmonic feature set, as the data set P and perform T cycles to form the training set Q of the random forest model.
[0013] Furthermore, the method for establishing a regression decision tree is as follows: there are k sampling points and M feature variables in the harmonic voltage and current feature set X, Y, where M is the input harmonic feature of each order; using the Bootstrap Sample method, k sampling points are extracted from the original harmonic feature set X with replacement, and finally a harmonic sample set with a sample size of k is obtained; m feature variables are randomly selected from the M feature variables to form a harmonic feature variable subset, where m is a constant value, and the optimal feature is selected for splitting through the least squares deviation function, thereby forming a decision tree.
[0014] Furthermore, the method for constructing a random forest model is as follows: construct T decision trees; if there are M feature variables, then m are randomly selected at each node of each decision tree. t The random forest algorithm selects the most dominant variable among the extracted variables by calculating information gain. t The optimal split point for each tree is found among the selected features, and the harmonic feature with the largest information gain is selected as the current split feature; each tree grows to the maximum without any pruning; the generated multiple decision trees form a random forest to predict the required harmonic voltage and current value, and the output result is determined by the average value of the tree output in the random forest; the number of trees in the random forest is modified, and the best group is selected; the performance of the model is evaluated.
[0015] Furthermore, the random forest model is optimized by arranging the importance of each harmonic feature in the random forest model in descending order; first selecting the feature with the highest importance for prediction; then selecting the two features with the highest importance for prediction, repeating the above steps, and calculating the determination coefficient of the prediction results with different numbers of features; selecting several optimal determination coefficients to construct a harmonic voltage and current feature set to obtain optimized feature data.
[0016] Furthermore, the method for obtaining the random forest harmonic prediction model based on harmonic feature optimization after optimization is as follows: based on the optimized feature data, the random forest model after harmonic feature optimization is reconstructed; the optimization of the constructed harmonic prediction model can be completed by combining the screening of the harmonic model; and the random forest harmonic prediction model based on harmonic feature optimization is obtained.
[0017] A harmonic prediction modeling system based on a random forest optimization algorithm comprises: an acquisition module for acquiring power quality monitoring data, preprocessing the monitoring data, and constructing a harmonic voltage and current feature set; a processing module for sampling random forest training samples according to the harmonic voltage and current feature set; establishing a regression decision tree according to the sampled samples; constructing a random forest model according to the decision tree; and an optimization module for optimizing the random forest model to obtain a random forest harmonic prediction model based on harmonic feature optimization.
[0018] In summary, due to the adoption of the above technical solution, the beneficial effects of the present invention are:
[0019] 1. The present invention adopts the random forest algorithm as the main body, with high modeling efficiency. The decision tree only needs to be built once and can be used repeatedly, which solves the shortcomings of a single decision tree with weak generalization ability and easy overfitting.
[0020] 2. The present invention can process high-dimensional data such as harmonic voltage and current without feature selection.
[0021] 3. The present invention can identify which harmonic features are more important through the random forest algorithm; and it has good tolerance in terms of noise and harmonic outliers.
[0022] 4. The present invention determines the harmonic prediction result by the average value of the outputs of all trees in the forest, thereby improving the prediction accuracy.
[0023] 5. The present invention realizes the effective extraction of high-importance harmonic features, reduces the dimension of harmonic feature data, speeds up model training, is relatively simple to implement, and improves prediction accuracy and model efficiency.
[0024] 6. The present invention realizes the prediction of harmonic amplitude. It is beneficial to analyze the interaction between harmonic voltage and current in industrial users, and provide theoretical support for preventing harmonic pollution, exploring the relationship between harmonic voltage and current, and analyzing the influencing factors of power quality characteristics of power systems. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] The present invention will now be described by way of example with reference to the accompanying drawings, in which:
[0026] Figure 1 It is a flow chart of the harmonic prediction modeling method.
[0027] Figure 2 This is the basic principle diagram of the decision tree.
[0028] Figure 3 It is a schematic diagram of the determination coefficient of the prediction results with different feature numbers.
[0029] Figure 4 It is the structural diagram of the wave prediction modeling system. DETAILED DESCRIPTION
[0030] All features disclosed in this specification, or steps in all methods or processes disclosed, except mutually exclusive features and / or steps, can be combined in any manner.
[0031] Any feature disclosed in this specification (including any additional claims and abstract), unless otherwise stated, may be replaced by other equivalent or alternative features having similar purposes. That is, unless otherwise stated, each feature is only an example of a series of equivalent or similar features.
[0032] Example 1
[0033] A harmonic prediction modeling method based on random forest optimization algorithm, such as Figure 1 As shown, including:
[0034] S1: Obtain power quality monitoring data, pre-process the monitoring data, and construct a harmonic voltage and current feature set.
[0035] The method for obtaining power quality monitoring data is as follows: In this embodiment, the power quality monitoring data of a 110kV industrial user is obtained, and the sampling data with a time interval of 3min in the power quality monitoring system of the industrial user is selected for research, including the total harmonic voltage distortion rate (THDu), the harmonic voltage content rate (HRUh), the total harmonic current distortion rate (THDi), the effective value of each harmonic current (Ih), etc., and the effective value of each harmonic voltage (Vh) can be calculated, as shown below:
[0036] V h =HRU h ×V1
[0037] Among them HRU h is the content rate of each harmonic voltage, and V1 is the effective value of the fundamental voltage.
[0038] The data preprocessing is to clean the data, including data deletion and abnormal data processing, specifically:
[0039] Data deletion is mainly divided into two situations: missing data deletion and non-principal component data deletion; if the missing data exceeds 90%, the data set should be deleted, otherwise the missing data should be filled.
[0040] This embodiment uses the "adjacent data average method" to process the data set: select the L valid data before the null value and the L valid data after the null value to take the average value to estimate and replace the null value; for industrial users, their odd harmonics are the main harmonic components, so the odd harmonics are directly selected as harmonic data samples.
[0041] For the processing of abnormal data, this embodiment mainly selects CP95 values and manually checks, arranges the sampled points in order from large to small, removes the 5% maximum value, and the largest remaining value is the 95% probability value; and replaces the data that is obviously biased from the actual measurement value by data filling.
[0042] The constructing of harmonic voltage and current feature sets is as follows: after data processing, constructing harmonic voltage and current feature sets X and Y of the analysis object;
[0043] Where N represents the number of sampling points in each column; V hj (h=1,3,……,n,j=1,2,……,N) represents the jth sampling point value of the hth harmonic voltage; I hj (h=1,3,...,n,j=1,2,...,N) represents the jth sampling point value of the hth harmonic current.
[0044] S2: Random forest training sample sampling based on harmonic voltage and current feature set.
[0045] The random forest training sample sampling method is: randomly extract k harmonic samples with replacement from the original harmonic feature set X, Y, where k is the total number of data in the harmonic feature set, as the data set P:
[0046]
[0047] where x i,t is a harmonic voltage or current value randomly selected from the feature set X, Y each time, N + Represents the set of non-zero natural numbers.
[0048] Then repeat T times to form the training set Q of the random forest model:
[0049] Q={P1,P2,…,P t ,…|t≤T,t∈N +}
[0050] Each cycle sample is independent of each other and is used to construct T regression decision trees. Finally, the average value of each decision tree is taken as the final prediction result, which greatly improves the accuracy of the model. When generating training subsets, theoretically, the probability of each training sample being selected each time is the same. After multiple extractions, the probability of each harmonic sampling point being selected is When k→∞, the probability is approximately equal to 0.368, that is, about 36.8% of the samples are not drawn each time. These samples are called out-of-bag data (OOB).
[0051] S3: Establish a regression decision tree based on the sampled samples.
[0052] A decision tree is a tree structure (can be a binary tree or a non-binary tree). Each non-leaf node represents a test on a harmonic feature attribute, each branch represents the output of this harmonic feature attribute in a certain value range, and each leaf node represents the final test result. The process of using a decision tree to make decisions starts from the root node, tests the corresponding feature attributes in the harmonic to be classified, and selects the output branch according to its value until it reaches the leaf node, and takes the category stored in the leaf node as the decision result; the principle of the decision tree is as follows Figure 2 shown.
[0053] The specific implementation process is as follows: There are k sampling points and M feature variables in the harmonic voltage and current feature set X, Y, where M is the input harmonic feature of each order. Using the Bootstrap Sample method, k sampling points are extracted from the original harmonic feature set X with replacement, and finally a harmonic sample set with a sample size of k is obtained. Randomly select m (m≤M) feature variables from the M feature variables to form a harmonic feature variable subset, where m is a constant. The optimal feature is selected for splitting through the least squares deviation function to form a decision tree. When Bootstrap sampling is performed on the feature sets X and Y, some sample points in X and Y may be repeatedly sampled multiple times. In this embodiment, the probability of each sample point being selected is 63.3%. The decision tree is actually a method of dividing the space with a hyperplane. Each time the space is divided, the current space is divided into two, such as when processing a three-dimensional data.
[0054] S4: Build a random forest model based on decision trees.
[0055] The random forest model uses a random method to build a forest, which is composed of multiple decision trees. For the classification algorithm, after the forest is formed, when a new input harmonic sample enters, each decision tree in the forest will make a judgment to determine which category the sample should belong to, and then see which category is selected the most, and predict the sample as that category. Random forest regression can be regarded as a strong predictor that integrates many weak predictors.
[0056] Each decision tree in the random forest is a binary tree, and its generation follows the top-down recursive splitting principle, that is, the harmonic training set is divided in sequence starting from the root node; in the binary tree, the root node contains all the harmonic training data, and according to the principle of minimum node purity, it is split into left nodes and right nodes, which respectively contain a subset of the harmonic training data. According to the same rule, the node continues to split until the branch stop rule is met and the growth stops.
[0057] The specific implementation process of random forest is as follows:
[0058] (1) The original training set is the harmonic feature set X, Y. The Bootstrap method in the previous section is used to randomly extract k sample points with replacement, and this is repeated T times. Finally, T new harmonic sample sets are obtained, and T decision trees are constructed based on them. The harmonic samples that are not extracted each time constitute T out-of-bag data.
[0059] (2) If there are M feature variables, then m are randomly selected at each node of each tree. t Features (m t ≤M), m t It is usually the square root or one third of the number of features M. You can also select a most dominant variable from the extracted variables by calculating its information gain. The random forest algorithm will select the most dominant variable from the extracted variables in m. t The optimal split point for each tree is found among the selected features.
[0060] It is known that the training data set is the harmonic voltage and current feature set X, Y, |XY| represents the number of samples. There are M feature variables M k , k=1,2…K,|M k | is the harmonic feature M k The number of samples is ∑|M k |=|XY|. Suppose a harmonic characteristic A has n different values {a1, a2…a n}, according to the value of feature A, divide X and Y into n subsets XY1, XY2…XY n ;|XY i | for XY i The number of samples is: ∑|XY i |=|XY|. Calculate the empirical entropy of the harmonic feature set X, Y:
[0061]
[0062] Calculate the empirical conditional entropy:
[0063]
[0064] In the formula, the set XYik is the collection of samples belonging to the feature Mk in the subset XYi; |XYik| is the number of samples in the set XYik.
[0065] Information gain of a harmonic feature A:
[0066] g(XY,A)=G(XY)-G(XY|A)
[0067] The harmonic feature with the largest information gain is selected as the current split feature.
[0068] (3) Each tree is allowed to grow to its maximum without any pruning.
[0069] (4) The generated multiple decision trees are combined into a random forest to predict the required harmonic voltage and current value, and the output result is determined by the average value of the tree output in the random forest.
[0070] The random forest algorithm is based on a model composed of a group of decision trees, and finally takes the average value of the output of each decision tree as the harmonic source model of the random forest. The predicted value of a certain harmonic voltage or current is obtained, and its expression is:
[0071]
[0072] In the formula, θ t is a random variable that obeys an independent distribution; x is the input harmonic vector; T represents the number of decision trees; h(x,θ t ) is the decision tree based on x and θ t For any new input vector x, this prediction function can give a prediction value
[0073] Modify the number of trees in the random forest and select the one with the best effect.
[0074] (6) Model performance evaluation: The trained random forest model is used to generate prediction results for the harmonic voltage or current amplitude, and its mean absolute error (MAE) and its mean square error (MSE) are calculated to evaluate the calculation accuracy of the model.
[0075]
[0076]
[0077] Where: is the harmonic prediction value of the model, and Yi is the actual measurement result of the harmonic.
[0078] S5: Optimize the random forest model to determine whether it is optimal.
[0079] For this industrial user, odd harmonics are its dominant feature vectors, but for the model, too much harmonic data will lead to a long training time for the model, and the data analysis dimension is high, and different numbers of harmonic features will also affect the prediction effect of the model. In order to effectively reduce the data analysis dimension and optimize the prediction effect of the model, the Wrapper method is used to screen the harmonic features of the industrial user's harmonic feature set X, Y. The basic process is as follows:
[0080] Arrange the importance (feature_importance) of each harmonic feature in the random forest model in descending order. First, select the most important feature for prediction; then select the two most important features for prediction, and repeat the above steps to calculate the determination coefficient R2 of the prediction results with different numbers of features.
[0081] R2=SSR / SST
[0082]
[0083]
[0084]
[0085] Where SST is the total sum of squares, SSR is the regression sum of squares; is the average value of the actual measurement results of harmonics. The value range of R2 is [0, 1]. The larger the determination coefficient, the higher the degree of explanation of the independent variable to the dependent variable, and the higher the percentage of the change caused by the independent variable in the total change. The determination coefficient R2 of the prediction results of different feature numbers, such as Figure 3 shown.
[0086] Depend on Figure 3 It can be seen that when the number of feature selections is 6, the prediction effect of the model is the best, and R2 = 0.9876. As the number of feature selections increases, the prediction effect of the model tends to be stable, and a single feature can no longer affect the prediction effect of the model to a large extent. In summary, six features are selected, namely: fundamental voltage, 3rd harmonic voltage, fundamental current, 7th harmonic current, 11th harmonic current, and 13th harmonic current. Construct the harmonic voltage and current feature set X′. As shown below:
[0087]
[0088] Wherein, Vhj (h = 1, 3, j = 1, 2, ..., N) represents the j-th sampling point value of the h-th harmonic voltage; Ihj (h = 1, 3, 7, 11, j = 1, 2, ..., N) represents the j-th sampling point value of the h-th harmonic current.
[0089] Based on the optimized feature data, if the optimum is not reached, S2-S4 are repeated. When the optimal feature data is reached, a random forest model with optimized harmonic features is constructed.
[0090] S6: After optimization, a random forest harmonic prediction model based on harmonic feature optimization is obtained.
[0091] Based on the optimized feature data, the random forest model after harmonic feature optimization is reconstructed; combined with the screening of the harmonic model, the constructed harmonic prediction model can be optimized; and the random forest harmonic prediction model based on harmonic feature optimization is obtained.
[0092] Example 2
[0093] A harmonic prediction modeling system based on random forest optimization algorithm, such as Figure 4 As shown, including:
[0094] The acquisition module is used to obtain power quality monitoring data, pre-process the monitoring data, and construct a harmonic voltage and current feature set.
[0095] The data is preprocessed to clean the data, including data deletion and abnormal data processing; the harmonic voltage and current feature set is constructed as follows:
[0096] Where N represents the number of sampling points in each column; V hj Indicates the jth sampling point value of the hth harmonic voltage; I hj Represents the jth sampling point value of the hth harmonic current.
[0097] The processing module is used to sample random forest training samples according to the harmonic voltage and current feature set; establish a regression decision tree according to the sampled samples; and construct a random forest model according to the decision tree.
[0098] The random forest training sample sampling method is: randomly extract k harmonic samples with replacement from the original harmonic feature set X, Y, where k is the total number of data in the harmonic feature set, as the data set P and perform T cycles to form the training set Q of the random forest model.
[0099] The method for establishing a regression decision tree is as follows: there are k sampling points and M feature variables in the harmonic voltage and current feature set X, Y, where M is the input harmonic feature of each order; using the Bootstrap Sample method, k sampling points are extracted from the original harmonic feature set X with replacement, and finally a harmonic sample set with a sample size of k is obtained; m feature variables are randomly selected from the M feature variables to form a harmonic feature variable subset, where m is a constant, and the optimal feature is selected for splitting through the least squares deviation function, thereby forming a decision tree.
[0100] The method of constructing a random forest model is as follows: construct T decision trees; if there are M feature variables, then randomly select m at each node of each decision tree. t The random forest algorithm selects the most dominant variable among the extracted variables by calculating information gain. tThe optimal split point for each tree is found among the selected features, and the harmonic feature with the largest information gain is selected as the current split feature; each tree grows to the maximum without any pruning; the generated multiple decision trees form a random forest to predict the required harmonic voltage and current value, and the output result is determined by the average value of the tree output in the random forest; the number of trees in the random forest is modified, and the best group is selected; the performance of the model is evaluated.
[0101] The optimization module is used to optimize the random forest model to obtain a random forest harmonic prediction model based on harmonic feature optimization.
[0102] The optimization method for the random forest model is as follows: arrange the importance of each harmonic feature in the random forest model in descending order; first select the feature with the highest importance for prediction; then select the two features with the highest importance for prediction, repeat the above steps, and calculate the determination coefficient of the prediction results with different numbers of features; select several optimal determination coefficients to construct the harmonic voltage and current feature set to obtain the optimized feature data.
[0103] After optimization, the random forest harmonic prediction model based on harmonic feature optimization is obtained as follows: based on the optimized feature data, the random forest model after harmonic feature optimization is reconstructed; the constructed harmonic prediction model can be optimized by combining the screening of the harmonic model; the random forest harmonic prediction model based on harmonic feature optimization is obtained.
[0104] The present invention adopts the random forest algorithm as the main body, has high modeling efficiency, and the decision tree only needs to be built once and can be used repeatedly, which solves the shortcomings of weak generalization ability and easy overfitting of a single decision tree; it performs well on the harmonic feature set, can process high-dimensional data such as harmonic voltage and current, and does not need to do feature selection; after training, the random forest algorithm can identify which harmonic features are more important; and it has good tolerance in terms of noise and harmonic outliers. The harmonic prediction result is determined by the average value of the output of all trees in the forest, so that the prediction accuracy can be improved.
[0105] The Wrapper method is used to analyze the 24-hour monitoring data in the example. After obtaining the importance of each harmonic feature, the prediction effect of selecting different numbers of harmonic features is compared to determine the required harmonic features. The effective extraction of high-importance harmonic features is achieved, the dimension of harmonic feature data is reduced, the model training speed is faster, the implementation is simpler, and the prediction accuracy and model efficiency are improved.
[0106] The present invention realizes the prediction of harmonic amplitude, is beneficial to analyze the interaction between harmonic voltage and current in industrial users, and provides theoretical support for preventing harmonic pollution, exploring the relationship between harmonic voltage and current, and analyzing the influencing factors of power quality characteristics of power systems.
[0107] The present invention is not limited to the above-mentioned specific embodiments, but extends to any new features or any new combination disclosed in this specification, as well as any new method or process steps or any new combination disclosed.
Claims
1. A harmonic prediction modeling method based on random forest optimization algorithm, characterized in that: include: Acquire power quality monitoring data, pre-process the monitoring data, and construct a harmonic voltage and current feature set; sample random forest training samples based on the harmonic voltage and current feature set; establish a regression decision tree based on the sampled samples; construct a random forest model based on the decision tree; optimize the random forest model; after optimization, obtain a random forest harmonic prediction model based on harmonic feature optimization; The method for constructing a random forest model is as follows: construct T decision trees; if there are M feature variables, then m random variables are selected at each node of each decision tree. t The random forest algorithm selects the most dominant variable among the extracted variables by calculating information gain. t Find the best split point for each tree among the selected features, and select the harmonic feature with the largest information gain as the current split feature; grow each tree to the maximum without any pruning; generate multiple decision trees to form a random forest to predict the required harmonic voltage and current value, and the output result is determined by the average value of the tree output in the random forest; modify the number of trees in the random forest and select the one with the best effect; evaluate the performance of the model; The optimization method for the random forest model is as follows: the importance of each harmonic feature in the random forest model is arranged in descending order; the feature with the highest importance is selected for prediction first; Then, the two most important features are selected for prediction, and the above steps are repeated to calculate the determination coefficients of the prediction results with different feature numbers; several optimal determination coefficients are selected to construct the harmonic voltage and current feature set to obtain the optimized feature data; The method for obtaining the random forest harmonic prediction model based on harmonic feature optimization after optimization is as follows: based on the optimized feature data, the random forest model after harmonic feature optimization is reconstructed; the optimization of the constructed harmonic prediction model can be completed by combining the screening of the harmonic model; and the random forest harmonic prediction model based on harmonic feature optimization is obtained.
2. The harmonic prediction modeling method based on the random forest optimization algorithm according to claim 1, characterized in that: The preprocessing of the monitoring data is to clean the monitoring data, including data deletion and abnormal data processing.
3. The harmonic prediction modeling method based on the random forest optimization algorithm according to claim 1, characterized in that: The harmonic voltage and current feature set is constructed as follows: Where N represents the number of sampling points in each column; V hj Indicates the jth sampling point value of the hth harmonic voltage; I hj Represents the jth sampling point value of the hth harmonic current.
4. The harmonic prediction modeling method based on the random forest optimization algorithm according to claim 3 is characterized in that: The random forest training sample sampling method is: randomly extract k harmonic samples with replacement from the original harmonic feature set X, Y, where k is the total number of data in the harmonic feature set, as the data set P and perform T cycles to form the training set Q of the random forest model.
5. The harmonic prediction modeling method based on random forest optimization algorithm according to claim 4 is characterized in that: The method for establishing a regression decision tree is as follows: there are k sampling points and M feature variables in the harmonic voltage and current feature set X, Y, where M is the input harmonic feature of each order; using the Bootstrap Sample method, k sampling points are extracted from the original harmonic feature set X with replacement, and finally a harmonic sample set with a sample size of k is obtained; m feature variables are randomly selected from the M feature variables to form a harmonic feature variable subset, where m is a fixed value, and the optimal feature is selected for splitting through the least squares deviation function, thereby forming a decision tree.
6. A harmonic prediction modeling system based on random forest optimization algorithm, characterized in that: The harmonic prediction modeling method based on the random forest optimization algorithm used to implement any one of claims 1 to 5 includes: an acquisition module, used to obtain power quality monitoring data, and pre-process the monitoring data to construct a harmonic voltage and current feature set; a processing module, used to sample random forest training samples according to the harmonic voltage and current feature set; establish a regression decision tree according to the sampled samples; construct a random forest model according to the decision tree; an optimization module, used to optimize the random forest model to obtain a random forest harmonic prediction model based on harmonic feature optimization.
