Fuel gas consumption prediction method, device, equipment and medium
By constructing a gas prediction model based on the training data set and SARIMA model, the prediction accuracy of gas consumption seasonality and complexity is solved, more accurate gas consumption prediction is achieved, and the resource management and operation decisions of gas companies are optimized.
Patent Information
- Application Number
- CN202510006872.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-03
- Publication Date
- 2025-03-11
AI Technical Summary
There is seasonality and complexity in gas usage, and the prediction accuracy is poor using traditional prediction methods.
By obtaining the current gas usage data and associated data of each user, the first gas prediction model built on the training data set and the SARIMA model is used to make predictions, and the prediction accuracy is improved through data cleaning and model update.
The accuracy of gas usage prediction can be improved and the future gas usage of residents and enterprise users can be more accurately predicted, thereby optimizing the resource allocation of gas companies, improving service efficiency, and reducing operating costs.
Smart Images

Figure CN119599722A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a method, device, equipment and medium for predicting gas usage. Background Art
[0002] In modern society, gas is an indispensable key energy source in daily life and industrial production, and its demand continues to grow with the acceleration of urbanization and industrialization. However, the balance between gas supply and demand is affected by many factors, such as seasonal changes, climate fluctuations, market price fluctuations, and changes in consumer usage habits. Therefore, accurate prediction of gas consumption is particularly important for gas suppliers. This not only helps to formulate scientific and reasonable supply plans and avoid oversupply or undersupply caused by inaccurate predictions, but also effectively reduces operating costs and improves service quality, thereby better meeting customer needs.
[0003] Traditional gas consumption forecasting methods mainly rely on empirical judgment and statistical analysis of historical data, such as moving average method, historical average method and exponential smoothing method. These methods try to predict future gas demand by analyzing past data. However, gas consumption is seasonal and volatile. When faced with complex changes in gas consumption, these traditional methods often show limitations and poor prediction accuracy.
[0004] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention
[0005] The main purpose of this application is to provide a gas consumption prediction method, device, equipment and medium, aiming to solve the technical problems that gas consumption is seasonal and complex and the prediction accuracy is poor using traditional prediction methods.
[0006] To achieve the above-mentioned purpose, the present application provides a gas usage prediction method, comprising: obtaining current gas usage data and current associated data of each user, wherein the current associated data is data that affects the current gas usage; based on the current gas usage data and the current associated data of each user and using a pre-constructed first gas prediction model, obtaining the predicted gas usage of each user; wherein the first gas prediction model is constructed based on a training data set and a SARIMA model and is obtained after multiple updates, and the training data set includes the current gas usage data, current associated data, historical gas usage data and historical associated data of each user; and determining a first predicted total gas amount based on the predicted gas usage of each user.
[0007] Optionally, a single update process of the first gas prediction model includes: adding the current gas usage data and current associated data to a training data set, and determining a sample factor based on the training data set of each user; and determining part of the data from the training data set as sample data based on the sample factor to update the first gas prediction model.
[0008] Optionally, determining the sample factor based on the training data set of each user includes: determining the sample factor using the following formula (2):
[0009]
[0010] In the formula, μ i represents the sample factor of the i-th user, k i represents the current gas usage data of the i-th user, Indicates the historical gas consumption data of the i-th user and k i The jth data with the same meter reading date, J i Indicates the historical gas consumption data of the i-th user and k i The number of data with the same meter reading date, |*| represents taking the absolute value, and δ represents the first preset coefficient. δ is a positive integer.
[0011] Optionally, before using a pre-built first gas prediction model based on the current gas usage data of each user and the current associated data, the method further includes: performing data cleaning on the training data set; wherein the data cleaning at least includes: screening outliers on the training data set.
[0012] Optionally, the screening of outliers for the training data set includes: calculating a tolerance range for each user; and removing data that is not within the tolerance range from the historical gas usage data of each user.
[0013] Optionally, calculating the fault tolerance range of each user includes: using the following formula (1) to calculate the fault tolerance range of each user:
[0014]
[0015] In the formula, A i represents the upper limit of the fault tolerance range of the i-th user, B i represents the lower limit of the fault tolerance range of the i-th user, x i represents the mean of the historical gas usage data of the ith user, {x} represents the mean set of the historical gas usage data of all users, max{*} represents the maximum value in the set, min{*} represents the minimum value in the set, R i Indicates the maximum value of the historical gas usage data of the i-th user.
[0016] Optionally, after determining the first predicted total gas volume based on the predicted gas usage of each user, the method further includes: constructing multiple second gas prediction models based on the training data set, the structures of each second gas prediction model are different and the input of each second gas prediction model is the training data set, and the output is the second predicted total gas volume of the corresponding structure; determining an evaluation factor of each second gas prediction model, and the evaluation factor is used to characterize the prediction accuracy of each second gas prediction model; and determining the optimal predicted total gas volume based on the evaluation factor of each second gas prediction model, the second predicted total gas volume output by each second gas prediction model, and the first predicted total gas volume.
[0017] In addition, to achieve the above-mentioned purpose, the present application also provides a gas usage prediction device, including: a data acquisition module, used to obtain the current gas usage data and current associated data of each user, wherein the current associated data is data that affects the current gas usage; a gas usage prediction module for each user, used to obtain the predicted gas usage of each user based on the current gas usage data and the current associated data of each user and using a pre-built first gas prediction model; wherein the first gas prediction model is constructed based on a training data set and a SARIMA model and is obtained after multiple updates, and the training data set includes the current gas usage data, current associated data, historical gas usage data and historical associated data of each user; a total gas amount prediction module, used to determine a first predicted total gas amount based on the predicted gas usage of each user.
[0018] The present application also provides a gas usage prediction device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the above-mentioned gas usage prediction method.
[0019] The present application also provides a computer-readable storage medium, comprising: a computer program stored therein, wherein when the computer program is executed by a processor, the above-mentioned gas usage prediction method is implemented.
[0020] The present application proposes a gas usage prediction method, device, equipment and medium, which obtains a first gas prediction model by constructing it based on a training data set and a SARIMA model and undergoing multiple iterative training, and obtains the predicted gas usage of each user based on the current gas usage data and related data of each user and the first gas prediction model, thereby solving the problem of poor prediction accuracy using traditional prediction methods due to the seasonality and complexity of gas usage, and achieving improved gas usage prediction accuracy. It can more accurately predict the future gas usage of residential and corporate users, thereby optimizing the resource allocation of gas companies, improving service efficiency, and reducing operating costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 This is a flow chart of a method for predicting gas usage according to one embodiment of the present application;
[0022] Figure 2 A flowchart of a method for predicting gas usage according to another embodiment of the present application;
[0023] Figure 3 It is a structural block diagram of a gas consumption prediction device according to an implementation mode of the present application;
[0024] Figure 4 It is a schematic diagram of the structure of a gas usage prediction device according to one embodiment of the present application.
[0025] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0026] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0027] The existing gas consumption forecasting methods have certain limitations and are difficult to meet the growing demand for gas consumption forecasting. Inaccurate forecasting results may lead to oversupply or undersupply, which in turn may cause a series of problems. Oversupply may lead to waste of gas resources and unnecessary increase in operating costs, while undersupply may lead to a decline in user service quality and customer dissatisfaction, and in serious cases may even affect public safety. Therefore, the limitations of existing methods not only affect the operational efficiency of gas suppliers, but may also have a negative impact on service quality and customer satisfaction.
[0028] Since gas consumption data is seasonal and volatile, the SARIMA model is often used to predict gas consumption. The SARIMA (Seasonal Autoregressive Integrated Moving Average) model is an extension of the ARIMA (Autoregressive Integrated Moving Average) model, which is specifically used to process time series data with seasonal fluctuations. Compared with the ARIMA model, the SARIMA model adds components such as seasonal autoregression (SAR), seasonal difference (SI) and seasonal moving average (SMA), which can better capture the cyclical changes in the data. However, the SARIMA model also has some limitations, mainly including:
[0029] Sensitive to outliers. The SARIMA model assumes that time series data is stationary, so it is very sensitive to outliers in the data (such as sudden events or abnormal fluctuations). Outliers may affect the parameter estimation of the model, leading to forecast bias and thus affecting forecast performance.
[0030] Seasonal update lags. The SARIMA model relies on historical data to capture seasonal fluctuations. However, if the seasonal pattern changes or the trend changes, the SARIMA model may not be able to update its seasonal pattern in time, resulting in delayed or inaccurate forecast results. Especially in the case of rapid seasonal changes, the model's response may not be sensitive enough.
[0031] In order to solve the above problems, the present application provides a method for predicting gas consumption, and the present application scheme is introduced in detail below.
[0032] Figure 1 is a flow chart of a gas usage prediction method according to an embodiment of the present application. The gas usage prediction method can be executed by an electronic device with data processing capability, and the electronic device can be configured as a gas usage prediction device. Figure 1 The gas consumption prediction method may include the following steps:
[0033] S1, obtaining current gas usage data and current associated data of each user, wherein the current associated data is data that affects the current gas usage.
[0034] S2: based on the current gas usage data of each user and the current associated data and using a pre-built first gas prediction model, obtain the predicted gas usage of each user.
[0035] The first gas prediction model is constructed based on the training data set and the SARIMA model and is obtained after multiple updates. The training data set includes the current gas usage data, current associated data, historical gas usage data and historical associated data of each user. The historical associated data is the data that affects the historical gas usage. The current associated data and the historical associated data can be weather data, socio-economic data, population data of each user, gas price data, etc. It can be understood that by integrating multi-dimensional associated data, a richer data background can be provided for the first gas prediction model, that is, it can help the first gas prediction model capture external factors that affect the gas usage data.
[0036] It should be noted that this embodiment predicts future gas usage data based on current gas usage data and historical gas usage data. Exemplarily, the current gas usage data may be the gas usage of the current month, the historical gas usage data may be the gas usage before the current month and within a preset time length, and the future gas usage data may be the gas usage of the next month. In this embodiment, the current month is not limited to a fixed month, nor is it related to real time, but is based on the month to be predicted. For example, if the gas usage to be predicted is September, the current gas usage data may be the gas usage data of August.
[0037] It should be further explained that after each prediction is completed, the actual data corresponding to the prediction must be added to the training data set. For example, the gas usage data from January to December of 23 is initially used to predict the gas usage in January of 24. At this time, the training data set contains the gas usage data from January to December of 23; when the time reaches the beginning of February of 24, that is, when the gas usage in February of 24 is predicted, the actual gas usage in January of 24 is added to the training data set. At this time, the training data set contains the gas usage data from January to December of 23 and the gas usage data in January of 24.
[0038] In the specific implementation process, the training data set is collected and stored through the Spark or Hadoop platform. The training data set includes the historical gas usage data, historical associated data, current gas usage data and current associated data of each user. Among them, the gas usage data includes each user ID, meter reading date and the gas usage corresponding to each date.
[0039] It should be noted that the Spark platform and Hadoop platform are used to process large-scale data sets. The use of the Spark platform and Hadoop platform can efficiently process and store massive data in a distributed environment, ensure the comprehensiveness and accuracy of the data, and reduce the time cost and computing resource consumption of data processing.
[0040] In this embodiment, the HIVE tool of the Hadoop platform can be used to perform preliminary data cleaning on the training data set. It should be noted that the HIVE tool can efficiently clean and process data in a big data environment, thereby enhancing the reliability and availability of data.
[0041] In one embodiment, before step S2, the embodiment may further include: performing data cleaning on the training data set.
[0042] In the specific implementation process, we can first use data cleaning tools such as Apache Hive to deduplicate the training data set to ensure that each user has only one record on each meter reading date, thereby avoiding deviations caused by duplicate data and ensuring data uniqueness and consistency.
[0043] Furthermore, the data in the training data set is normalized, and the data normalization may specifically include: converting all records into standard units and standardizing the date format into the form of "YYYY-MM-DD". It can be understood that normalizing the data in the training data set can ensure the consistency of input data after building the first gas prediction model and reduce errors caused by format differences.
[0044] It should be noted that since there may be some abnormal data in the training data set, for example, data with negative or abnormally high usage, and abnormal data affects the prediction accuracy, the data cleaning step also needs to include an outlier screening step.
[0045] It should be further explained that the tolerance range of gas consumption is different for different users. For example, for users with peak gas consumption, their gas demand will fluctuate greatly. Therefore, allowing fluctuations within a certain range for peak users can better adapt to the actual gas demand, avoid unnecessary constraints, and ensure that users can obtain sufficient gas supply during peak hours. For non-peak gas users, gas consumption is usually more stable with less volatility. Therefore, by limiting the fluctuation range, the gas supply can be more accurately controlled and adjusted to avoid excessive waste of resources, thereby improving the efficiency and energy saving effect of the entire prediction model.
[0046] In the specific implementation process, the fault tolerance range of each user is first calculated, and then the data of the historical gas usage data of each user that is smaller or larger than the fault tolerance range of the user is eliminated.
[0047] Specifically, taking the i-th user as an example, the fault tolerance range of the i-th user is calculated using the following formula (1):
[0048]
[0049] In the formula, A irepresents the upper limit of the fault tolerance range of the i-th user, B i represents the lower limit of the fault tolerance range of the i-th user, x i represents the mean of the historical gas usage data of the ith user, {x} represents the mean set of the historical gas usage data of all users, max{*} represents the maximum value in the set, min{*} represents the minimum value in the set, R i Indicates the maximum value of the historical gas usage data of the i-th user.
[0050] It should be noted that after the above processing, there will be some missing values in the training data set, and the missing values need to be supplemented.
[0051] Furthermore, each missing value is supplemented by using the mean of the data with the same meter reading date in the training data set. It can be understood that the meter reading date is the recording time of each gas usage data. The meter reading date can be in years, months or days. The meter reading dates of two data are the same if the month and / or date are the same but the years can be different. Since gas consumption is affected by seasonality, the missing data cannot be supplemented only based on the previous and next data in time series, but the data at the same time in history must be considered. At this time, the integrity of the data can be guaranteed, and it can fit the real seasonal demand pattern of gas, reducing the impact of missing data on prediction accuracy.
[0052] It is understandable that data cleaning of the training data set may also include partitioning the data, normalizing the meter reading date of the data, and sampling and reviewing the cleaned data. The data cleaning step can ensure the consistency of the data in the time dimension, reduce the monthly data fluctuations caused by different meter reading dates, and enhance the ability to capture seasonal and trend laws, thereby improving the prediction accuracy of the first gas prediction model. In addition, the unified time adjustment allows the data to maintain consistency in the time dimension in subsequent analysis, making it easier for the first gas prediction model to identify long-term trends and seasonal laws and improve the accuracy of the overall prediction.
[0053] It should be noted that the gas consumption forecasting process is a dynamic process that is continuously updated. In each forecast, we use the current set of known data points, i.e., the training data set, to infer the next value. When the next value actually occurs and is observed, it is included in the set of known data points, i.e., the training data set, to update the forecasting model and then use it to infer the next value. In this way, the forecasting model is constantly adjusted and optimized based on the latest data, ensuring that each forecast is based on the most accurate historical information.
[0054] In addition, when predicting gas usage, in addition to relying on historical data, seasonal changes and complex influencing factors must also be considered. The continuously iterative dynamic prediction model will not only dynamically update historical gas usage data, but also update seasonal and complex factors, i.e., associated data, to achieve a more accurate and comprehensive gas usage forecast.
[0055] It should be further explained that as the training data set continues to expand with the continuous addition of data, if all the data in the training data set is used for prediction each time, the amount of calculation will increase dramatically, resulting in inefficiency. In addition, older data may have an adverse effect on the model's future predictions, thereby reducing its accuracy. Therefore, consider using part of the data in the training data set for training to optimize the calculation efficiency and improve the prediction effect.
[0056] In one embodiment, in step S2, a single update process of the first gas prediction model may specifically include:
[0057] S21, adding the current gas usage data and the current associated data to a training data set, and determining a sample factor based on the training data set of each user;
[0058] S22: Based on the sample factor, determine part of the data from the training data set as sample data to update the first gas prediction model.
[0059] The sample factor may reflect the difference between the current gas usage data of each user and the data in the historical gas usage data having the same meter reading date as the current gas usage data.
[0060] In the specific implementation process, taking the i-th user as an example, the sample factor μ of the i-th user can be determined using the following formula (2): i :
[0061]
[0062] In the formula, k i represents the current gas usage data of the i-th user, Indicates the historical gas consumption data of the i-th user and k i The jth data with the same meter reading date, J i Indicates the historical gas consumption data of the i-th user and k i The number of data with the same meter reading date, |*| represents taking the absolute value, and δ represents the first preset coefficient. δ is a positive integer.
[0063] Furthermore, the sample factors of all users are normalized.
[0064] It should be noted that since the sample factor reflects the difference between the current gas usage data of each user and the data in the historical gas usage data with the same meter reading date as the current gas usage data, if the difference between the current gas usage data of a user and the data in the historical gas usage data of the user with the same meter reading date is large, that is, the sample factor is large, it means that the current gas usage data has a seasonal mutation, which may be caused by the influence of gas prices or policies. At this time, the first gas prediction model needs to be adjusted as soon as possible to adapt to seasonal changes. On the contrary, if the difference between the current gas usage data of a user and the data in the historical gas usage data of the user with the same meter reading date is small, that is, the sample factor is small, it means that the current gas usage data is based on the historical seasonal trend, and there is no need to make many changes to the first gas prediction model.
[0065] Based on this, when a user's sample factor is large, the first gas prediction model needs to be adjusted as soon as possible to adapt to seasonal changes. At this time, more partial data needs to be determined from the training data set, that is, more sample data is involved in updating the first gas prediction model, which can better help the first gas prediction model understand and predict the law of seasonal fluctuations. When a user's sample factor is small, it means that the data is relatively stable. At this time, less partial data can be determined from the training data set, that is, less sample data can be involved in building the first gas prediction model. It can be understood that the sample data should cover the past seasonal change pattern, that is, the data within a seasonal cycle.
[0066] Furthermore, the number of data in the training data set of each user is multiplied by the sample factor to obtain the number of samples of each user, and the number of sample data is selected from the training data set of each user in order of meter reading date from recent to distant as the sample data of each user, and the first gas prediction model is trained using the SARIMA model based on the sample data of each user. It can be understood that the sample data of each user needs to contain data of a seasonal cycle, for example, with a limit of one year, and a seasonal cycle of 12.
[0067] In one embodiment, in step S2, after obtaining the predicted gas usage of each user based on the current gas usage data of each user and the current associated data and using a pre-built first gas prediction model, this embodiment may also include: performing model verification on the first gas prediction model of each user.
[0068] Among them, model validation can use a variety of evaluation indicators, such as mean absolute percentage error (MAPE), which can be used to evaluate the relative error level between the predicted value and the actual value; determination coefficient (R 2), which can be used to measure the model's ability to explain data variation; mean absolute error (MAE) and mean square error (MSE), which can be used to evaluate the absolute and square differences of the prediction errors. It can be understood that the use of multiple evaluation indicators to comprehensively evaluate the prediction performance of the first gas prediction model can ensure the accuracy and stability of the prediction model.
[0069] S3, determining a predicted total gas amount based on the predicted gas usage of each user.
[0070] It should be noted that this embodiment is applied to the gas company's estimated demand for changes in gas usage, and further needs to aggregate the predicted gas usage of each user to obtain the predicted total gas amount.
[0071] It is understandable that, compared with first adding up the gas usage of each user and then predicting the total amount, the present embodiment first predicts the gas usage of each user separately and then sums them up, which can accurately capture individual differences and changes in user behavior, thereby improving the prediction accuracy. In addition, there may be significant differences in the gas usage patterns of different users, and directly predicting the total amount may not be able to effectively capture these differences, while predicting user by user can customize the modeling according to the characteristics of each user. At the same time, this method makes the total amount prediction more flexible, and the prediction model can be dynamically adjusted according to the changes of individual users, improving the stability and robustness of the prediction.
[0072] In a specific implementation process, the predicted gas consumption of each user is added up to obtain the predicted total gas consumption.
[0073] It should be noted that a gas usage prediction method in this embodiment obtains a first gas prediction model by constructing it based on a training data set and a SARIMA model and undergoing multiple iterative training, and obtains the predicted gas usage of each user based on the current gas usage data of each user, the current associated data and the first gas prediction model. This solves the problem of poor prediction accuracy using traditional prediction methods due to the seasonality and complexity of gas usage, improves the accuracy of gas usage prediction, and can more accurately predict future gas usage of residential and corporate users, thereby optimizing gas company resource allocation, improving service efficiency, and reducing operating costs.
[0074] Based on the above embodiments, Figure 2 is a flow chart of a method for predicting gas usage according to another embodiment of the present application. Figure 2 Based on Figure 1 The preferred embodiment of the corresponding gas consumption prediction method is shown in FIG. Figure 2 The gas consumption prediction method may include the following steps:
[0075] S1, obtaining current gas usage data and current associated data of each user, wherein the current associated data is data that affects the current gas usage;
[0076] S2, based on the current gas usage data and the current associated data of each user and using a pre-built first gas prediction model, obtain the predicted gas usage of each user; wherein the first gas prediction model is built based on a training data set and a SARIMA model and is obtained after multiple updates, and the training data set includes the current gas usage data, current associated data, historical gas usage data and historical associated data of each user;
[0077] S3, determining a first predicted total gas amount based on the predicted gas usage of each user;
[0078] S4, constructing a plurality of second gas prediction models based on the training data set, wherein the structures of the second gas prediction models are different and the input of the second gas prediction models is the training data set, and the output is the second predicted total gas volume of the corresponding structure;
[0079] S5, determining an evaluation factor of each second gas prediction model, wherein the evaluation factor is used to characterize the prediction accuracy of each second gas prediction model;
[0080] S6: determining an optimal predicted total gas volume based on evaluation factors of the second gas prediction models, the second predicted total gas volume output by the second gas prediction models, and the first predicted total gas volume.
[0081] In one embodiment, in step S4, constructing multiple second gas prediction models based on the training data set may specifically include: constructing a feature space according to data features in the training data set, and constructing multiple second gas prediction models based on the feature space. It is understandable that the feature space can be constructed and optimized through technologies such as data changes, interactive feature construction, and classification variable encoding, and constructing the feature space helps to identify data features, that is, identify key features for predicting gas usage.
[0082] Furthermore, in step S5, the prediction accuracy of each prediction model can be determined by cross-validation method, and the evaluation factor of each second gas prediction model can be determined based on the prediction accuracy of each second gas prediction model. The evaluation factor can be used to characterize the prediction accuracy of each second gas prediction model.
[0083] Further, in step S6, determining the optimal predicted total gas volume based on the evaluation factors of each second gas prediction model, the second predicted total gas volume output by each second gas prediction model, and the first predicted total gas volume can specifically include: changing the evaluation factors of each second gas prediction model in proportion to within the range of 0 to 0.5, using the evaluation factors of each second gas prediction model as weight values, and using the first predicted total gas volume and the second predicted total gas volume output by each second gas prediction model to obtain the optimal predicted total gas volume by weighted average. Among them, the weight value of the first predicted total gas volume is 0.5. It can be understood that since the evaluation factor characterizes the prediction accuracy of each second gas prediction model, and then the second gas prediction models are merged based on the evaluation factor to obtain the optimal predicted total gas volume, this step can optimize the limitations of using only one prediction model for prediction and enhance the prediction performance of the model.
[0084] It should be noted that this embodiment improves the stability and accuracy of the prediction results by integrating multiple models on the basis of the above embodiments, meets the gas company's demand for estimating changes in gas usage, and supports it in better resource management and operational decision-making. Through the dynamic adjustment mechanism of sample data, the continuous optimization and rapid response of the prediction system are achieved, ensuring the long-term effectiveness and accuracy of the prediction system, and providing an efficient energy management solution for modern society.
[0085] Based on the above embodiments, Figure 3 FIG. 1 is a structural block diagram of a gas consumption prediction device according to an embodiment of the present application, such as Figure 3 As shown, the gas consumption prediction device may include: a data acquisition module 310, a gas consumption prediction module for each user 320, and a gas total consumption prediction module 330, wherein:
[0086] The data collection module 310 is used to obtain the current gas usage data and current associated data of each user, wherein the current associated data is data that affects the current gas usage;
[0087] The gas usage prediction module 320 for each user is used to obtain the predicted gas usage of each user based on the current gas usage data and the current associated data of each user and using a pre-built first gas prediction model; wherein the first gas prediction model is built based on a training data set and a SARIMA model and is obtained after multiple updates, and the training data set includes the current gas usage data, current associated data, historical gas usage data and historical associated data of each user;
[0088] The total gas amount prediction module 330 is used to determine a first predicted total gas amount based on the predicted gas usage of each user.
[0089] In an exemplary embodiment, the gas usage prediction module 320 for each user can also be used to add the current gas usage data and current associated data to a training data set, and determine a sample factor based on the training data set for each user; based on the sample factor, determine part of the data from the training data set as sample data to update the first gas prediction model.
[0090] In an exemplary embodiment, the gas usage prediction module 320 for each user may also use the following formula (2) to determine the sample factor:
[0091]
[0092] In the formula, μ i represents the sample factor of the i-th user, k i represents the current gas usage data of the i-th user, Indicates the historical gas consumption data of the i-th user and k i The jth data with the same meter reading date, J i Indicates the historical gas consumption data of the i-th user and k i The number of data with the same meter reading date, |*| represents taking the absolute value, and δ represents the first preset coefficient. δ is a positive integer.
[0093] In an exemplary embodiment, the gas usage prediction module 320 for each user may also be used to perform data cleaning on the training data set; wherein the data cleaning at least includes: screening outliers on the training data set.
[0094] In an exemplary embodiment, the gas usage prediction module 320 for each user may also be used to calculate the fault tolerance range of each user; and remove the data that is not within the fault tolerance range from the historical gas usage data of each user.
[0095] In an exemplary embodiment, the gas usage prediction module 320 of each user may also use the following formula (1) to calculate the fault tolerance range of each user:
[0096]
[0097] In the formula, A i represents the upper limit of the fault tolerance range of the i-th user, B i represents the lower limit of the fault tolerance range of the i-th user, x i represents the mean of the historical gas usage data of the ith user, {x} represents the mean set of the historical gas usage data of all users, max{*} represents the maximum value in the set, min{*} represents the minimum value in the set, R i Indicates the maximum value of the historical gas usage data of the i-th user.
[0098] In an exemplary embodiment, the total gas amount prediction module 330 can also be used to construct multiple second gas prediction models based on the training data set, each of the second gas prediction models has a different structure and the input of each of the second gas prediction models is the training data set, and the output is the second predicted total gas amount of the corresponding structure; determine the evaluation factor of each second gas prediction model, and the evaluation factor is used to characterize the prediction accuracy of each second gas prediction model; determine the optimal predicted total gas amount based on the evaluation factor of each second gas prediction model, the second predicted total gas amount output by each second gas prediction model, and the first predicted total gas amount.
[0099] Those skilled in the art should understand that the division of the modules in the embodiment is only a division of logical functions, and can be fully or partially integrated into one or more actual carriers in actual application, and these modules can be all implemented in the form of software called by the processing unit, or all implemented in the form of hardware, or implemented in the form of a combination of software and hardware. It should be noted that each module in a gas usage prediction device in this embodiment corresponds one-to-one to each step in a gas usage prediction method in the aforementioned embodiment. Therefore, the specific implementation of this embodiment can refer to the implementation of the aforementioned gas usage prediction method, which will not be repeated here.
[0100] Based on the above embodiments, Figure 4 FIG. 1 is a schematic diagram of a gas consumption prediction device according to an embodiment of the present application. Figure 4 As shown, the electronic device may include: a processor 410, a communication interface 420, a memory 430 and a communication bus 440, wherein the processor 410, the communication interface 420 and the memory 430 communicate with each other through the communication bus 440. The processor 410 may call the logic instructions in the memory 430 to execute a gas usage prediction method, which includes: obtaining the current gas usage data and current associated data of each user, wherein the current associated data is data that affects the current gas usage; obtaining the predicted gas usage of each user based on the current gas usage data and the current associated data of each user and using a pre-built first gas prediction model; wherein the first gas prediction model is constructed based on a training data set and a SARIMA model and is obtained after multiple updates, wherein the training data set includes the current gas usage data, current associated data, historical gas usage data and historical associated data of each user; and determining a first predicted total gas amount based on the predicted gas usage of each user.
[0101] In addition, the logic instructions in the above-mentioned memory 430 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0102] On the basis of the above embodiments, on the other hand, the present invention further provides a computer program product, the computer program product includes a computer program, the computer program can be stored on a non-transitory computer-readable storage medium, when the computer program is executed by a processor, the computer can execute the gas usage prediction method provided by the above methods, the method including: obtaining current gas usage data and current associated data of each user, the current associated data being data that affects the current gas usage; based on the current gas usage data and the current associated data of each user and using a pre-built first gas prediction model, obtaining the predicted gas usage of each user; wherein the first gas prediction model is constructed based on a training data set and a SARIMA model and is obtained after multiple updates, the training data set including the current gas usage data, current associated data, historical gas usage data and historical associated data of each user; determining a first predicted total gas amount based on the predicted gas usage of each user.
[0103] On the basis of the above embodiments, on another aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented when the processor executes the gas usage prediction method provided by the above methods, the method comprising: obtaining current gas usage data and current associated data of each user, wherein the current associated data is data that affects the current gas usage; obtaining predicted gas usage of each user based on the current gas usage data and the current associated data of each user and using a pre-constructed first gas prediction model; wherein the first gas prediction model is constructed based on a training data set and a SARIMA model and is obtained after multiple updates, and the training data set includes the current gas usage data, current associated data, historical gas usage data and historical associated data of each user; and determining a first predicted total gas amount based on the predicted gas usage of each user.
[0104] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A method for predicting gas consumption, characterized in that: include: Acquire current gas usage data and current associated data of each user, wherein the current associated data is data that affects the current gas usage; Based on the current gas usage data of each user and the current associated data and using a pre-built first gas prediction model, obtain the predicted gas usage of each user; The first gas prediction model is constructed based on a training data set and a SARIMA model and is obtained after multiple updates, wherein the training data set includes current gas usage data, current associated data, historical gas usage data, and historical associated data of each user; A first predicted total gas amount is determined based on the predicted gas usage of each user.
2. The method for predicting gas consumption according to claim 1, characterized in that: The single update process of the first gas prediction model includes: Adding the current gas usage data and the current associated data to a training data set, and determining a sample factor based on the training data set of each user; Based on the sample factor, part of the data is determined from the training data set as sample data to update the first gas prediction model.
3. The method for predicting gas consumption according to claim 1, characterized in that: The determining of the sample factor based on the training data set of each user includes: The sample factor is determined using the following formula (2): In the formula, μ i represents the sample factor of the i-th user, k i represents the current gas usage data of the i-th user, Indicates the historical gas consumption data of the i-th user and k i The jth data with the same meter reading date, J i Indicates the historical gas consumption data of the i-th user and k i The number of data with the same meter reading date, |*| represents taking the absolute value, and δ represents the first preset coefficient. δ is a positive integer.
4. The method for predicting gas consumption according to claim 1, characterized in that: Before using the pre-built first gas prediction model based on the current gas usage data of each user and the current associated data, the method further includes: Performing data cleaning on the training data set; Wherein, the data cleaning at least includes: screening outliers from the training data set.
5. The method for predicting gas consumption according to claim 4, characterized in that: The step of screening the training data set for outliers includes: Calculate the fault tolerance range of each user; The data that is not within the fault tolerance range in the historical gas usage data of each user is eliminated.
6. The method for predicting gas consumption according to claim 5, characterized in that: The calculating of the fault tolerance range of each user includes: The fault tolerance range of each user is calculated using the following formula (1): In the formula, A i represents the upper limit of the fault tolerance range of the i-th user, B i represents the lower limit of the fault tolerance range of the i-th user, x i represents the mean of the historical gas usage data of the ith user, {x} represents the mean set of the historical gas usage data of all users, max{*} represents the maximum value in the set, min{*} represents the minimum value in the set, R i Indicates the maximum value of the historical gas usage data of the i-th user.
7. The method for predicting gas consumption according to claim 1, characterized in that: After determining the first predicted total gas amount based on the predicted gas usage of each user, the method further includes: Building a plurality of second gas prediction models based on the training data set, wherein the structures of the second gas prediction models are different and the input of the second gas prediction models is the training data set, and the output is the second predicted total gas volume of the corresponding structure; Determining an evaluation factor of each second gas prediction model, wherein the evaluation factor is used to characterize the prediction accuracy of each second gas prediction model; An optimal predicted total gas amount is determined based on the evaluation factors of the second gas prediction models, the second predicted total gas amount output by the second gas prediction models, and the first predicted total gas amount.
8. A gas consumption prediction device, characterized in that: include: A data acquisition module is used to obtain the current gas usage data and current associated data of each user, wherein the current associated data is data that affects the current gas usage; A gas usage prediction module for each user, configured to obtain a predicted gas usage of each user based on the current gas usage data of each user and the current associated data and using a pre-built first gas prediction model; The first gas prediction model is constructed based on a training data set and a SARIMA model and is obtained after multiple updates, wherein the training data set includes current gas usage data, current associated data, historical gas usage data, and historical associated data of each user; The gas total amount prediction module is used to determine a first predicted gas total amount based on the predicted gas usage of each user.
9. A gas consumption prediction device, characterized in that: include: at least one processor; And, a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the gas usage prediction method as described in any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the gas usage prediction method according to any one of claims 1 to 7 is implemented.