Rainfall level prediction method and device, terminal equipment and computer readable storage medium

Through the particle swarm optimization algorithm combined with neural network model, a model that can more accurately predict rainfall levels is built, solving the problem of insufficient prediction of the existing technology in extreme weather and complex terrain, and improving the accuracy and adaptability of rainfall prediction.

CN120085393APending Publication Date: 2025-06-03ELECTRIC POWER RES INST OF GUANGDONG POWER GRID CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510158661.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-13
Publication Date
2025-06-03

AI Technical Summary

Technical Problem

When facing extreme weather conditions, existing rainfall prediction methods are difficult to accurately capture the fine structure of rainfall changes, and their generalization capabilities in complex terrain and special climate areas are insufficient, so they cannot effectively deal with sudden and high-intensity rainfall events.

Method used

The particle swarm optimization algorithm is used to combine the neural network model, and the final rainfall level prediction model is constructed by initializing the particle velocity and position, iterative optimization operations, determining the target weight and bias. This model can better capture the complex nonlinear relationship between meteorological data and rainfall levels, improving prediction accuracy and adaptability.

Benefits of technology

It improves the accuracy and adaptability of rainfall predictions, can more effectively deal with rainfall events in extreme weather and complex terrain, and reduces the risk of power grid operation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120085393A_ABST
    Figure CN120085393A_ABST
Patent Text Reader

Abstract

The invention discloses a rainfall level prediction method and device, terminal equipment and a computer readable storage medium. The method comprises the following steps: acquiring meteorological data of to-be-predicted power grid equipment; inputting the meteorological data into a preset rainfall level prediction model, so that the model generates the rainfall level of the power grid equipment according to the meteorological data; the model is determined by the following steps: initializing the particle speed and the particle position; the iterative optimization operation is repeatedly executed until the preset number of iterations or error convergence is reached, the target weight and the target bias are obtained, and a final model is determined; the iterative optimization operation comprises the following steps: determining a current model according to a current particle position; acquiring a plurality of training samples, and inputting the training samples into the current model to calculate errors; determining a target weight and a target bias according to the current particle position under the condition of reaching a preset number of iterations or error convergence; otherwise, updating the particle speed and the particle position. According to the invention, the accuracy and adaptability of rainfall prediction can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of rainfall prediction, and particularly to a method, device, terminal device and computer-readable storage medium for predicting rainfall levels. Background Art

[0002] The protection of power grid equipment is an important link to ensure the stable operation of the power system. The key lies in effectively preventing equipment failures, optimizing operation and maintenance strategies, and coping with external environmental interferences. Among them, external meteorological conditions, especially changes in rainfall, may not only lead to a decline in equipment insulation performance, increase the risk of short circuits, but also trigger natural disasters such as floods, further threatening the overall stability of the power grid.

[0003] In order to effectively cope with the external environment, especially the impact of rainfall on power grid equipment, current power grid equipment protection combines rainfall prediction methods. These technologies are mainly divided into two categories: one is the statistical method based on historical data, which analyzes the correlation between historical rainfall data and power grid equipment failures to establish a prediction model; the other is the dynamic method based on physical mechanisms, which simulates and predicts rainfall according to the laws of atmospheric motion and uses meteorological principles.

[0004] However, when facing extreme weather conditions such as typhoons and heavy rains, these two traditional methods both show certain limitations. In extreme weather, the rainfall process often exhibits highly complex and non-linear characteristics, which makes it difficult for traditional statistical methods to accurately capture the fine structure of rainfall changes, while the dynamic model may lose prediction accuracy due to inaccurate parameter settings, initial conditions or simplification of physical mechanisms. Especially in complex terrain and special climate regions such as mountainous areas and coastal zones, the generalization ability of these traditional methods is severely restricted, and they cannot effectively cope with sudden and intense rainfall events, thus increasing the risk of power grid operation. Therefore, there is an urgent need for a new rainfall prediction method to improve prediction accuracy and adaptability. Summary of the Invention

[0005] Embodiments of the present invention provide a method, device, terminal device and computer-readable storage medium for predicting rainfall levels, which can improve the accuracy and adaptability of rainfall prediction.

[0006] An embodiment of the present invention provides a method for predicting rainfall levels, including:

[0007] Obtain the meteorological data of the power grid equipment to be predicted; the meteorological data includes: temperature parameter, humidity parameter, wind speed parameter, wind direction parameter and sunshine parameter;

[0008] Input the meteorological data into a preset rainfall level prediction model, so that the rainfall level prediction model generates the rainfall level of the power grid equipment according to the meteorological data;

[0009] Among them, the rainfall level prediction model is determined in the following manner:

[0010] Initialize the particle velocity and particle position; the particle position is used to represent the weights and biases of the rainfall level prediction model;

[0011] Repeat the iterative optimization operation until the preset number of iterations is reached or the error converges, to obtain the target weights and target biases;

[0012] Determine the final rainfall level prediction model according to the target weights and target biases;

[0013] The iterative optimization operation includes: determining the current rainfall level prediction model according to the current particle position; among them, the particle velocity and particle position for the first execution of the iterative optimization operation are the initialized particle velocity and particle position;

[0014] Obtain a number of training samples; the training samples include: meteorological data of power grid equipment and its corresponding actual rainfall levels; input the number of training samples into the current rainfall level prediction model, and calculate the error; in the case where the preset number of iterations is reached or the error converges, determine the target weights and target biases according to the current particle position; otherwise, update the particle velocity and particle position, and use the updated particle velocity and updated particle position as the current particle velocity and current particle position when the iterative optimization operation is executed next time.

[0015] Furthermore, inputting a number of training samples into the current rainfall level prediction model and calculating the error includes:

[0016] Input a number of training samples into the current rainfall level prediction model, so that the current rainfall level prediction model outputs a predicted rainfall level according to the meteorological data in the training samples;

[0017] Calculate the mean square error value according to the predicted rainfall level and its corresponding actual rainfall level, and use the mean square error value as the error.

[0018] Furthermore, updating the particle velocity and particle position includes:

[0019] For each particle, determine whether the current error is less than the error corresponding to the individual historical optimal position at the previous update moment. If so, use the current particle position corresponding to the current error as the current individual historical optimal position; otherwise, use the individual historical optimal position at the previous update moment as the current individual historical optimal position; among them, the error corresponding to the individual historical optimal position at the initial previous update moment is infinite;

[0020] Select the particle with the smallest error from all particles, and determine whether the error corresponding to the particle with the smallest error is less than the error corresponding to the globally historically optimal position at the previous update moment. If so, take the current particle position corresponding to the particle with the smallest error as the current globally historically optimal position; otherwise, take the globally historically optimal position at the previous update moment as the current globally historically optimal position. Among them, the error corresponding to the globally historically optimal position at the previous update moment at the initial time is infinite;

[0021] Update the particle velocity and particle position based on the current particle position, current particle velocity, current individual historically optimal position, and current globally historically optimal position to obtain the updated particle velocity and updated particle position.

[0022] Furthermore, before inputting the meteorological data into the preset rainfall level prediction model, it also includes:

[0023] Determine the current globally historically optimal position based on the current particle position;

[0024] Take the weight and bias corresponding to the current globally historically optimal position as the target weight and target bias.

[0025] Furthermore, before inputting the meteorological data into the preset rainfall level prediction model, it also includes:

[0026] Perform outlier detection and normalization processing on the meteorological data of the power grid equipment to be predicted to obtain the preprocessed meteorological data.

[0027] Furthermore, after determining the final rainfall level prediction model, it also includes:

[0028] Obtain the test data and divide the test data into several test subsets; the test data includes: the meteorological data of several power grid equipment and their corresponding actual rainfall levels;

[0029] Select a group of test subsets from the test data and use the remaining test subsets as the training set;

[0030] Repeat the cross-validation operation until the preset number of validations is reached to obtain the validation error of each cross-validation operation;

[0031] Calculate the mean value of the validation errors of each cross-validation operation to obtain the average validation error of the rainfall level prediction model;

[0032] Determine the performance evaluation result of the rainfall level prediction model based on the average validation error and the preset evaluation threshold;

[0033] The cross-validation operation includes:

[0034] Input the current training set into the final rainfall level prediction model, so that the final rainfall level prediction model is trained with the meteorological data in the current training set as the input and the corresponding actual rainfall level in the current training set as the output until the error converges, and a cross-validation model is obtained;

[0035] Input the current test subset into the cross-validation model, so that the cross-validation model generates the corresponding predicted rainfall level according to the meteorological data in the current test subset;

[0036] Calculate the validation error according to the predicted rainfall level and the corresponding actual rainfall level in the current test subset;

[0037] Accumulate the number of cross-validations, and determine whether the number of cross-validations reaches the preset number of validations. If so, output the validation error of each cross-validation operation. Otherwise, sequentially select the next group of test subsets from the test data as the current test subset for the next cross-validation operation, and use the remaining test subsets as the current training set for the next cross-validation operation.

[0038] Based on the above method embodiment, the present invention correspondingly provides an apparatus embodiment, including: a meteorological data acquisition module and a rainfall level prediction module;

[0039] The meteorological data acquisition module is used to acquire the meteorological data of the power grid equipment to be predicted; the meteorological data includes: temperature parameter, humidity parameter, wind speed parameter, wind direction parameter, and sunshine parameter;

[0040] The rainfall level prediction module is used to input the meteorological data into a preset rainfall level prediction model, so that the rainfall level prediction model generates the rainfall level of the power grid equipment according to the meteorological data;

[0041] Among them, the rainfall level prediction module includes: a particle initialization sub-module, an iterative optimization sub-module, and a prediction model determination sub-module;

[0042] The particle initialization sub-module is used to initialize the particle velocity and particle position; the particle position is used to represent the weights and biases of the rainfall level prediction model;

[0043] An iterative optimization sub-module is used to repeatedly execute iterative optimization operations until a preset number of iterations is reached or the error converges, so as to obtain the target weights and target biases. The iterative optimization operations include: determining the current rainfall level prediction model according to the current particle position, where the particle velocity and particle position for the first execution of the iterative optimization operation are the initialized particle velocity and particle position; obtaining a number of training samples, where the training samples include the meteorological data of the power grid equipment and its corresponding actual rainfall level; inputting the number of training samples into the current rainfall level prediction model to calculate the error; in the case of reaching the preset number of iterations or error convergence, determining the target weights and target biases according to the current particle position; otherwise, updating the particle velocity and particle position, and using the updated particle velocity and updated particle position as the current particle velocity and current particle position when the iterative optimization operation is executed next time.

[0044] A prediction model determination sub-module is used to determine the final rainfall level prediction model according to the target biases of the target weights.

[0045] Furthermore, the rainfall level prediction device further includes: a preprocessing module.

[0046] The preprocessing module is used to perform outlier detection and normalization processing on the meteorological data of the power grid equipment to be predicted, so as to obtain the preprocessed meteorological data.

[0047] Based on the above method item embodiment, the present invention correspondingly provides a terminal device item embodiment, including: a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, the steps of the rainfall level prediction method as described in the present invention are implemented.

[0048] Based on the above method item embodiment, the present invention correspondingly provides a computer-readable storage medium item embodiment, including: a stored computer program. When the computer program runs, it controls the device where the computer-readable storage medium is located to execute the steps of the rainfall level prediction method as described in the present invention.

[0049] Compared with the prior art, the beneficial effects of the embodiments of the present solution are as follows:

[0050] The present invention obtains meteorological data of the power grid equipment to be predicted. The meteorological data includes temperature parameters, humidity parameters, wind speed parameters, wind direction parameters, and sunshine parameters. Subsequently, the meteorological data is input into a preset rainfall level prediction model, so that the rainfall level prediction model generates the rainfall level of the power grid equipment according to the meteorological data. Among them, the rainfall level prediction model is determined in the following manner. First, the particle velocity and particle position are initialized. The particle position is used to represent the weights and biases of the rainfall level prediction model. The iterative optimization operation is repeatedly executed until the preset number of iterations is reached or the error converges, obtaining the target weights and target biases, thereby obtaining the parameter configuration of the optimal neural network model. Finally, according to the target biases of the target weights, the final rainfall level prediction model is determined. Since the neural network has multiple layers of neurons and non-linear activation functions, it can capture the complex and variable non-linear relationship between meteorological data and rainfall level. The rainfall phenomenon is often affected by multiple meteorological factors, and the relationship between these factors is often highly non-linear. Therefore, the neural network model can better describe the law of rainfall and improve the accuracy and reliability of prediction. In order to determine the optimal parameter configuration of this rainfall level prediction model, the present invention uses the particle swarm optimization algorithm for iterative optimization. Specifically, in the iterative optimization process, according to the current particle position, the current rainfall level prediction model is determined. Then, a number of training samples are obtained. The training samples include the meteorological data of the power grid equipment and its corresponding actual rainfall level. Next, the number of training samples is input into the current rainfall level prediction model to calculate the error. When the preset number of iterations is reached or the error converges, it is considered that the optimal neural network parameter configuration, that is, the target weights and target biases, has been found. At this time, according to the current particle position, the target weights and target biases are determined, and the rainfall level prediction model reaches its best prediction state; otherwise, the particle velocity and particle position are updated, and the updated particle velocity and updated particle position are used as the current particle velocity and current particle position when the iterative optimization operation is executed next time to continue searching for a better parameter configuration, ensuring the continuous optimization of the model parameters until the optimal neural network parameters are found. Through the iterative search of the particle swarm optimization algorithm, the parameters of the neural network model are continuously optimized, thereby improving the accuracy and adaptability of rainfall prediction. Description of the Drawings

[0051] Figure 1 is a schematic flowchart of the rainfall level prediction method provided by an embodiment of the present invention;

[0052] Figure 2 is a schematic flowchart of the process for confirming the rainfall level prediction model provided by an embodiment of the present invention;

[0053] Figure 3 is a schematic structural diagram of the rainfall level prediction device provided by an embodiment of the present invention;

[0054] Figure 4 It is a schematic structural diagram of another rainfall level prediction device provided by an embodiment of the present invention. Detailed implementation manners

[0055] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

[0056] As Figure 1 shown, an embodiment of the present invention provides a rainfall level prediction method, which at least includes the following steps:

[0057] Step S1: Obtain the meteorological data of the power grid equipment to be predicted; the meteorological data includes: temperature parameter, humidity parameter, wind speed parameter, wind direction parameter, and sunshine parameter;

[0058] For step S1, to obtain the meteorological data of the power grid equipment to be predicted, the meteorological data includes temperature parameter, humidity parameter, wind speed parameter, wind direction parameter, and sunshine parameter. Specifically, the temperature parameter includes the average temperature and the daily minimum temperature; the humidity parameter includes the average water vapor pressure, the average relative humidity, and the minimum relative humidity; the wind speed parameter includes the average wind speed, the maximum wind speed, and the extreme wind speed; the wind direction parameter includes the wind direction of the maximum wind speed and the wind direction of the extreme wind speed; the sunshine parameter includes the sunshine duration.

[0059] It should be noted that the obtained meteorological data is the integration result of multi-source meteorological data, and these data sources include surface observation stations, satellite remote sensing, meteorological radars, and geographical data, etc. The surface observation stations provide meteorological element data with relatively high accuracy, such as rainfall, temperature, humidity, air pressure, and wind speed, but the spatial coverage is limited; satellite remote sensing has a wide spatial coverage range and can provide information such as cloud thickness, surface temperature, and precipitation estimation, and the time resolution is usually once every 15 - 30 minutes; meteorological radars can monitor the occurrence and change of meteorological phenomena such as precipitation in real time and provide accurate spatial and temporal distribution information for the prediction model. In order to obtain this multi-source meteorological data, a real-time acquisition method is adopted and combined with a meteorological open resource platform (such as the geostationary operational environmental satellite GOES, Fengyun satellite FY, or regional radar system) for data integration and processing, providing multi-dimensional input data for the prediction model.

[0060] In a preferred embodiment, before inputting the meteorological data into a preset rainfall level prediction model, it further includes:

[0061] Perform outlier detection and normalization on the meteorological data for predicting power grid equipment to obtain preprocessed meteorological data.

[0062] In an embodiment of the present invention, first, noise data is removed from the acquired meteorological data through outlier detection. Specifically, the 3-sigma rule is used to detect observed values outside the reasonable range, and linear interpolation or KNN interpolation is used to fill in the missing values. At the same time, the time scale is unified through resampling technology, and the high-frequency observations of radar data are aligned to the time resolution of satellite and ground observations. In addition, the geographical coordinate mapping and grid method are used to unify the spatial resolution of data from different sources to ensure the consistency of each data source within the same geographical area. Subsequently, standardization and normalization processing are performed to eliminate the influence of different data feature dimensions. For example, the min-max normalization method is used to scale the data to the 0-1 interval to ensure that the features of the data are within the same scale range.

[0063] Step S2: Input the meteorological data into a preset rainfall level prediction model so that the rainfall level prediction model generates the rainfall level of the power grid equipment according to the meteorological data;

[0064] Among them, the rainfall level prediction model is determined in the following manner:

[0065] Initialize the particle velocity and particle position; the particle position is used to represent the weights and biases of the rainfall level prediction model;

[0066] Repeat the iterative optimization operation until the preset number of iterations is reached or the error converges to obtain the target weights and target biases;

[0067] Determine the final rainfall level prediction model according to the target weights and target biases;

[0068] The iterative optimization operation includes: determining the current rainfall level prediction model according to the current particle position; among them, the particle velocity and particle position for the first execution of the iterative optimization operation are the initialized particle velocity and particle position;

[0069] Obtain a number of training samples; the training samples include: the meteorological data of the power grid equipment and its corresponding actual rainfall level; input the number of training samples into the current rainfall level prediction model and calculate the error. In the case where the preset number of iterations is reached or the error converges, determine the target weights and target biases according to the current particle position; otherwise, update the particle velocity and particle position, and use the updated particle velocity and updated particle position as the current particle velocity and current particle position when the iterative optimization operation is executed next time.

[0070] For step S2, the preprocessed meteorological data is input into a preset rainfall level prediction model. The rainfall level prediction model of the present invention belongs to a neural network model. Through the neurons and connections inside it, it has learned the complex non-linear relationship between meteorological data and rainfall levels, and can predict the rainfall level based on the preprocessed meteorological data. It should be noted that the rainfall level range of the present invention includes no rain, light rain, moderate rain, heavy rain, rainstorm, heavy rainstorm, and extreme rainstorm.

[0071] By inputting meteorological data into the rainfall level prediction model, the future rainfall level can be predicted in real time, so as to issue a warning signal in a timely manner, reminding grid operation and maintenance personnel to take necessary preventive measures, such as strengthening inspections, adjusting the grid operation mode, etc., to cope with the possible impact of rainfall on grid equipment.

[0072] It should be noted that the rainfall level prediction model (BP) of the present invention simulates the foraging behavior of bird flocks through the particle swarm optimization algorithm (PSO), searches for the optimal solution in the solution space, and thus finds a set of optimal weight and bias parameters, which significantly improves the prediction accuracy and stability of the rainfall level prediction model.

[0073] Specifically, as Figure 2 shown, the confirmation process of the rainfall level prediction model includes the following steps:

[0074] Step S21: Initialize the particle velocity and particle position; the particle position is used to represent the weights and biases of the rainfall level prediction model;

[0075] For step S21, initialize the particle swarm. The initial positions of the particles are randomly generated, and the initial velocities of the particles are also randomly set within a preset range. Each particle position represents the weights and biases of the rainfall level prediction model, and these two parameters together determine the prediction performance of the rainfall level prediction model under given meteorological data; each particle velocity represents the direction and rate of movement of the particle in the parameter space, guiding how the particle moves towards a better solution according to the current position.

[0076] Step S22: Repeat the iterative optimization operation until the preset number of iterations is reached or the error converges, and obtain the target weights and target biases;

[0077] The iterative optimization operation includes: determining the current rainfall level prediction model according to the current particle position; among them, the particle velocity and particle position for the first execution of the iterative optimization operation are the initialized particle velocity and particle position;

[0078] Obtain a number of training samples; the training samples include: meteorological data of power grid equipment and its corresponding actual rainfall level; input the number of training samples into the current rainfall level prediction model and calculate the error; in the case of reaching the preset number of iterations or error convergence, determine the target weight and target bias according to the current particle position; otherwise, update the particle velocity and particle position, and use the updated particle velocity and updated particle position as the current particle velocity and current particle position when performing the iterative optimization operation next time.

[0079] For step S22, through an iterative optimization loop process, adjust the weights and biases of the rainfall level prediction model so that the prediction result of the rainfall level prediction model is as close as possible to the actual situation until a specific termination condition is met, that is, reaching the preset number of iterations or error convergence. In each iteration, according to the current particle position, that is, the current weight and bias values, construct the neural network structure of the rainfall level prediction model.

[0080] Next, obtain a number of training samples, which need to include the meteorological data of power grid equipment and its corresponding actual rainfall level. In this embodiment, the construction process of the training samples strictly follows the standards of the meteorological bureau, and the daily rainfall is accurately divided into seven categories, specifically including: no rain, light rain, moderate rain, heavy rain, rainstorm, heavy rainstorm, and extreme heavy rainstorm. This classification method can not only reflect the meteorological characteristics of different intensity rainfall in detail, but also provide a clear target variable for the subsequent rainfall prediction model. In addition, in order to ensure the comprehensiveness and timeliness of the data, this embodiment selects the meteorological data from 1990 to 2023 as training samples. This time span covers multiple climate cycles, which helps to improve the generalization ability and prediction accuracy of the rainfall level prediction model. At the same time, the rainfall data in 2024 is separately reserved as a validation set to evaluate the performance of the model on unseen data, so as to verify its prediction ability and stability.

[0081] Then, for each particle, use its position as input to calculate the fitness value of the current particle position through the current rainfall level prediction model. Preferably, input a number of training samples into the current rainfall level prediction model and calculate the error, including:

[0082] Input a number of training samples into the current rainfall level prediction model so that the current rainfall level prediction model outputs a predicted rainfall level according to the meteorological data in the training samples;

[0083] According to the predicted rainfall level and its corresponding actual rainfall level, calculate the mean square error value and use the mean square error value as the error.

[0084] Specifically, for each training sample, the current rainfall level prediction model will output the predicted rainfall level based on the input meteorological data, calculate the difference between the predicted rainfall level and the actual rainfall level, calculate the mean of the differences of all training samples to obtain the mean squared error (MSE), and this MSE value is the fitness value of the current particle position. The specific calculation formula is as follows:

[0085]

[0086] Among them, MSE represents the error of the current rainfall level prediction model, that is, the fitness value of the current rainfall level prediction model. N represents the number of training samples, Y i represents the predicted rainfall level of the i-th training sample, and represents the actual rainfall level of the i-th training sample.

[0087] Next, it is judged whether the iterative optimization process of the particle swarm optimization algorithm (PSO) stops. Specifically, it is judged whether the preset number of iterations is reached and whether the error has converged. Reaching the preset number of iterations means that the algorithm has executed the preset number of iterations to search for the optimal solution. Even if the global optimal solution has not been found at this time, it may need to stop due to limited computing resources or time urgency; error convergence means that the error has not changed significantly in several consecutive iterations. At this time, the iteration can also be stopped, indicating that the algorithm has found a relatively good solution, and continuing the iteration may not significantly improve the performance of the model.

[0088] When the particle swarm optimization algorithm does not meet the conditions of the preset number of iterations and error convergence, update the particle velocity and particle position, and use the updated particle velocity and updated particle position as the current particle velocity and current particle position when performing the iterative optimization operation next time.

[0089] Preferably, updating the particle velocity and particle position includes:

[0090] For each particle, judge whether the current error is less than the error corresponding to the individual historical optimal position at the previous update moment. If so, use the current particle position corresponding to the current error as the current individual historical optimal position; otherwise, use the individual historical optimal position at the previous update moment as the current individual historical optimal position. Among them, the error corresponding to the individual historical optimal position at the previous update moment at the initial time is infinite;

[0091] Select the particle with the smallest error from all particles, and determine whether the error corresponding to the particle with the smallest error is less than the error corresponding to the global historical best position at the previous update moment. If so, take the current particle position corresponding to the particle with the smallest error as the current global historical best position; otherwise, take the global historical best position at the previous update moment as the current global historical best position. Among them, the error corresponding to the global historical best position at the previous update moment at the initial time is infinite.

[0092] Update the particle velocity and particle position according to the current particle position, current particle velocity, current individual historical best position, and current global historical best position to obtain the updated particle velocity and updated particle position.

[0093] Specifically, for each particle in the particle swarm, first compare its current error with the error corresponding to the individual historical best position at the previous update moment (i.e., the previous iteration). If the current error is less than the individual historical best error, mark the current particle position as the new individual historical best position and update the corresponding error value; otherwise, keep the individual historical best position at the previous update moment unchanged. It should be noted that in the initialization stage, the errors corresponding to the individual historical best positions of all particles are usually set to infinite to ensure that the current position is always selected as the individual historical best position in the first comparison.

[0094] Select the particle with the smallest error from all particles, that is, the current global best particle. Compare the error of this particle with the error corresponding to the global historical best position at the previous update moment. If the error of the current global best particle is less than the global historical best error, mark the position of the current global best particle as the new global historical best position and update the corresponding error value; otherwise, keep the global historical best position at the previous update moment unchanged. Similarly, in the initialization stage, the error corresponding to the global historical best position is also set to infinite.

[0095] Update the velocity and position of the particle through the following update formula according to the current particle position, particle velocity, individual historical best position, and global historical best position:

[0096]

[0097] Among them, represents the updated particle velocity of the i-th particle, ω represents the inertia weight, which is used to control the influence degree of the current velocity of the particle on the subsequent velocity, represents the current particle position of the i-th particle, c 1 and c 2 represent the learning factors, which represent the weights of the particle learning from the individual historical best position and the global historical best position respectively, r1 and r 2 represents a random number uniformly distributed in the interval [0, 1], which is used to increase the randomness of the search. represents the current individual historical best position of the i-th particle, and gbest represents the current global historical best position. represents the updated particle position of the i-th particle. represents the current particle position of the i-th particle.

[0098] Finally, the updated particle velocity and the updated particle position are used as the current particle velocity and the current particle position when performing the iterative optimization operation next time, and the next iteration loop is carried out.

[0099] It should be noted that the learning factors c 1 and c 2 , and the inertia weight ω need to satisfy the following conditions:

[0100] 0 < ω < 1

[0101] 2(c 1 + c 2 ) - 1 ≥ 0

[0102] The condition of the inertia weight ensures that the value of the inertia weight ω is within a reasonable range. The condition of the learning factor ensures that the values of the learning factors c 1 and c 2 can make the weighted sum in the velocity update formula non-negative, avoiding the reduction of the search efficiency caused by negative weighting.

[0103] It should be noted that in this embodiment, the learning factors c 1 and c 2 , and the inertia weight ω can be dynamically adjusted through an external linear decreasing experiment. Specific examples of external experiments are as follows: the initial value of the inertia weight ω can be set to 0.8 and gradually decreased to 0.4 as the number of iterations increases; c 1 can be linearly decreased from 3.5 to 0.5, while c 2 can be linearly increased from 0.5 to 3.5 to ensure that c 1 + c 2 = 4. By systematically determining different parameter combinations through experiments, putting them into the rainfall level prediction model for iteration, recording the performance index, i.e., the best fitness value, when the fitness value reaches the convergence state, the parameter combinations of the learning factors c 1 and c 2 , and the inertia weight ω reach the optimum.

[0104] When the particle swarm optimization algorithm meets any one of the preset iteration times or error convergence conditions, determine the target weight and target bias according to the current particle position. Preferably, determining the target weight and target bias according to the current particle position includes:

[0105] Determine the current global historical optimal position according to the current particle position;

[0106] Take the weight and bias corresponding to the current global historical optimal position as the target weight and target bias.

[0107] Specifically, when the particle swarm optimization algorithm runs to a certain iteration optimization and meets any one of the preset iteration times or error convergence conditions, the algorithm will stop iterating. At this time, calculate the corresponding error through the current particle position, and determine the current global historical optimal position by comparing these errors, that is, the position of the particle with the smallest error. After determining the global historical optimal position, directly take the weight and bias corresponding to this position as the final target weight and target bias.

[0108] In the confirmation process of the rainfall level prediction model of the present invention, the global search feature of the particle swarm algorithm is used to find the particle position with the smallest fitness value, that is, the weight and bias combination with the smallest mean square error, which means that the prediction result of the model is closest to the actual observation result. When the rainfall level prediction model adopts this set of optimal weights and biases, it can better capture the complexity and diversity in rainfall characteristics. For example, in the scenario of sudden heavy rainfall in mountainous areas or continuous rainfall of typhoons in tropical regions, it can maintain high classification performance. Compared with the hyperparameter optimization of traditional rainfall prediction models mainly relying on manual or simple algorithms, it is difficult to quickly adapt to different scenarios and environments. The present invention realizes the optimization of the network structure and parameters through the optimization strategy of combining PSO and BP. At the same time, the reasonable setting of the inertia weight and acceleration constant balances the influence of individual experience and group experience on the adjustment of particle velocity, thereby improving the convergence speed and prediction accuracy of the model.

[0109] Step S23: Determine the final rainfall level prediction model according to the target weight and target bias.

[0110] For step S23, after obtaining the target weight and target bias through step S23, assign the target weight and target bias to the weight and bias parameters of the neural network model respectively, so as to obtain the final rainfall level prediction model.

[0111] When building a model, the ultimate goal is to enable the model to perform well on new and unknown data. This requires the model to not only have a high accuracy rate on the training set, but also maintain this accuracy rate in the test set and actual applications. This ability is called the generalization ability of the model. To accurately evaluate the generalization ability of the model, the ten-fold cross-validation method is adopted, which is an effective technique to reduce evaluation bias and variance and can provide a more reliable estimate of the model performance.

[0112] Preferably, after determining the final rainfall level prediction model, it further includes:

[0113] Obtain test data and divide the test data into several groups of test subsets; the test data includes: meteorological data of several power grid devices and their corresponding actual rainfall levels;

[0114] Select a group of test subsets from the test data and use the remaining test subsets as the training set;

[0115] Repeat the cross-validation operation until the preset number of validation times is reached, and obtain the validation error of each cross-validation operation;

[0116] Calculate the mean of the validation errors of each cross-validation operation to obtain the average validation error of the rainfall level prediction model;

[0117] Determine the performance evaluation result of the rainfall level prediction model according to the average validation error and the preset evaluation threshold;

[0118] The cross-validation operation includes:

[0119] Input the current training set into the final rainfall level prediction model, so that the final rainfall level prediction model is trained with the meteorological data in the current training set as the input and the corresponding actual rainfall level in the current training set as the output until the error converges, and obtain the cross-validation model;

[0120] Input the current test subset into the cross-validation model, so that the cross-validation model generates the corresponding predicted rainfall level according to the meteorological data in the current test subset;

[0121] Calculate the validation error according to the predicted rainfall level and the corresponding actual rainfall level in the current test subset;

[0122] Accumulate the number of cross-validation times and determine whether the number of cross-validation times reaches the preset number of validation times. If so, output the validation error of each cross-validation operation. Otherwise, sequentially select the next group of test subsets from the test data as the current test subset for the next cross-validation operation, and use the remaining test subsets as the current training set for the next cross-validation operation.

[0123] Specifically, ten-fold cross-validation works by splitting the test data into ten equally-sized test subsets. In each validation, a single test subset is selected as the test set, and the remaining nine test subsets are used as the training set. This process is repeated ten times, with each test subset having a chance to be the test set once. The final model performance is evaluated by the average of the results of these ten runs.

[0124] In this embodiment, through ten-fold cross-validation, the validation errors of ten validations are obtained, which reflect the performance of the model under different partitions of the training set and test subsets. Calculate the mean of these ten validation errors to obtain the average validation error. The average validation error provides a comprehensive metric for measuring the model's ability to predict new data as a whole. Compare the calculated average validation error with a preset evaluation threshold, which is set in advance based on actual requirements and model performance expectations. If the average validation error is lower than the evaluation threshold, it indicates that the model's performance meets the expected standard and can be used for actual prediction tasks; if the average validation error is higher than the evaluation threshold, it indicates that the model's performance is poor and further optimization may be required, such as adjusting the model structure, increasing training data, or improving features.

[0125] In addition, by observing the performance differences among different folds, the generalization ability of the model can be evaluated. If the performance differences among the folds are large, it indicates that the model has a strong dependence on the training data and poor generalization ability; if the performance is relatively stable across the folds, it indicates that the model can maintain good prediction performance under different dataset partitions and has strong generalization ability.

[0126] By analyzing the results of ten-fold cross-validation, the performance of different model configurations or parameter settings can be compared, and the configuration that optimizes the model performance can be selected. This process helps to find the model structure and parameters that are most suitable for solving a specific problem. Moreover, ten-fold cross-validation enables it to identify whether the model is overfitting the training data or underfitting and unable to capture patterns in the data. By observing the performance differences among different folds, the model complexity can be adjusted to achieve better generalization.

[0127] As Figure 3 shown, based on the above method item embodiment, a corresponding device item embodiment is provided;

[0128] An embodiment of the present invention provides a rainfall level prediction device, including: a meteorological data acquisition module and a rainfall level prediction module;

[0129] The meteorological data acquisition module is used to acquire the meteorological data of the power grid equipment to be predicted; the meteorological data includes: temperature parameters, humidity parameters, wind speed parameters, wind direction parameters, and sunshine parameters;

[0130] A rainfall level prediction module, which is used to input meteorological data into a preset rainfall level prediction model, so that the rainfall level prediction model generates the rainfall level of power grid equipment according to the meteorological data;

[0131] Among them, the rainfall level prediction module includes: a particle initialization sub-module, an iterative optimization sub-module, and a prediction model determination sub-module;

[0132] The particle initialization sub-module is used to initialize the particle velocity and particle position; the particle position is used to represent the weights and biases of the rainfall level prediction model;

[0133] The iterative optimization sub-module is used to repeatedly execute the iterative optimization operation until the preset number of iterations is reached or the error converges, and obtain the target weights and target biases; the iterative optimization operation includes: determining the current rainfall level prediction model according to the current particle position; among them, the particle velocity and particle position for the first execution of the iterative optimization operation are the initialized particle velocity and particle position; obtaining a number of training samples; the training samples include: the meteorological data of the power grid equipment and its corresponding actual rainfall level; inputting the number of training samples into the current rainfall level prediction model, and calculating the error; in the case where the preset number of iterations is reached or the error converges, determining the target weights and target biases according to the current particle position; otherwise, updating the particle velocity and particle position, and using the updated particle velocity and updated particle position as the current particle velocity and current particle position when the iterative optimization operation is executed next time;

[0134] The prediction model determination sub-module is used to determine the final rainfall level prediction model according to the target weights and target biases.

[0135] As Figure 4 shown, on the basis of the above method item embodiment, another corresponding device item embodiment is provided;

[0136] In a preferred embodiment, the rainfall amount level prediction device further includes: a preprocessing module;

[0137] The preprocessing module is used to perform outlier detection and normalization processing on the meteorological data of the power grid equipment to be predicted, and obtain the preprocessed meteorological data.

[0138] It can be understood that the above device item embodiment corresponds to the method item embodiment of the present invention, and it can implement the rainfall amount level prediction method provided by any one of the above method item embodiments of the present invention.

[0139] It should be noted that the device embodiments described above are merely illustrative. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. In addition, in the attached drawings of the device embodiments provided by the present invention, the connection relationships between modules indicate that they have communication connections, which can be specifically implemented as one or more communication buses or signal lines. Those of ordinary skill in the art can understand and implement this without creative efforts.

[0140] Based on the embodiments of the above rainfall level prediction method, another embodiment of the present invention provides a terminal device, which includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, the rainfall level prediction method of any embodiment of the present invention is implemented.

[0141] Exemplarily, in this embodiment, the computer program can be divided into one or more modules. The one or more modules are stored in the memory and executed by the processor to complete the present invention. The one or more module elements can be a series of computer program instruction segments capable of performing specific functions, and these instruction segments are used to describe the execution process of the computer program in the terminal device.

[0142] The terminal device can be a computing device such as a desktop computer, a notebook, a palm computer, and a cloud server. The terminal device may include, but is not limited to, a processor and a memory.

[0143] The so-called processor may be a central processing unit (CPU), or may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The processor is the control center of the terminal device, and connects various parts of the entire terminal device through various interfaces and lines.

[0144] Based on the above method embodiment, another embodiment is provided: A computer-readable storage medium provided by another embodiment of the present invention includes a stored computer program, wherein when the computer program runs, it controls the device where the computer-readable storage medium is located to execute the rainfall level prediction method described in any one of the above method embodiments of the present invention.

[0145] Among them, the modules / units integrated in the rainfall level prediction device / terminal device, if implemented in the form of software functional units and sold or used as independent products, can be stored in a computer-readable storage medium. Based on such an understanding, to implement all or part of the processes in the above embodiment methods of the present invention, it can also be completed by instructing relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, the steps of the above various method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in the form of source code, object code, executable file or some intermediate form, etc. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disc, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal, and software distribution medium, etc.

[0146] The above is the preferred implementation manner of the present invention. It should be noted that for those of ordinary skill in the art in this technical field, without departing from the principle of the present invention, several improvements and refinements can still be made, and these improvements and refinements are also regarded as the protection scope of the present invention.

Claims

1. A rainfall level prediction method, characterized in that: include: Obtain meteorological data of power grid equipment to be predicted; The meteorological data include: temperature parameters, humidity parameters, wind speed parameters, wind direction parameters and sunshine parameters; Inputting the meteorological data into a preset rainfall level prediction model so that the rainfall level prediction model generates a rainfall level for power grid equipment according to the meteorological data; The rainfall level prediction model is determined in the following way: Initializing particle velocity and particle position; the particle position is used to characterize the weight and bias of the rainfall level prediction model; Repeat the iterative optimization operation until the preset number of iterations is reached or the error converges, and obtain the target weight and target bias; According to the target bias of the target weight, the final rainfall level prediction model is determined; The iterative optimization operation includes: determining the current rainfall level prediction model according to the current particle position; wherein the particle speed and particle position of the first iterative optimization operation are the initialized particle speed and particle position; Acquire a number of training samples; the training samples include: meteorological data of power grid equipment and its corresponding actual rainfall level; input the number of training samples into the current rainfall level prediction model to calculate the error; when the preset number of iterations is reached or the error converges, determine the target weight and the target bias according to the current particle position; otherwise, update the particle speed and the particle position, and use the updated particle speed and the updated particle position as the current particle speed and the current particle position when performing the next iterative optimization operation.

2. The rainfall level prediction method according to claim 1, characterized in that: Input several training samples into the current rainfall level prediction model and calculate the error, including: Inputting a number of training samples into the current rainfall level prediction model so that the current rainfall level prediction model outputs a predicted rainfall level based on the meteorological data in the training samples; A mean square error value is calculated according to the predicted rainfall level and its corresponding actual rainfall level, and the mean square error value is used as the error.

3. The rainfall level prediction method according to claim 1, characterized in that: Update particle velocity and particle position, including: For each particle, determine whether the current error is less than the error corresponding to the individual historical optimal position at the last update time. If so, take the current particle position corresponding to the current error as the current individual historical optimal position. Otherwise, take the individual historical optimal position at the last update time as the current individual historical optimal position. The error corresponding to the individual historical optimal position at the last update time at the initial time is infinite. Select the particle with the smallest error from all particles, and determine whether the error corresponding to the particle with the smallest error is less than the error corresponding to the global historical optimal position at the last update time. If so, take the current particle position corresponding to the particle with the smallest error as the current global historical optimal position. Otherwise, take the global historical optimal position at the last update time as the current global historical optimal position. The error corresponding to the global historical optimal position at the last update time at the initial time is infinite. According to the current particle position, the current particle speed, the current individual historical optimal position and the current global historical optimal position, the particle speed and the particle position are updated to obtain an updated particle speed and an updated particle position.

4. The rainfall level prediction method according to claim 3, characterized in that: According to the current particle position, the target weight and target bias are determined, including: According to the current particle position, determine the current global historical optimal position; The weight and bias corresponding to the current global historical optimal position are used as the target weight and target bias.

5. The rainfall level prediction method according to claim 1, characterized in that: Before inputting the meteorological data into a preset rainfall level prediction model, the method further includes: The meteorological data of the power grid equipment to be predicted is subjected to outlier detection and normalization processing to obtain preprocessed meteorological data.

6. The method for predicting rainfall levels according to claim 1, characterized in that: After the final rainfall level prediction model is determined, it also includes: Acquire test data and divide the test data into several test subsets; the test data includes: meteorological data of several power grid devices and their corresponding actual rainfall levels; Select a test subset from the test data and use the remaining test subset as the training set; Repeat the cross-validation operation until the preset number of validations is reached, and obtain the validation error of each cross-validation operation; Calculate the mean of the validation errors of each cross-validation operation to obtain the average validation error of the rainfall level prediction model; Determining a performance evaluation result of the rainfall level prediction model according to the average verification error and a preset evaluation threshold; The cross validation operation comprises: Input the current training set into the final rainfall level prediction model, so that the final rainfall level prediction model uses the meteorological data in the current training set as input and the actual rainfall level corresponding to the current training set as output for training until the error converges to obtain a cross-validation model; Inputting the current test subset into the cross-validation model so that the cross-validation model generates a corresponding predicted rainfall level according to the meteorological data in the current test subset; The verification error is calculated based on the corresponding predicted rainfall level and the corresponding actual rainfall level in the current test subset; The number of cross-validation times is accumulated, and it is determined whether the number of cross-validation times reaches the preset number of validation times. If so, the validation error of each cross-validation operation is output; otherwise, the next set of test subsets is selected from the test data in sequence as the current test subset for the next cross-validation operation, and the remaining test subsets are used as the current training set for the next cross-validation operation.

7. A rainfall level prediction device, characterized in that: include: Meteorological data acquisition module and rainfall level prediction module; The meteorological data acquisition module is used to acquire meteorological data of the power grid equipment to be predicted; the meteorological data includes: temperature parameters, humidity parameters, wind speed parameters, wind direction parameters and sunshine parameters; The rainfall level prediction module is used to input the meteorological data into a preset rainfall level prediction model so that the rainfall level prediction model generates the rainfall level of the power grid equipment according to the meteorological data; Wherein, the rainfall level prediction module includes: a particle initialization submodule, an iterative optimization submodule and a prediction model determination submodule; The particle initialization submodule is used to initialize particle velocity and particle position; the particle position is used to characterize the weight and bias of the rainfall level prediction model; The iterative optimization submodule is used to repeatedly perform iterative optimization operations until a preset number of iterations is reached or the error converges, and a target weight and a target bias are obtained; the iterative optimization operation includes: determining a current rainfall level prediction model according to a current particle position; wherein the particle speed and particle position of the first iterative optimization operation are initialized particle speed and particle position; obtaining a number of training samples; the training samples include: meteorological data of power grid equipment and its corresponding actual rainfall level; inputting a number of training samples into the current rainfall level prediction model to calculate the error; when a preset number of iterations is reached or the error converges, determining a target weight and a target bias according to the current particle position; otherwise, updating the particle speed and particle position, and using the updated particle speed and updated particle position as the current particle speed and current particle position when the iterative optimization operation is performed next time; The prediction model determination submodule is used to determine the final rainfall level prediction model according to the target bias of the target weight.

8. The rainfall level prediction device according to claim 7, characterized in that: Also includes: Preprocessing module; The preprocessing module is used to perform abnormal value detection and normalization processing on the meteorological data of the power grid equipment to be predicted, so as to obtain preprocessed meteorological data.

9. A terminal device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, the rainfall level prediction method according to any one of claims 1 to 6 is implemented.

10. A computer-readable storage medium, characterized in that: include: A stored computer program, wherein when the computer program is executed, the device where the computer-readable storage medium is located is controlled to execute the rainfall level prediction method as described in any one of claims 1 to 6.