Air temperature forecasting model construction method based on machine learning
By using a machine learning-based temperature forecasting model, the problem of cumbersome temperature forecasting and reliance on manual correction in existing technologies has been solved. This has enabled the automation and intelligence of temperature forecasting, improved forecast accuracy, and provided more precise products for meteorological services.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-29
- Publication Date
- 2026-03-27
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing weather forecasting centers have achieved a high level of reliability in situation forecasting, but the element errors in numerical forecasts still need to be corrected by forecasters' experience. Temperature forecasts are cumbersome and have an upper limit to their effectiveness, while manual daily forecasts are inefficient.
A machine learning-based temperature forecasting model was adopted. By collecting and preprocessing 3-hour high and low temperature data and precipitation data from 78 stations in Hubei Province, the model was trained using the CatBoost model. The results were output and the model was optimized. The model was then applied to the smart grid business platform for 24-hour, 48-hour, and 72-hour temperature forecasts.
It has enabled the automation and intelligentization of temperature forecasting, improved forecast accuracy, reduced human intervention, provided more accurate temperature forecast products, and promoted the professional development of meteorological services.
Smart Images

Figure CN121744822A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application relates to the technical field of air temperature prediction, in particular to an air temperature prediction model construction method based on machine learning. BACKGROUND
[0002] The underlying surface of Hubei is complex, the terrain is high in the west and low in the east, and the basin is incomplete and opens slightly to the south, the urbanization degrees of different regions are quite different, and meteorological stations are located in different geomorphic environments. These characteristics result in significant differences in the spatial distribution of meteorological elements in different regions. For example, the urban area usually has a heat island effect, the temperature is higher and the diurnal temperature difference is smaller; the temperature also has a large difference on the shady side and the sunny side even if the altitude and latitude difference is small due to different sunshine; the valley station is often the location of the regional high temperature peak due to poor heat exchange; the temperature change is relatively gentle in the high vegetation coverage area and the station near the water body due to the evapotranspiration and heat capacity of the water body, and accurate high and low temperature prediction is helpful for preventing agricultural heat damage and low temperature frost damage caused by extreme high and low temperature, and has a great guiding role for energy supply management and public health warning.
[0003] The European Centre for Medium-Range Weather Forecasts, which represents the highest level of global numerical models, is increasingly progressing in situation prediction, reaching a high level of accuracy, and the correctability of the objective prediction by forecasters is small, but the element error of numerical prediction still needs to be corrected combined with the experience of forecasters. Temperature prediction, as a conventional element prediction, is one of the most important prediction scoring items at present, and is an important indicator for measuring the intelligent level of fine prediction of meteorological stations across the country. Artificial daily temperature prediction is tedious and has an upper limit of effect, and should transfer the main efforts to key, turning point and disastrous weather prediction, so temperature prediction is also the first breakthrough of intelligent method, and therefore an air temperature prediction model construction method based on machine learning is provided to solve the above problems. SUMMARY
[0004] (I) Technical problems to be solved In view of the shortcomings of the prior art, the application provides an air temperature prediction model construction method based on machine learning, which has the advantages of high intelligent degree and less manual intervention, and solves the problems that the existing weather prediction center is increasingly progressing in situation prediction, reaching a very high level of usability, the operation space of the forecasters in correcting the situation prediction is small, but the element error of numerical prediction still needs to be corrected combined with the experience of forecasters, and the artificial daily temperature prediction is tedious and has an upper limit of effect.
[0005] (II) Technical scheme In order to realize the high intelligence of the model and reduce the manual intervention as much as possible, the application provides the following technical scheme: an air temperature prediction model construction method based on machine learning, comprising the following steps: Step 1: Sample data collection, which includes real-time data, i.e., high and low temperatures and precipitation at 78 stations across the province every 3 hours, as well as EC high-resolution model analysis and forecast data; Step 2: Preprocess the data, clean the raw data to ensure data quality, and generate a sample set. Randomly divide the sample set, with 80% used for modeling experiments (training set) and 20% used for effect evaluation (test set). Step 3: Build a station-by-station 3-hour temperature forecast model (CatBoost) using machine learning methods. Step 4: Input the training set data from Step 3 into the temperature forecast model, and extract the features of the training set data, including station, temperature, humidity, wind speed, and geopotential. Step 5: Output the results and evaluate the temperature forecast model based on the output results; Step Six: Optimize the temperature forecast model by inputting the test set or new data into the temperature forecast model and calculating the mean absolute error (MAE); Step 7: Apply the trained model to the intelligent grid business platform for model operationalization, enabling the model to provide 24h, 48h, and 72h hourly objective high and low temperature forecasts for 78 national scoring stations and key regional stations. The forecasts will be provided in the form of reports and MICAPS3 format data. A report on the forecast model's seasonal forecast performance and operationalization verification in Hubei Province will be provided, including assessment indicators such as the accuracy rate of high and low temperature forecasts ≤1℃ and ≤2℃, mean absolute error, and root mean square error.
[0006] Preferably, in step one, the CSV file used contains observation data from multiple meteorological stations and data output from the EC model, and bilinear interpolation is used to interpolate the model data to the stations.
[0007] Preferably, the sample data specifically includes temperature-related data, such as 3-hour high and low temperatures Tmax and Tmin; Temperatures at different pressure levels (1000 hPa to 500 hPa) (t-1000 to t-500). Wind speed related data (such as the zonal wind speed component 10u and the meridional wind speed component 10v at a height of 10 meters, as well as the zonal and meridional wind speed components u-925, v-925, etc. of each pressure layer). Humidity-related data (relative humidity of each pressure layer, r-1000 to r-100). Geological height data (geological height of the 500hPa pressure layer gh-500); Other variables (sea level pressure MSL-999, temperature at 2 meters altitude 2t-999, station number sta, specific time time).
[0008] Preferably, in step two, the data processing includes the following steps: Step 1: Remove duplicate data. Use the `drop_duplicates` method to remove duplicate rows from the data and print the change in the number of rows after deletion; Step 2: Extract month and hour information, convert the `datetime` column to date and time format, and extract the month (`month`) and hour (`hour`) as new feature columns, displaying the first few rows of data after conversion; Step 3: Filter out abnormal Tmin values, initially retaining data with Tmin values in the range of [-50, 50], and removing outliers that are outside the range; Step 4: Filter the difference between Tmin and 2t-999, retaining data where the difference between Tmin and 2t-999 is within the range of [-20, 20], and further remove data with outlier differences; Step 5: Use the `describe` method again to obtain basic statistical information from the filtered data to confirm the effectiveness of the data cleaning.
[0009] Preferably, in step six, in order to improve the performance of the CatBoost model, Hyperopt is used for hyperparameter optimization. The hyperparameter search space is defined, including learning rate, tree depth, number of leaf samples, sampling ratio, regularization parameter, etc. At the same time, `grow_policy` is fixed as `SymmetricTree`. By setting a reasonable search space, the efficiency and effectiveness of the optimization process are ensured.
[0010] Preferably, the temperature forecast model defines an objective function `objective` to evaluate the model performance for each combination of hyperparameters.
[0011] Preferably, in step six, Hyperopt's TPE algorithm is optimized step by step using a loop structure until a preset maximum number of evaluations (e.g., 50) is reached. In each loop, the `fmin` function is called to evaluate the parameters once, and the result is saved to the Trials object, until the optimization is completed after 50 loops. This optimization process can take several days. If the program terminates unexpectedly after a long period of time, the optimization process can continue from the breakpoint based on historical experiments.
[0012] Preferably, the algorithm of the temperature forecast model may include XGBoost, LightGBM, and GBDT in addition to CatBoost.
[0013] Preferably, the temperature forecast model uses empirical methods and genetic algorithms to optimize hyperparameters, and 5-fold cross-validation is used on the training set during parameter tuning to avoid overfitting.
[0014] (III) Beneficial Effects Compared with existing technologies, this invention provides a method for constructing a temperature forecast model based on machine learning, which has the following beneficial effects: 1. This method for constructing a temperature forecast model based on machine learning involves deploying a temperature forecast system based on machine learning methods, selecting an optimized machine learning model for daily forecasting applications, and using EC high-resolution model forecast data within 240 hours as input. The forecasts for each station are performed 3-hour intervals from 0 to 72 hours, and the extreme values of high and low temperatures within 24 hours are then taken as the high and low temperature forecasts. During the forecast period, the forecast conclusions are regularly transmitted to the intelligent grid business platform in MICAPS format as data and visualization results for forecasters to use. As time progresses, new data samples are added, dynamically updating the forecast model to automate model data expansion and updates. The product is tested in the intelligent grid forecast business platform of Hubei Provincial Meteorological Observatory, and continuously optimized and improved based on the test results.
[0015] 2. The method of building temperature forecast models based on machine learning is conducive to improving temperature forecasting capabilities and promoting the improvement of automated, objective and intelligent forecasting levels. It will also bring significant departmental and social benefits. While improving the accuracy of weather forecasts, it can enhance the image of departments with advanced forecasting technology.
[0016] 3. The machine learning-based temperature forecast model construction method will provide more accurate temperature forecast products, provide guidance for the development of professional meteorological services such as power dispatching, agricultural production, transportation and tourism, and contribute to improving the quality and efficiency of social and economic development.
[0017] 4. The method for constructing a temperature forecast model based on machine learning is an initial exploration of intelligent forecasting technology, providing ideas for intelligent forecasting of meteorological elements such as precipitation, wind, and relative humidity. Attached Figure Description
[0018] Figure 1 This is a schematic diagram of the machine learning-based temperature forecasting model construction method of the present invention; Figure 2 A schematic diagram for the comprehensive 24-hour minimum temperature test and evaluation of Hubei Province National Station (82) from January 1, 2024 to December 31, 2024; Figure 3 This is a flowchart illustrating the workflow of the machine learning-based temperature forecasting model of this invention. Figure 4 This is a scatter plot of the predicted-actual values from the present invention. Figure 5 This is a spatial error distribution diagram of the present invention; Figure 6 This is the histogram of the prediction error of this invention. Detailed Implementation
[0019] The technical solutions described below, with reference to the accompanying drawings of the embodiments of the present invention, will be clearly and completely described. However, the described embodiments are merely a part of the present invention, and not all of it. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0020] Please see Figures 1-6 A method for constructing a temperature forecast model based on machine learning includes the following steps: Step 1: Sample data collection, which includes real-time data, i.e., high and low temperatures and precipitation at 78 stations across the province every 3 hours, as well as EC high-resolution model analysis and forecast data; Step 2: Preprocess the data, clean the raw data to ensure data quality, and generate a sample set. Randomly divide the sample set, with 80% used for modeling experiments (training set) and 20% used for effect evaluation (test set). Specifically, the first 80% of the samples are used to train the model, and the last 20% are used to validate the model's performance. It is important to emphasize that this partitioning method is particularly important for time series data because it can simulate the model's performance on completely independent future data. If random partitioning were used, the data might not be able to effectively distinguish the influence of the same weather system or the same weather process.
[0021] Step 3: Use machine learning methods to build a 3-hour temperature forecast model for each station (CatBoost). Step 4: Input the training set data from Step 3 into the temperature forecast model and extract the features of the training set, including station, temperature, humidity, wind speed, and geopotential. Specifically, feature selection methods include correlation analysis, model-based selection, and dimensionality reduction methods. Correlation analysis calculates the correlation coefficients between each feature and the target variable (high and low temperatures) to select features with high correlation. Model-based selection uses tree models (such as random forests and XGBoost) to evaluate the importance of features and select important features. Dimensionality reduction methods, such as principal component analysis (PCA), reduce feature dimensionality through linear reduction while retaining key information. This project, based on expert experience and considering computational complexity, retained all of the above features. Furthermore, regularization parameters can be used in the model to control the influence of coefficients of certain features, indirectly achieving feature selection; secondary modeling can also be performed based on the final feature importance ranking.
[0022] Taking into account computational complexity, all the above features are retained. Furthermore, the influence of the coefficients of certain features in the model can be controlled through regularization parameters, thereby indirectly achieving feature selection. Alternatively, secondary modeling can be performed based on the final feature importance ranking.
[0023] Step 5: Output the results and evaluate the temperature forecast model based on the output results; The evaluation includes: 1. Performance evaluation: MAE, RMSE, and coefficient of determination R²; 2. Interpretability analysis: SHAP, feature influence direction, and interaction analysis.
[0024] Step Six: Optimize the temperature forecast model by inputting the test set or new data into the temperature forecast model and calculating the mean absolute error (MAE); Step 7: Apply the trained model to the intelligent grid business platform for model operationalization, enabling the model to provide 24h, 48h, and 72h hourly objective high and low temperature forecasts for 78 national scoring stations and key regional stations. The forecasts will be provided in the form of reports and MICAPS3 format data. A report on the forecast model's seasonal forecast performance and operationalization verification in Hubei Province will be provided, including assessment indicators such as the accuracy rate of high and low temperature forecasts ≤1℃ and ≤2℃, mean absolute error, and root mean square error.
[0025] exist Figure 1 In step one, the CSV file used contains observation data from multiple weather stations and data output from the EC model. Bilinear interpolation is used to interpolate the model data to the stations and sample data, specifically including temperature-related data such as 3-hour high and low temperatures Tmax and Tmin. Temperatures at different pressure levels (1000 hPa to 500 hPa) (t-1000 to t-500). Wind speed related data (such as the zonal wind speed component 10u and the meridional wind speed component 10v at a height of 10 meters, as well as the zonal and meridional wind speed components u-925, v-925, etc. of each pressure layer). Humidity-related data (relative humidity of each pressure layer, r-1000 to r-100). Geological height data (geological height of the 500hPa pressure layer gh-500); Other variables (sea level pressure MSL-999, temperature at 2 meters altitude 2t-999, station number sta, specific time time).
[0026] In this embodiment, the data has a temporal resolution of once every 3 hours, the same as the model resolution. The spatial resolution covers multiple meteorological stations with different environmental characteristics, totaling 323. The EC forecast times are 08:00 and 20:00 daily. Using 0-12h can cover any time. This project uses 0-12h forecast data, and when there is missing data, it uses 12-24h to supplement it. The advantage is that the earlier forecast lead time makes the model forecast relatively accurate, and the regression relationship is more stable. In the process of forecast formation, model data from any subsequent time are substituted. If the numerical model develops and improves over time, the model forecast capability will also improve.
[0027] exist Figure 1 In step two, data processing includes the following steps: Step 1: Remove duplicate data. Use the `drop_duplicates` method to remove duplicate rows from the data and print the change in the number of rows after deletion; Step 2: Extract month and hour information, convert the `datetime` column to date and time format, and extract the month (`month`) and hour (`hour`) as new feature columns, displaying the first few rows of data after conversion; Step 3: Filter out abnormal Tmin values, initially retaining data with Tmin values in the range of [-50, 50], and removing outliers that are outside the range; Step 4: Filter the difference between Tmin and 2t-999, retaining data where the difference between Tmin and 2t-999 is within the range of [-20, 20], and further remove data with outlier differences; Step 5: Use the `describe` method again to obtain basic statistical information from the filtered data to confirm the effectiveness of the data cleaning.
[0028] In this embodiment, the above steps preliminarily clean and explore the data, removing duplicate data and outliers, and extracting time-related features, thus providing a high-quality data foundation for subsequent feature engineering and model training. exist Figure 1 In step six, in order to improve the performance of the CatBoost model, Hyperopt was used for hyperparameter optimization. The hyperparameter search space was defined, including learning rate, tree depth, number of leaf samples, sampling ratio, regularization parameter, etc. At the same time, `grow_policy` was fixed as `SymmetricTree`.
[0029] In this embodiment, by setting a reasonable search space, the efficiency of the optimization process is ensured.
[0030] Preferably, the temperature forecast model defines an objective function `objective` to evaluate the model performance for each combination of hyperparameters.
[0031] exist Figure 1 In step six, Hyperopt's TPE algorithm is optimized step by step through a loop structure until the preset maximum number of evaluations (e.g., 50 times) is reached. In each loop, the `fmin` function is called to evaluate the parameters once, and the result is saved to the Trials object. The optimization is completed after 50 loops. This optimization process can take several days. If the program terminates unexpectedly after a long time, the optimization process can continue from the breakpoint based on historical experiments.
[0032] In addition to CatBoost, temperature forecast models can also include XGBoost, LightGBM, and GBDT. Temperature forecast models use empirical methods and genetic algorithms to traverse and optimize hyperparameters. When tuning parameters, 5-fold cross-validation is used on the training set to avoid overfitting.
[0033] The specific steps of model training also include: Divide the training set and validation set To evaluate the model's generalization ability, the dataset was divided into training and validation sets. The first 80% of the samples were used to train the model, and the last 20% were used to validate its performance. It is important to emphasize that this partitioning method is particularly crucial for time series data because it simulates the model's performance on completely independent future data. If a random partition were used, the data might not be able to effectively distinguish the effects of the same weather system or the same weather event.
[0034] Hyperparameter space definition and optimization To improve the performance of the CatBoost model, Hyperopt was used for hyperparameter optimization. A hyperparameter search space was defined, including the learning rate, tree depth, number of leaf samples, sampling ratio, and regularization parameters, while `grow_policy` was fixed to `SymmetricTree`. By setting a reasonable search space, the efficiency and effectiveness of the optimization process were ensured. In the code, `hp.uniform` and `hp.choice` were used to define the continuous and discrete hyperparameter ranges.
[0035] Loading and saving optimization results To avoid redundant calculations, the code implements persistence of optimization results. First, it checks if a previous evaluation result file `evaluation_results.json` exists. If it does, it loads the evaluated parameter set and continues optimizing the unevaluated parameters. Simultaneously, it uses Pickle to load or create new Trials objects to record the Hyperopt optimization process. In this way, optimization results can be accumulated across multiple runs, gradually obtaining the optimal parameter combination.
[0036] Objective function definition The objective function `objective` evaluates the model performance for each hyperparameter combination. The function first checks if the parameters have already been evaluated; if so, it directly returns the previous mean absolute error (MAE) value to avoid redundant calculations. Otherwise, it trains a CatBoost model using the current parameters and calculates the MAE on the validation set. The evaluation results are recorded in `evaluation_results.json`, and the `evaluated_params` dictionary is updated for subsequent deduplication checks.
[0037] Hyperparameter optimization loop The Hyperopt TPE algorithm is optimized incrementally using a loop structure until a preset maximum number of evaluations (e.g., 50) is reached. In each loop, the `fmin` function is called to evaluate the parameters, and the result is saved to a Trials object. This process continues until all 50 iterations are complete. This optimization process can take several days. If the program terminates unexpectedly after a long run, the optimization process can resume from the breakpoint based on historical trials.
[0038] Optimal parameter extraction and saving After completing all evaluations, the best-performing parameter combinations are extracted from the Trials object. The parameter indices are converted to actual values using the `space_eval` function, especially for discrete choice-type hyperparameters. The optimal parameters and their corresponding MAEs are saved to `best_params.json` for later use and analysis. If a newly obtained optimal MAE is better than the previously saved results, the saved best parameters are updated.
[0039] Optimization results: BestHyperparameters: {'bagging_temperature':0.4255153962875685,'colsample_bylevel':0.7177669848810545,'depth':12,'l2_leaf_reg':3,'learning _rate':0.09908268073687558,'min_data_in_leaf':20,'random_strength':0.2015070474744106,'subsample':0.8315458078032517} Model training and validation The CatBoost model was retrained using optimal hyperparameters, and the number of iterations was increased to 100,000 to fully utilize the early stopping strategy (no improvement after 50 iterations) to improve model performance. During training, the mean absolute error (MAE) on the validation set was monitored to ensure model stability and generalization ability. After training, the mean absolute error (MAE) on the validation set was calculated and output as a quantitative metric for the model's prediction accuracy.
[0040] Model saving To ensure model usability in different environments, multiple methods are used to save the trained CatBoost model. First, the built-in `save_model` method of CatBoost is used to save the model as a `best_model.cbm` file. Second, Pickle and Joblib are used to save the model as `best_model.pkl` and `best_model_joblib.pkl` respectively, so that it can be used under different loading requirements. The diversified saving methods improve the flexibility of model deployment.
[0041] The specific steps for model application and evaluation also include: S1 loads the saved model. After training, the model usually needs to be saved for later use. Depending on the saved format, the model can be loaded using different methods. CatBoost models can be loaded based on different save formats (.cbm, .pkl, .joblib.pkl).
[0042] S2 Prediction and Assessment After loading the model, you can use it to make predictions on the validation set or new data and evaluate the model's performance. The attached code demonstrates how to make predictions on the validation set and calculate the mean absolute error (MAE). The result is: Mean Absolute Error (MAE) on the validation set: 0.702.
[0043] like Figure 4The predicted-actual scatter point density, error spatial distribution, and frequency distribution are shown. It can be seen that the predicted values and the actual values are evenly distributed near the ideal line. Except for a few stations in mountainous areas, the average absolute error is less than 1 degree and the maximum is less than 2 degrees. This method is a significant improvement over the original linear regression method. This forecast model is the first objective forecasting method in Hubei Meteorological Bureau that exceeds the level of forecasters.
[0044] S3 Applications in New Data In addition to validation sets, the model can be applied to new, unseen datasets for real-time or batch forecasting, generating meteorological products, gridded products, and forecast reports. Sample code demonstrates how to use the loaded model to forecast new CSV data files and save the results to a new file. In business applications, the model forecasts the minimum and maximum temperatures every 3 hours for the next 240 hours, calculating the minimum for low temperatures and the maximum for high temperatures on a daily basis to obtain high and low temperature forecasts.
[0045] Example 1 The project process includes the following steps: (1) Data acquisition: collect observation data from multiple meteorological stations and EC model output data; (2) Data preprocessing: combining the pattern with the actual data, handling missing values and outliers to ensure data quality; (3) Feature engineering: Selecting and constructing features related to high and low temperatures, and making reasonable feature selection and transformation based on meteorological science and forecasting experience; (4) Model post-processing: Machine learning methods are used to correct the EC model output to improve forecast accuracy; (5) Model evaluation and validation: Evaluate the forecasting performance of the model to ensure its reliability and practicality; (6) Forecasting. Apply the forecast results to actual needs.
[0046] Applications are as follows: Table 1. Accuracy of high temperature forecasts at national weather stations in Hubei Province based on multiple objective methods and numerical models (2024) Table 2. Mean absolute error of high temperature forecasts at national weather stations in Hubei Province based on multiple objective methods and numerical models (2024) Table 3. Accuracy of Low Temperature Forecasts at National Stations in Hubei Province Based on Multiple Objective Methods and Numerical Models (2024) Table 4. Mean absolute error of low temperature forecasts at national weather stations in Hubei Province based on multiple objective methods and numerical models (2024) As can be seen from Table 1-4 above: The long-term forecast performance for Hubei Province from January 1st to December 31st, 2024 was tested. The MLT forecast model outperformed all timeframes. For the 24-hour high-temperature forecast, the accuracy reached 83.2%, significantly higher than the second-ranked CCTV forecast of 76.2% and the third-ranked CMA-MESO forecast of 64.84%; the mean absolute error was 1.19℃, slightly lower than the second-to-last CCTV forecast of 1.52℃, and significantly lower than other model products. For the 24-hour low-temperature forecast, the accuracy reached 90.22%, significantly higher than the second-ranked CCTV forecast of 82.22%, exceeding it by 9.7 percentage points; the mean absolute error was 0.99℃, significantly lower than other model products.
[0047] Regarding the forecast performance of the Hubei Provincial National Station in 2024, the forecast quality of MLT high and low temperatures gradually decreased with the extension of the forecast lead time, but the forecast accuracy within each lead time was still higher than that of other model products. Overall, the MLT temperature forecast quality was very high, significantly better than the forecast products of other models, and the forecast performance of low temperatures was higher than that of high temperatures.
[0048] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0049] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. A method for constructing a temperature forecast model based on machine learning, characterized in that: Includes the following steps: Step 1: Sample data collection, which includes real-time data, i.e., high and low temperatures and precipitation at 78 national meteorological stations in Hubei Province every 3 hours, as well as EC high-resolution model analysis and forecast data; Step 2: Preprocess the data, clean the raw data to ensure data quality, and generate a sample set. Randomly divide the sample set, with 80% used for modeling experiments (training set) and 20% used for effect evaluation (test set). Step 3: Build a 3-hour temperature forecast model for each station using machine learning methods (CatBoost); Step 4: Input the training set data from Step 3 into the temperature forecast model, and extract features from the training set data, including station, temperature, humidity, wind speed, and geopotential. Step 5: Output the results and evaluate the temperature forecast model based on the output results; Step 6: Optimize the temperature forecast model by inputting the test set or new data into the temperature forecast model and calculating the mean absolute error (MAE). Step 7: Apply the trained model to the intelligent grid business platform for model operationalization, enabling the model to provide 24h, 48h, and 72h hourly objective high and low temperature forecasts for 78 national scoring stations and key regional stations. The data provided includes reports, MICAPS, and three other formats. A verification report on the forecast model's seasonal forecast performance and operationalization in Hubei Province is also provided, including assessment indicators such as the accuracy rate of high and low temperature forecasts ≤1℃ and ≤2℃, mean absolute error, and root mean square error.
2. The method for constructing a temperature forecast model based on machine learning according to claim 1, characterized in that: In step one, the CSV file used contains observation data from multiple weather stations and data output from the EC model. Bilinear interpolation is used to interpolate the model data to the stations.
3. The method for constructing a temperature forecast model based on machine learning according to claim 1, characterized in that: The sample data specifically includes temperature-related data, such as 3-hour high and low temperatures Tmin and Tmax; Temperatures (t-1000 to t-500) at different pressure levels (1000 hPa to 500 hPa); Wind speed related data (such as the zonal wind speed component 10u and the meridional wind speed component 10v at a height of 10 meters, as well as the zonal and meridional wind speed components u-925, v-925, etc. of each pressure layer); Humidity-related data (relative humidity of each pressure layer, r-1000 to r-100); Geometric height data (geometric height of the 500 hPa pressure layer gh-500); Other variables (sea level pressure MSL-999, 2-meter temperature 2t-999, station number sta, specific time time).
4. The method for constructing a temperature forecast model based on machine learning according to claim 1, characterized in that: Step two, data processing includes the following steps: Step 1: Remove duplicate data. Use the `drop_duplicates` method to remove duplicate rows from the data and print the change in the number of rows after deletion; Step 2: Extract month and hour information, convert the `datetime` column to date and time format, and extract the month (`month`) and hour (`hour`) as new feature columns, displaying the first few rows of data after conversion; Step 3: Filter out abnormal Tmin values, initially retaining data with Tmin values in the range of [-50, 50], and removing outliers that are outside the range; Step 4: Filter the difference between Tmin and 2t-999, retaining data where the difference between Tmin and 2t-999 is in the range of [-20, 20], to further remove outlier data; Step 5: Use the `describe` method again to obtain basic statistical information from the filtered data to confirm the effectiveness of the data cleaning.
5. The method for constructing a temperature forecast model based on machine learning according to claim 1, characterized in that: In step six, in order to improve the performance of the CatBoost model, Hyperopt was used for hyperparameter optimization. The hyperparameter search space was defined, including learning rate, tree depth, number of leaf samples, sampling ratio, regularization parameter, etc. At the same time, `grow_policy` was fixed as `SymmetricTree`. By setting a reasonable search space, the efficiency and effectiveness of the optimization process were ensured.
6. The method for constructing a temperature forecast model based on machine learning according to claim 1, characterized in that: The temperature forecast model defines an objective function `objective` to evaluate the model performance for each combination of hyperparameters.
7. The method for constructing a temperature forecast model based on machine learning according to claim 1, characterized in that: In step six, Hyperopt's TPE algorithm is optimized incrementally using a loop structure until a preset maximum number of evaluations (e.g., 50) is reached. In each loop, the `fmin` function is called to evaluate the parameters, and the result is saved to the Trials object. This process continues until all 50 iterations are complete. This optimization process can take several days. If the program terminates unexpectedly after a long run, the optimization process can resume from the breakpoint based on historical trials.
8. The method for constructing a temperature forecast model based on machine learning according to claim 1, characterized in that: The temperature forecasting model algorithms include CatBoost, XGBoost, LightGBM, and GBDT.
9. The method for constructing a temperature forecast model based on machine learning according to claim 1, characterized in that: The temperature forecast model uses empirical methods and genetic algorithms to optimize hyperparameters. During parameter tuning, 5-fold cross-validation is used on the training set to avoid overfitting.