Fuel gas amount prediction method and system and storage medium

The prediction model is constructed through the XGBoost machine learning algorithm, combined with multi-source data characteristics, and the problems of low efficiency of traditional gas consumption acquisition and insufficient prediction capabilities are solved, and efficient and accurate gas consumption prediction is achieved to ensure the matching of supply and demand.

CN119272923APending Publication Date: 2025-01-07CHONGQING HEZHONG HUIRAN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411329973.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-24
Publication Date
2025-01-07

AI Technical Summary

Technical Problem

Traditional gas consumption collection methods are inefficient, rely on manual meter reading and can easily lead to data deviations. The existing trend analysis and seasonal adjustment methods are insufficient in the face of sudden events or changes in multiple factors, and cannot accurately match the gas supply and need.

Method used

The prediction model is constructed using XGBoost machine learning algorithm, combining historical gas use data, time characteristics, geographical characteristics and user characteristics, and optimized the model through two-stage training to improve the accuracy and efficiency of gas usage prediction, paying special attention to the prediction of extreme gas use situations.

Benefits of technology

It realizes intelligent prediction of gas usage, improves prediction accuracy and efficiency, and can adjust the supply in a timely manner, avoids supply in short supply or oversupply, and ensures the matching of gas supply and demand.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119272923A_ABST
    Figure CN119272923A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of intelligent gas management, and discloses a gas volume prediction method and system and a storage medium, and the method comprises the following steps: 1, collecting a basic gas data set; the basic gas data set comprises historical gas consumption, and time characteristic data, geographic characteristic data and user characteristic data corresponding to the historical gas consumption; 2, preprocessing the basic gas data set, extracting target features from the basic gas data set, and forming a target data set; step 3, constructing a prediction model; the prediction model is trained by adopting XGBoost, and a final prediction model is obtained through training optimization; moreover, in the training process, first-stage training is carried out based on the target data set; performing two-stage training based on the associated feature data with the historical gas consumption of 0 in the target data set; and 4, predicting the gas volume by adopting the prediction model. According to the method, the gas consumption can be intelligently predicted, and relatively high prediction efficiency and prediction precision can be achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of intelligent gas management technology, and in particular to a gas volume prediction method, system and storage medium. Background Art

[0002] With the acceleration of urbanization and the continuous improvement of residents' living standards, gas is increasingly used as a clean energy in daily life. However, traditional gas consumption collection methods are unable to cope with complex and changing market demands. Traditional gas consumption collection relies on manual household meter reading by meter readers, which is not only inefficient, but also in some cases, meter readers cannot enter the house to read the meter due to the user's absence or other reasons, and can only rely on estimates to fill in the data gaps. This valuation method often lacks scientific basis and relies on the experience and historical data of meter readers or managers to make rough estimates. Although this method is simple and easy to implement, it is easy to cause large deviations, which in turn affects subsequent data analysis and decision-making - for gas users, it will lead to inaccurate billing and economic losses; for gas suppliers, it will lead to inaccurate gas supply planning, resulting in oversupply or undersupply, thereby increasing operating costs.

[0003] There are also gas consumption estimation methods based on trend analysis and seasonal adjustment. Trend analysis is to find patterns through long-term tracking of historical gas consumption to infer future demand changes. This method can capture the trend of gas consumption to a certain extent, but it has weak prediction capabilities for sudden events or non-periodic changes. Seasonal adjustment adds the influence of seasonal factors to trend analysis, taking into account the impact of different seasons on gas demand, such as the phenomenon of increased heating demand in winter and reduced demand in summer. However, this method still has obvious limitations, that is, it is highly dependent on past data and assumes that future trends are consistent with history, ignoring the potential impact of changes in the external environment on gas consumption.

[0004] In summary, although the existing gas consumption estimation method has solved some problems to a certain extent, it still has obvious defects - it is too dependent on historical data of the same period, cannot cope with data mutations, and has estimation / forecasting errors; it also has deficiencies in multi-factor considerations and fails to fully cover all factors affecting gas consumption. Therefore, a new technical means is urgently needed to make up for this deficiency to ensure that gas supply capacity matches demand. Summary of the invention

[0005] The present invention aims to provide a gas volume prediction method, system and storage medium, which can intelligently predict gas consumption and achieve high prediction efficiency and prediction accuracy.

[0006] To achieve the above objectives, the present invention provides the following basic solutions.

[0007] Solution 1 A method for predicting gas volume comprises the following steps: Step 1, collecting a basic gas data set; the basic gas data set includes historical gas usage, as well as time characteristic data, geographical characteristic data and user characteristic data corresponding to the historical gas usage; Step 2: preprocess the basic gas data set, extract target features from it, and form a target data set; Step 3, construct a prediction model; use XGBoost to train the prediction model, and obtain the final prediction model through training optimization; and in the training process, perform a first-stage training based on the target data set; perform a second-stage training based on the associated feature data of the historical gas consumption of 0 in the target data set; Step 4: Use the prediction model to predict the gas volume.

[0008] Solution 2 A gas volume prediction system, used to execute a gas volume prediction method as described in Scheme 1; comprising a collection module, a data processing module, a model building module and a prediction module; The acquisition module is used to acquire a basic gas data set; the basic gas data set includes historical gas usage, and time characteristic data, geographic characteristic data and user characteristic data corresponding to the historical gas usage; The data processing module is used to preprocess the basic gas data set, extract target features from it, and form a target data set; the model building module is used to build a prediction model; the prediction model is trained using XGBoost, and the final prediction model is obtained through training optimization; and in the training process, a first-stage training is performed based on the target data set; a second-stage training is performed based on the associated feature data of the historical gas usage of 0 in the target data set; The prediction module is provided with a final prediction model, and the prediction model is used to predict the gas volume.

[0009] Option 3 A storage medium stores a computer program, and when the computer program is executed by a processor, a gas volume prediction method as described in Scheme 1 is implemented.

[0010] The working principle and advantages of the present invention are: This solution introduces multi-source historical data as the basic gas data set, combines historical gas consumption data and other related features, and uses advanced machine learning algorithms to build a prediction model to accurately predict the user's monthly gas consumption, which can improve the accuracy of the estimate and realize the intelligent prediction of gas consumption; and the prediction model can also be used for gas demand in different regions and different time periods, providing data reference for gas suppliers to adjust the supply in time to avoid the situation of insufficient supply or oversupply. Among them, the construction and training of the prediction model are based on XGBoost. Based on the distributed gradient enhancement characteristics of XGBoost, the training process can be executed quickly, and the model training efficiency is high.

[0011] The key point is that this solution also pays special attention to the practical problems existing in the current gas consumption estimation - the valuation instability problem for extreme gas consumption (such as extremely large or extremely small gas consumption). For model algorithms, general prediction models based on big data are often affected by the distribution of historical data (especially the distribution of conventional gas consumption data, which accounts for a larger proportion), resulting in large prediction values ​​for users with extremely small (or 0) actual gas consumption, etc., which leads to poor performance of conventional prediction models in this field. This solution sets up a two-stage training step based on the setting of a specific model; through the first stage of training, the best performing prediction model can be obtained, and through the second stage of training, the model can further learn extreme gas consumption situations in a targeted manner, and then the final prediction model selected can cope with special gas consumption situations (such as users who have not used gas for a long time), ensuring that subsequent predictions for different types of users have a high degree of accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] Figure 1 The present invention is a method flow chart of a first embodiment of a method, system and storage medium for predicting gas volume according to the present invention. DETAILED DESCRIPTION

[0013] The following is a further detailed description through specific implementation methods.

[0014] Embodiment 1 The embodiment is basically as shown in the attached Figure 1 A method for predicting the amount of fuel gas is shown, comprising the following steps: Step 1, collecting a basic gas data set; the basic gas data set includes historical gas usage, as well as time characteristic data, geographic characteristic data and user characteristic data corresponding to the historical gas usage.

[0015] The user characteristic data includes: user type, user basic parameters; the user type includes heating type users and non-heating type users. The user basic parameters include user name, user number, etc.

[0016] The time characteristic data include: gas consumption collection time, heating period, non-heating period, etc.

[0017] The geographic feature data includes: user address, community to which the user belongs, organization to which the user belongs, etc.

[0018] Step 2: preprocess the basic gas data set, extract target features from it, and form the target data set.

[0019] The preprocessing includes the following steps: data cleaning, feature construction and data conversion. Specifically, the data cleaning includes processing missing values, abnormal values ​​and erroneous data. The feature construction includes constructing specific features, and the specific features include: the number of 0 usage and whether the usage is continuous 0; the data conversion includes converting non-numeric data into numeric data.

[0020] Optionally, when the amount of data in the basic gas data set is too large or the computing power is limited, a random sampling or stratified sampling method may be used to simplify the data in the basic gas data set and reduce the amount of subsequent calculations.

[0021] In this embodiment, when processing missing values, when the interval for reading historical gas consumption is 2 months, the historical gas consumption of a single month is confirmed according to the trend distribution principle; when the interval for reading historical gas consumption is greater than or equal to 3 months, the historical gas consumption of a single month is confirmed according to the average distribution principle. When processing abnormal values ​​and erroneous data, screening is adopted.

[0022] Step 3, build a prediction model; use XGBoost to train the prediction model, and obtain the final prediction model through training optimization; and during the training process, perform a first-stage training based on the target data set; and perform a second-stage training based on the associated feature data of the historical gas usage of 0 in the target data set.

[0023] Specifically, in this embodiment, the prediction model is the machine learning model of XGBoost, and the model learning rate is set to 0.1. The initial value of the maximum depth of the model decision tree is 3, and the maximum depth of the model decision tree is gradually adjusted through cross-validation. Preferably, this solution can also set the threshold of the maximum depth of the model decision tree to X (where X can be 8) to limit the maximum depth value during the adjustment process, thereby controlling the complexity of the model, avoiding overfitting, and helping to enhance the generalization ability of the model, so that the final model obtained can adapt to the actual data situation in the subsequent model application, and ensure the performance stability of the model in actual prediction.

[0024] Moreover, in the step-by-step adjustment of cross-validation, in addition to gradually increasing the maximum depth of the decision tree, the model decision tree depth will also be reduced to 2 to fully verify the stability of the model. If the model evaluation score when it is reduced to 2 is greater than the model evaluation score under the other adjustment conditions, it will be further reduced to 1 for verification; and the maximum depth value of the model decision tree with the highest model evaluation score will be retained. This scheme is set up in this way to fully consider the impact of different decision tree depth setting conditions on model performance, especially for data sets such as gas-related data that involve more complex elements (data items are not limited to numerical values, and there is often no mathematical correlation between each data, and large numerical fluctuations are prone to occur, which makes feature mining for this type of data more difficult). The degree of fit is more difficult to grasp. This scheme can find an optimal point between complexity and generalization ability through multi-layer verification (including reverse and forward adjustment of depth values), thereby improving the performance of the model and finding the most suitable setting value.

[0025] During the first-stage training process, unimportant features are removed through feature importance evaluation, and the random search method is used to find the optimal model parameter combination. In addition, in practical applications, additional adaptive fine-tuning can be performed based on the optimal model parameter combination according to actual forecasting needs. During the second-stage training process, the associated feature data with historical gas consumption of 0 refers to the target data set corresponding to the historical gas consumption when the gas consumption in a single month is 0.

[0026] Through two-stage training, the best performing prediction model can be obtained. In addition, the model can cope with special gas usage situations (such as users who have not used gas for a long time), ensuring high prediction accuracy for different types of users in the future.

[0027] In addition, indicators such as mean square error (MSE), root mean square error (RMSE), and mean absolute error (MAE) are used to evaluate the model, and the model with the best comprehensive index performance is selected as the final prediction model.

[0028] Step 4: Use the prediction model to predict the gas volume.

[0029] In this step, when using the prediction model to predict the gas volume of a certain user, it also includes a pre-judgment step: traverse the historical gas usage of the user. If there are specific features in the historical gas usage, and the time period of occurrence of the specific features is close to the prediction time, the gas volume of the user is directly output as 0, and a verification mark is added to the user for review.

[0030] When making a gas volume forecast, if you need to predict a user's gas volume for this month, the user's basic gas data (including the user's historical gas usage, as well as the time characteristic data, geographic characteristic data and user characteristic data corresponding to the historical gas usage) is input into the forecasting model, and the model output is the predicted gas volume.

[0031] Step 5: Verify the gas volume prediction result in step 4, and when the prediction result meets the preset conditions, trigger the corresponding result feedback step.

[0032] The preset conditions include: the user's gas volume in the prediction result is less than 2 cubic meters; the corresponding result feedback step is: retrieving the user's target-related data; the target-related data include: electricity consumption data and water consumption data close to the prediction time; if the target-related data are all less than the preset benchmark value, the prediction result is determined to be reasonable and no processing is performed; if the target-related data are all greater than the preset benchmark value, the prediction result is determined to be unreasonable, and a verification mark is added to the user for review.

[0033] Specifically, the preset benchmark value is derived by statistical methods based on historical data. The historical data here specifically refers to: in the historical gas usage, when the monthly gas volume is less than 2 cubic meters, the corresponding monthly electricity consumption data and monthly water consumption data.

[0034] The preset conditions also include: the user's gas volume in the prediction result is greater than 100 cubic meters; the corresponding result feedback step is: retrieve the user's historical gas usage, perform trend analysis, and obtain a reference trend; if the prediction result is consistent with the reference trend, the prediction result is determined to be reasonable and no processing is performed; if the prediction result does not meet the reference trend, the prediction result is determined to be unreasonable, and a verification mark is added to the user for review.

[0035] Through the setting of this step, this solution can timely analyze the gas volume forecast results, and for special forecast situations (the forecast results are too large or too small), combine them with the user's actual living conditions to perform correlation verification and marking, which can further ensure the accuracy of the forecast and reduce errors.

[0036] This embodiment also provides a gas volume prediction system for executing a gas volume prediction method as described above; comprising a collection module, a data processing module, a model building module and a prediction module; The acquisition module is used to acquire a basic gas data set; the basic gas data set includes historical gas usage, and time characteristic data, geographic characteristic data and user characteristic data corresponding to the historical gas usage; The data processing module is used to preprocess the basic gas data set, extract target features from it, and form a target data set; the model building module is used to build a prediction model; the prediction model is trained using XGBoost, and the final prediction model is obtained through training optimization; and in the training process, a first-stage training is performed based on the target data set; a second-stage training is performed based on the associated feature data of the historical gas usage of 0 in the target data set; The prediction module is provided with a final prediction model, and the prediction model is used to predict the gas volume.

[0037] Finally, this embodiment further provides a storage medium, in which a computer program is stored, and when the computer program is executed by a processor, a gas volume prediction method as described above is implemented. The storage medium can be a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.

[0038] The present embodiment provides a method, system and storage medium for predicting gas volume, which can intelligently predict gas consumption and achieve high prediction efficiency and prediction accuracy.

[0039] Embodiment 2 A method for predicting gas volume is provided. Based on the first embodiment, step 1 and step 2 are adjusted.

[0040] Specifically, in step 1, the basic gas data set also includes: meteorological characteristic data and associated characteristic data corresponding to the historical gas usage. The meteorological characteristic data include temperature, humidity and weather type. In this embodiment, the meteorological characteristic data is counted in months, and based on the temperature, humidity and weather type, the proportion of high temperature days, low temperature days, normal temperature weather, dry days, humid days, normal days, and the proportion of days of different weather types are classified and measured. Among them, the judgment conditions of high temperature / low temperature and dry / humid can be set with reference to existing standards.

[0041] The associated characteristic data include electricity consumption data, water consumption data, and price data, wherein price data refers to the unit prices of gas, electricity, and water, as well as the user's monthly electricity, water, and gas charges; and, in this embodiment, the associated characteristic data are counted on a monthly basis, and based on the average electricity consumption and average water consumption over multiple months, the percentage of days when the metered electricity consumption exceeds the average electricity consumption and the percentage of days when the water consumption exceeds the average water consumption are measured.

[0042] The user characteristic data also includes the number of family members, number of days at home, gas usage time periods, etc. (this part of the data can be sent to the corresponding users in the form of an online questionnaire for acquisition).

[0043] With this setting, this solution fully considers more diverse characteristic conditions such as meteorological environmental factors, economic price factors, and user's personal usage habits, which can provide richer learning data for the prediction model and help improve the model's prediction accuracy.

[0044] Furthermore, when extracting the target features in step 2, a genetic algorithm is used to optimize feature selection to select the most representative features as the target features. Through this operation, although this solution uses a more complex basic gas data set, when the amount of basic data is extremely complex and large, by optimizing feature selection, the features can be effectively streamlined to ensure that the data processing efficiency is still high.

[0045] Specifically, the cross-validation accuracy is defined as the fitness function.

[0046] Based on the preprocessed basic gas data set, a certain number of feature subsets are randomly generated as the initial population. Each individual represents a feature subset. Each feature subset includes several genes, and each gene represents whether a feature is selected (1 indicates selected, and 0 indicates unselected).

[0047] For each feature subset, the model is trained and the accuracy is calculated using 5-fold cross validation. The average accuracy of the model on a certain subset is taken as the fitness of the subset.

[0048] Use the roulette wheel method to select half of the feature subsets, and randomly select two subsets from the selected feature subsets as feature subset groups through crossover operations. Calculate the fitness difference of each feature subset group, and rank them from small to large according to the fitness difference. Perform single-point crossover on the last n / N (n is the current number of iterations, N is the total number of iterations) feature subset groups in the ranking, and perform multi-point crossover on the remaining feature subset groups. This step can ensure the diversity of feature subsets, avoid the algorithm from generating local optimal solutions, and speed up convergence in the later stage.

[0049] The genes in the newly generated subset are mutated, and the subset after crossover and mutation is combined with the optimal subset in the original population to form a new generation of feature subsets.

[0050] Iteration and fitness evaluation are repeated until the fitness no longer improves significantly or the maximum number of iterations is reached, and the subset with the highest final fitness is selected as the result of feature selection.

[0051] Compared with the first embodiment, the gas volume prediction method, system and storage medium provided in this embodiment consider more comprehensive factors, not only covering explicit factors (such as historical gas consumption, heating conditions and other features directly related to gas consumption), but also covering implicit factors (such as water and electricity consumption, meteorological conditions, economic conditions, etc., which are not directly related to gas consumption, but will affect or can indirectly characterize gas consumption), so that the prediction model can fully explore the related features of gas consumption and achieve higher prediction accuracy. In addition, in order to solve the problem of large data volume and redundant data content caused by increasing the number of features, this solution performs targeted feature optimization by setting a genetic algorithm, which can effectively reduce the amount of data and ensure high data processing efficiency.

[0052] The above is only an embodiment of the present invention. The common sense such as the known specific structure and characteristics in the scheme is not described in detail here. The ordinary technicians in the relevant field are aware of all the common technical knowledge in the technical field of the invention before the application date or priority date, can obtain all the existing technologies in the field, and have the ability to apply the conventional experimental means before that date. The ordinary technicians in the relevant field can improve and implement the scheme in combination with their own abilities under the enlightenment given by this application. Some typical known structures or known methods should not become obstacles for the ordinary technicians in the relevant field to implement this application. It should be pointed out that for the technicians in this field, without departing from the structure of the present invention, several deformations and improvements can be made, which should also be regarded as the protection scope of the present invention, and these will not affect the effect of the implementation of the present invention and the practicality of the patent.

Claims

1. A method for predicting gas volume, characterized in that: The following steps are involved: Step 1, collecting a basic gas data set; the basic gas data set includes historical gas usage, as well as time characteristic data, geographical characteristic data and user characteristic data corresponding to the historical gas usage; Step 2: preprocess the basic gas data set, extract target features from it, and form a target data set; Step 3, build a prediction model; use XGBoost to train the prediction model, and obtain the final prediction model through training optimization; and during the training process, perform a first-stage training based on the target data set; Based on the associated feature data of historical gas usage of 0 in the target data set, two-stage training is performed; Step 4: Use the prediction model to predict the gas volume.

2. A method for predicting gas volume according to claim 1, characterized in that: The user characteristic data includes: user type; the user type includes heating type users and non-heating type users.

3. A method for predicting gas volume according to claim 1, characterized in that: The preprocessing includes the following steps: data cleaning, feature construction and data conversion; the data cleaning includes processing missing values, outliers and erroneous data; The feature construction includes constructing specific features, and the specific features include: the number of times the dosage is 0, and whether the dosage is continuous 0; the data conversion includes converting non-numeric type data into numeric data.

4. A method for predicting gas volume according to claim 3, characterized in that: When processing missing values, when the interval for reading historical gas consumption is 2 months, the historical gas consumption for a single month is confirmed according to the principle of trend distribution; when the interval for reading historical gas consumption is greater than or equal to 3 months, the historical gas consumption for a single month is confirmed according to the principle of average distribution.

5. A method for predicting gas volume according to claim 3, characterized in that: In step 4, when using the prediction model to predict the gas volume of a certain user, it also includes a pre-judgment step: traversing the historical gas usage of the user. If there are specific features in the historical gas usage, and the time period of occurrence of the specific features is close to the prediction time, the gas volume of the user is directly output as 0, and a verification mark is added to the user for review.

6. A method for predicting gas volume according to claim 1, characterized in that: The method further includes step 5: verifying the gas volume prediction result in step 4, and triggering a corresponding result feedback step when the prediction result meets the preset conditions.

7. A method for predicting gas volume according to claim 6, characterized in that: The preset conditions include: the user's gas volume in the prediction result is less than 2 cubic meters; the corresponding result feedback step is: retrieving the user's target-related data; the target-related data include: electricity consumption data and water consumption data close to the prediction time; if the target-related data are all less than the preset benchmark value, the prediction result is determined to be reasonable and no processing is performed; if the target-related data are all greater than the preset benchmark value, the prediction result is determined to be unreasonable, and a verification mark is added to the user for review.

8. A method for predicting gas volume according to claim 7, characterized in that: The preset conditions also include: the user's gas volume in the prediction result is greater than 100 cubic meters; the corresponding result feedback step is: retrieve the user's historical gas usage, perform trend analysis, and obtain a reference trend; if the prediction result is consistent with the reference trend, the prediction result is determined to be reasonable and no processing is performed; if the prediction result does not meet the reference trend, the prediction result is determined to be unreasonable, and a verification mark is added to the user for review.

9. A gas volume prediction system, characterized in that: Used to execute a gas volume prediction method as described in any one of claims 1 to 8; comprising a collection module, a data processing module, a model building module and a prediction module; The acquisition module is used to acquire a basic gas data set; the basic gas data set includes historical gas usage, and time characteristic data, geographic characteristic data and user characteristic data corresponding to the historical gas usage; The data processing module is used to preprocess the basic gas data set, extract target features from it, and form a target data set; the model building module is used to build a prediction model; XGBoost is used to train the prediction model, and the final prediction model is obtained through training optimization; and during the training process, a first-stage training is performed based on the target data set; Based on the associated feature data of historical gas usage of 0 in the target data set, two-stage training is performed; The prediction module is provided with a final prediction model, and the prediction model is used to predict the gas volume.

10. A storage medium storing a computer program, wherein: When the computer program is executed by a processor, a gas volume prediction method according to any one of claims 1 to 8 is implemented.