Gas demand prediction method and device based on user clustering and model adaptation

By using user segmentation and model adaptation, gas consumption data is acquired and clustered to determine a dedicated prediction model. This solves the problems of insufficient accuracy and stability in gas consumption prediction in existing technologies, and achieves more accurate gas demand prediction.

CN122243012APending Publication Date: 2026-06-19SHENZHEN UNIV +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHENZHEN UNIV
Filing Date
2026-02-03
Publication Date
2026-06-19

AI Technical Summary

Technical Problem

Existing residential natural gas consumption forecasting technologies are unable to accurately capture the gas consumption patterns of different user groups, resulting in insufficient accuracy and stability of forecast results, which cannot meet the needs of gas supply dispatching.

Method used

By acquiring historical gas consumption data of each user in the target area, extracting gas consumption profile features, performing cluster analysis to group users, determining a dedicated gas consumption prediction model for each group, and summarizing the group prediction results to obtain the total gas consumption.

Benefits of technology

It improves the accuracy and stability of gas demand forecasting, accurately reflects the real gas demand trend in the target area, and provides reliable data support for urban gas supply scheduling and energy planning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122243012A_ABST
    Figure CN122243012A_ABST
Patent Text Reader

Abstract

This application relates to the field of data prediction technology, and discloses a gas demand prediction method and apparatus based on user segmentation and model adaptation. The method includes: acquiring historical gas consumption data of each user within a target area; extracting corresponding gas consumption profile features based on the historical gas consumption data of each user; performing cluster analysis based on the gas consumption profile features of all users to divide all users into at least one user segment; determining a corresponding gas consumption prediction model based on the aggregated gas consumption data of each user segment; predicting the future gas consumption of each user segment using the gas consumption prediction model corresponding to each user segment; and summarizing the future gas consumption prediction results of each user segment to obtain the overall gas consumption prediction result for the target area. This application can accurately capture the gas consumption patterns of different user groups, improve the accuracy and stability of gas demand prediction in the target area, and meet the actual gas supply scheduling needs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data prediction technology, specifically to a gas demand prediction method and apparatus based on user segmentation and model adaptation. Background Technology

[0002] Forecasting urban residential natural gas consumption is a key technology for urban energy planning and gas supply scheduling. Accurate gas demand forecasting can support gas companies in optimizing resource allocation and ensuring stable gas supply, while also providing reliable data for energy management departments to formulate development plans.

[0003] Currently, the industry mainly uses two modeling and forecasting methods for residential natural gas consumption. The first method is city-wide unified modeling and forecasting, which treats all residential users in the target area as a whole and builds a forecasting model based on the region's historical total gas consumption data to predict future total gas consumption. The second method is regional modeling and forecasting based on administrative divisions, which divides the forecasting units according to administrative boundaries, models are built separately in each unit, and then the forecasting results of each unit are aggregated to obtain the region's total gas consumption.

[0004] However, existing residential natural gas consumption forecasting technologies have some shortcomings in practical applications. For city-wide unified modeling and forecasting, different users have significantly different living habits and gas consumption patterns. Simply superimposing the gas consumption data of all users into a model cannot accurately depict the gas consumption patterns of different user groups. This results in the model only fitting a rough trend at a macro level, and the forecast results deviate significantly from actual demand. For regional modeling and forecasting based on administrative divisions, the division of administrative boundaries is not based on the similarity of users' gas consumption patterns. The same administrative region often contains user groups with multiple gas consumption patterns, and users with similar gas consumption patterns may be divided into different areas by administrative boundaries. This makes the gas consumption data patterns within each zone mixed, and the model training is difficult to converge to a stable pattern, ultimately affecting the accuracy of the total regional gas consumption forecast. In summary, existing technologies cannot accurately capture the gas consumption patterns of different user groups, and have problems with insufficient accuracy and stability of forecast results, failing to meet the actual gas supply scheduling needs.

[0005] The preceding description is intended to provide general background information and does not necessarily constitute prior art. Summary of the Invention

[0006] This application provides a gas demand forecasting method and apparatus based on user segmentation and model adaptation, which can accurately capture the gas consumption patterns of different user groups, improve the accuracy and stability of gas demand forecasting in target areas, and meet actual gas supply scheduling needs.

[0007] In a first aspect, embodiments of this application provide a gas demand forecasting method based on user segmentation and model adaptation, including: Obtain historical gas consumption data for each user within the target area; Based on the historical gas consumption data of each user, extract the corresponding gas consumption profile features; Cluster analysis was performed based on the gas usage profile characteristics of all users to divide all users into at least one user group; Based on the aggregated gas consumption data of each user group, a corresponding gas consumption prediction model is determined. Using the gas consumption prediction model corresponding to each user group, the future gas consumption of each user group is predicted respectively; By summarizing the future gas consumption forecasts for each user group, the overall gas consumption forecast for the target area is obtained.

[0008] Secondly, embodiments of this application provide a gas demand forecasting device based on user segmentation and model adaptation, comprising: The data acquisition module is used to acquire historical gas consumption data for each user within the target area; The feature extraction module is used to extract corresponding gas consumption profile features based on the historical gas consumption data of each user. The user segmentation module is used to perform cluster analysis based on the gas usage profile characteristics of all users, and to divide all users into at least one user segment. The model determination module is used to determine the corresponding gas consumption prediction model based on the aggregated gas consumption data of each user group. The prediction execution module is used to predict the future gas consumption of each user group using the gas consumption prediction model corresponding to each user group. The aggregation calibration module is used to aggregate the future gas consumption prediction results of each user group to obtain the overall gas consumption prediction result of the target area.

[0009] This application provides a gas demand forecasting method and apparatus based on user segmentation and model adaptation. First, historical gas consumption data of each user within a target area is acquired. Then, based on this data, corresponding gas consumption profile features are extracted to accurately depict the gas consumption patterns of each user. Subsequently, all users are clustered according to the gas consumption profile features, grouping users with similar gas consumption patterns into the same group. This makes the aggregated gas consumption data of each group more consistent and exhibits more significant temporal patterns, overcoming the shortcomings of traditional unified modeling that ignores the differentiated gas consumption characteristics of users and that administrative division-based segmentation does not accurately reflect actual gas consumption patterns. Next, by independently determining the corresponding gas consumption prediction model for each user group and conducting group predictions, the model can better adapt to the gas consumption patterns of each group, ensuring the accuracy of the prediction results for each group. Finally, by summarizing the future gas consumption prediction results of each group, the overall gas consumption prediction result for the target area is obtained. Since the predictions of each group are based on their own unified gas consumption patterns, the overall result after summarization can accurately reflect the real gas demand trend of the target area, thereby effectively improving the accuracy and stability of gas demand prediction and providing reliable data support for urban gas supply scheduling and energy planning. Attached Figure Description

[0010] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0011] Figure 1 This is an application environment diagram of the gas demand forecasting method based on user segmentation and model adaptation provided in the embodiments of this application; Figure 2 This is a flowchart illustrating the gas demand forecasting method based on user segmentation and model adaptation provided in the embodiments of this application. Figure 3 This is a schematic diagram of the architecture of the cluster prediction system provided in the embodiments of this application; Figure 4 This is a schematic diagram of the process for predicting urban residential gas consumption provided in an embodiment of this application; Figure 5 This is a schematic diagram of the dynamic data acquisition and preprocessing process provided in the embodiments of this application; Figure 6 This is a schematic diagram of the process of linking rolling verification model selection with training cycle provided in the embodiments of this application; Figure 7 This is a schematic diagram of image grouping and membership weighting provided in the embodiments of this application; Figure 8This is a schematic diagram of the grouping mode selection and calibration mechanism provided in the embodiments of this application; Figure 9 This is a schematic diagram of the consistency calibration and range output provided in the embodiments of this application; Figure 10 This is a schematic diagram of the gas demand forecasting device based on user segmentation and model adaptation provided in the embodiments of this application; Figure 11 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0012] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of systems and methods consistent with those detailed in the appended claims or with some aspects of this application.

[0013] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover descriptions such as non-exclusive inclusion, so 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. Furthermore, components, features, and elements with the same names in different embodiments of this application may have the same meaning or different meanings, the specific meaning of which must be determined by its interpretation in that specific embodiment or further in conjunction with the context of that specific embodiment.

[0014] It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to limit this application.

[0015] In the following description, the use of suffixes such as "module," "part," or "unit" to denote elements is solely for the purpose of illustrative purposes and has no specific meaning in itself. Therefore, "module," "part," or "unit" may be used interchangeably.

[0016] To address the aforementioned technical problems and overcome the shortcomings of existing technologies, this application provides a gas demand forecasting method and apparatus based on user segmentation and model adaptation. This method can accurately capture the gas consumption patterns of different user groups, improve the accuracy and stability of gas demand forecasting in target areas, and meet actual gas supply scheduling needs.

[0017] Figure 1 This is an application environment diagram of a gas demand forecasting method based on user segmentation and model adaptation in one embodiment. (Refer to...) Figure 1 This gas demand forecasting method based on user segmentation and model adaptation is applied to a gas demand forecasting system based on user segmentation and model adaptation. The system includes a terminal 110 and a server 120. The terminal 110 and server 120 are connected via a network. The terminal 110 can be a desktop terminal or a mobile terminal, specifically a mobile phone, tablet computer, laptop computer, or other similar devices. The server 120 can be a standalone server or a server cluster consisting of multiple servers. The server 120 is configured to execute the aforementioned gas demand forecasting method based on user segmentation and model adaptation, including: acquiring historical gas consumption data for each user within a target area; extracting corresponding gas consumption profile features based on the historical gas consumption data of each user; performing cluster analysis based on the gas consumption profile features of all users to divide all users into at least one user segment; determining the corresponding gas consumption prediction model based on the aggregated gas consumption data of each user segment; predicting the future gas consumption of each user segment using the corresponding gas consumption prediction model; and summarizing the future gas consumption prediction results of each user segment to obtain the overall gas consumption prediction result for the target area.

[0018] Please see Figure 2 , Figure 2 This is a flowchart illustrating a gas demand forecasting method based on user segmentation and model adaptation according to an embodiment of this application. This embodiment primarily uses the application of this gas demand forecasting method based on user segmentation and model adaptation to computer equipment as an example for illustration. Specifically, the gas demand forecasting method based on user segmentation and model adaptation provided in this embodiment may include the following steps: S1. Obtain historical gas consumption data for each user within the target area; Specifically, for step S1, natural gas usage data for all residential users within the target area is collected from the gas metering system, smart meter reading system, gas billing system, or data warehouse. The collection process primarily gathers two core parameters: first, the time range parameter, covering historical data from multiple years to ensure the data's temporal representativeness; and second, the sampling granularity parameter, which can be selected based on actual forecasting needs, at the monthly, daily, or hourly level. After collection, the data needs preliminary processing, aligning it bidirectionally by user identifier and timestamp, removing invalid data with missing timestamps, duplicate records, or significantly abnormal values, forming a complete and standardized three-dimensional data set relating users, time, and gas consumption.

[0019] S2. Extract corresponding gas consumption profile features based on each user's historical gas consumption data; Specifically, for step S2, a continuous personal gas consumption time series is first generated for each user, with time on the horizontal axis and gas consumption on the vertical axis for the corresponding period. Then, gas consumption profile features that can accurately characterize the user's gas consumption pattern are extracted from this time series, including key dimensions such as gas consumption level, trend, seasonal patterns, and fluctuations, ensuring that each feature reflects an independent attribute of the user's gas consumption behavior.

[0020] S3. Perform cluster analysis based on the gas usage profile characteristics of all users to divide all users into at least one user group; Specifically, for step S3, the gas usage profile feature vectors of all users within the target area are collected. A clustering algorithm is then used to unsupervised group the feature vectors. The core principle of grouping is clustering similar users together, meaning that users within the same cluster have highly similar gas usage profile features, while users in different clusters have significantly different gas usage profile features. The clustering algorithm can be K-means, hierarchical clustering, Gaussian mixture model, etc. The optimal number of clusters can be automatically determined using metrics such as the silhouette coefficient and Davies-Bouldin index, eliminating the need for manual subdivision.

[0021] S4. Based on the aggregated gas consumption data of each user group, determine the corresponding gas consumption prediction model; Specifically, for step S4, the first step is to aggregate data for each user group by summing or averaging the gas consumption data of all users within the same group along the time dimension to generate an aggregated gas consumption time series for that user group. This series can reflect the gas consumption pattern of the entire group. The second step is to select a suitable prediction model based on the characteristics of the aggregated gas consumption time series. The selection criterion is that the model can accurately fit the gas consumption pattern of the user group. For example, for aggregated sequences with strong seasonal patterns, a model that is good at capturing periodic time series characteristics is selected; for aggregated sequences with stable trends and small fluctuations, a linear model with simple structure and strong generalization ability is selected.

[0022] S5. Using the gas consumption prediction model corresponding to each user group, predict the future gas consumption of each user group respectively; Specifically, for step S5, the aggregated gas consumption time series for each user group is completely input into its corresponding prediction model. The prediction time range and prediction granularity are set according to actual business needs, such as predicting monthly gas consumption for the next 12 months and daily gas consumption for the next 30 days. The model extrapolates patterns based on the input historical aggregated series and outputs the predicted gas consumption values ​​for that user group in various future periods, forming a future gas consumption prediction series at the group level.

[0023] S6. Summarize the future gas consumption forecast results of each user group to obtain the overall gas consumption forecast result of the target area; Specifically, for step S6, using time as a unified dimension, the gas consumption forecasts for all user groups within the same time period are arithmetically summed to obtain the overall natural gas consumption forecast for the target area for that time period. This method is used to calculate the overall forecast for each future time period sequentially, ultimately forming a complete future gas demand forecast sequence for the target area.

[0024] This embodiment clusters users' gas consumption profiles to ensure that the aggregated gas consumption data of each cluster exhibits a unified and significant pattern of change. Then, it adapts a dedicated prediction model to the patterns of each cluster, which can accurately capture the differentiated gas consumption patterns of different user groups. This effectively avoids the limitations of traditional city-wide unified modeling or modeling by administrative divisions, and improves the accuracy and stability of overall gas demand forecasting for the target area.

[0025] Furthermore, in some embodiments, step S2, "extracting corresponding gas consumption profile features based on each user's historical gas consumption data," may specifically include: S21. Generate a gas consumption time series based on each user's historical gas consumption data; Specifically, for step S21, for each residential user in the target area, their complete historical gas consumption data records are retrieved. Using time as the sole sorting dimension, the gas consumption data of users in different time periods are arranged in an orderly manner to form a one-dimensional gas consumption time series. When constructing the series, the time granularity needs to be determined. This time granularity can be set to monthly, daily, or hourly levels according to actual forecasting needs. At the same time, the temporal continuity of the series must be ensured. If some time periods are missing data, the missing positions must be marked first, and then supplemented based on subsequent preprocessing processes to avoid directly interrupting the series.

[0026] S22. Extract gas consumption profile features from gas consumption time series to characterize gas consumption patterns; the gas consumption profile features include at least one of horizontal features, trend features, seasonal features, and volatility features; Specifically, for step S22, based on the generated individual gas consumption time series of users, features reflecting user gas consumption behavior patterns are extracted from four core dimensions. The level feature characterizes the average level or core consumption range of user gas consumption, which can be achieved by calculating the mean, median, quantiles, or peak-to-valley ratio of the time series. The peak-to-valley ratio is the ratio of the maximum to the minimum gas consumption in the series, reflecting extreme differences in user gas consumption. The trend feature characterizes the long-term trend of user gas consumption, which can be calculated using linear regression fitting to determine the slope of the time series. A positive slope indicates an upward trend in gas consumption, while a negative slope indicates a downward trend. The larger the absolute value of the slope, the more significant the trend. The seasonal feature characterizes the periodic variation of user gas consumption with seasonal changes, which can be achieved by calculating the gas consumption ratio for typical seasonal periods. A common calculation method is the ratio of average monthly gas consumption in winter to average monthly gas consumption in summer. A ratio greater than 1 indicates that user gas consumption is higher in winter than in summer, reflecting seasonal gas demand such as heating. Volatility characteristics are used to characterize the stability of a user's gas consumption. This can be achieved by calculating the standard deviation, coefficient of variation, or number of abnormal fluctuations in the time series. The coefficient of variation, which is the ratio of the standard deviation to the mean, can eliminate the influence of differences in gas consumption levels and more objectively reflect the degree of volatility. The number of abnormal fluctuations can be determined using the 3σ criterion: a value exceeding the mean ± 3 times the standard deviation of the series is counted as one abnormal fluctuation.

[0027] This embodiment generates a continuous gas usage time series for each user, intuitively presenting the temporal changes in user gas usage. Then, it extracts profile features from core dimensions such as level, trend, seasonality, and volatility to accurately depict the personalized gas usage patterns of different users. This provides a reliable feature basis for subsequent user clustering and improves the fit between the clustering results and the actual gas usage behavior of users.

[0028] Furthermore, in some embodiments, step S3, "performing cluster analysis based on the gas usage profile characteristics of all users to divide all users into at least one user group," may specifically include: S31. Based on the gas usage profile characteristics of all users, generate user grouping results through clustering algorithms; Specifically, for step S31, gas usage profile feature vectors of all users within the target area are collected. These vectors are used as input data for a clustering algorithm, and user grouping is completed through unsupervised learning. The choice of clustering algorithm needs to be adapted to the attributes of the gas usage profile features. Methods such as K-means, hierarchical clustering, Gaussian mixture model, fuzzy C-means, or time-series clustering based on dynamic time warping distance can be used. During the clustering process, the optimal number of clusters needs to be determined. This can be automatically calculated using indicators such as silhouette coefficient, Davis-Bourdin index, or Bayesian information criterion to ensure high similarity of gas usage profile features among users in the same cluster and significant differences in gas usage profile features among users in different clusters. After clustering is completed, the cluster label corresponding to each user is output, clarifying the gas usage group to which the user belongs.

[0029] S32. Based on the user grouping results, the historical gas consumption data of users belonging to the same group are aggregated according to the time dimension to form the historical aggregated gas consumption sequence of each user group; Specifically, for step S32, for each defined user group, the original historical gas consumption data of all users within that user group is retrieved and uniformly aligned according to timestamps to ensure that the data of all users correspond one-to-one in the time dimension. Gas consumption of all users within the same group during the same time period is aggregated and calculated using summation or averaging methods to generate a historical aggregated gas consumption sequence for that user group. Consistency in time granularity must be maintained during the aggregation process; if the original data is monthly granularity, the aggregated sequence will still be a monthly sequence; if it is daily granularity, the aggregated sequence will still be a daily sequence, ensuring that the aggregated sequence accurately reflects the group's gas consumption variation patterns.

[0030] This embodiment uses a clustering algorithm to group users with similar gas usage patterns into the same group, effectively removing interference from different gas usage patterns. Then, by aggregating over time, it generates a clustered historical gas usage sequence, making the gas usage patterns of each cluster more prominent and stable. This provides a high-quality and highly adaptable data foundation for the construction of subsequent cluster prediction models, thereby improving the accuracy of subsequent gas demand forecasting.

[0031] Furthermore, in some embodiments, step S32, "aggregating the historical gas consumption data of users belonging to the same user group according to the time dimension based on the user grouping results, to form the historical aggregated gas consumption sequence of each user group," may specifically include: S321. Obtain the membership degree of each user to each user group; Specifically, in step S321, when clustering users, a soft clustering algorithm is used for grouping calculations. This algorithm does not rigidly assign users to a single cluster but outputs the membership degree values ​​of each user to each cluster. Commonly used soft clustering algorithms include Gaussian mixture models and fuzzy C-means clustering. During the calculation, the sum of the membership degree values ​​for each user across all clusters is 1. A higher membership degree value indicates a higher degree of fit between the user's gas usage pattern and the characteristics of that cluster. After clustering, the system generates a membership degree list for each user, clearly recording the specific membership degree values ​​for each cluster, thus reflecting the degree of association between the user and each cluster.

[0032] S322. Weight user gas consumption data according to membership degree; Specifically, for step S321, for each user's historical gas consumption data, weighted gas consumption data is calculated for each subgroup according to the user's membership degree. The specific calculation method is to multiply the user's original gas consumption for a certain period by the user's membership degree for that subgroup; the product is the user's weighted gas consumption data for that period and subgroup. The original gas consumption of the same user for the same period needs to be multiplied by the membership degree of each of the corresponding subgroups to generate multiple sets of weighted gas consumption data, thereby accurately reflecting the user's contribution to gas consumption in different subgroups.

[0033] S323. Overlay the weighted gas consumption data along the time dimension to generate a historical aggregated gas consumption sequence; Specifically, for step S321, for each user group, weighted gas consumption data of all users within the target area under that group is collected. Using time as a unified benchmark dimension, the weighted gas consumption data of all users in the same time period are summed. The summation process must strictly follow the principle of consistency of time granularity. If the original data is monthly granularity, it is summed by month; if it is daily granularity, it is summed by date. Through time-period summation calculation, the historical aggregated gas consumption sequence of that group is finally generated. This sequence can fully reflect the comprehensive gas consumption change pattern of that group in various historical time periods.

[0034] This embodiment introduces a membership weighting mechanism to process the gas consumption data of boundary users, avoiding the problem of absolute affiliation caused by hard clustering. This makes the historical aggregated gas consumption sequence of the cluster smoother and more in line with the actual differences in users' gas consumption patterns, thereby improving the regularity of the aggregated sequence and providing more accurate data support for the construction of subsequent cluster prediction models.

[0035] Furthermore, in some embodiments, step S4, "determining the corresponding gas consumption prediction model based on the aggregated gas consumption data of each user group," may specifically include: S41. Predefine a set of candidate prediction models for each user group; Specifically, for step S41, for each user segment after segmentation, a set of prediction models with different time-series fitting capabilities is pre-configured as a candidate set, based on the potential time-series patterns of the gas consumption sequence for that segment. The candidate models need to cover time-series prediction methods from different technical approaches, including at least three core models: the first is a statistical time-series model, suitable for sequences with obvious linear trends and periodic patterns; the second is a machine learning regression model, suitable for sequences with non-linear characteristics but a moderate sample size; and the third is a deep learning time-series model, suitable for sequences with complex patterns and long-term dependencies. The number of candidate models can be adjusted according to actual computing power and business needs to ensure that the candidate model set for each segment can cover all possible gas consumption patterns for that segment.

[0036] S42. Based on the historical aggregated gas consumption sequences of user groups, train each candidate prediction model and verify it using a rolling time window cross-validation method to obtain the verification results; Specifically, for step S42, the first step is to retrieve the historical aggregated gas consumption sequence for the user group and clarify the time granularity and total duration of the sequence. The second step is to conduct training and validation for each model in the candidate model set using a rolling time window cross-validation method. The core of this method is to simulate the real prediction scenario and continuously update the training and validation sets by sliding the window. In practice, the training window length and validation window length need to be set first. Initially, the data of the first N time periods of the sequence are taken as the training set, and the data of the next M time periods are taken as the validation set. After completing one round of training and validation, the window is slid forward by M time periods to form a new training and validation set. The above process is repeated until the entire historical sequence is traversed. The third step is to calculate the error index between the model's predicted value and the actual value in each round of validation. Commonly used indicators include mean absolute percentage error and root mean square error. Finally, by calculating the average of the errors from multiple rounds of validation, the comprehensive validation result of the candidate model on this group is obtained.

[0037] S43. Based on the verification results, select one model from the candidate prediction models as the gas consumption prediction model corresponding to the user group; Specifically, for step S43, the comprehensive validation results of all candidate models under this user group are collected and sorted according to the preset error index priority. The priority can be set as mean absolute percentage error first, followed by root mean square error. After sorting, the candidate model with the best error index is selected as the gas consumption prediction model specific to this user group. The selection process does not require manual intervention and is entirely based on the objective performance of the validation data, ensuring that the model is highly compatible with the gas consumption patterns of the group.

[0038] This embodiment configures multiple candidate prediction models for each user group and objectively evaluates the performance of each model by using rolling time window cross-validation. It selects the prediction model that best matches the gas consumption pattern of the group, effectively avoiding the limitations of a single model, improving the accuracy and stability of gas consumption prediction for the group, and providing high-quality group prediction results for subsequent overall gas demand prediction of the target area.

[0039] Furthermore, in some embodiments, step S4, "determining the corresponding gas consumption prediction model based on the aggregated gas consumption data of each user group," may further include: S44. If the performance difference between the optimal candidate model and the second-best candidate model is less than a set threshold, then calculate the ensemble weight based on the verification performance of the optimal candidate model and the second-best candidate model. Specifically, in step S44, after ranking the candidate models by performance, the optimal candidate model with the best error index and the second-best candidate model are determined. The performance difference between the two models is calculated by subtracting the validation error of the optimal candidate model from the validation error of the second-best candidate model. The error index is preferably the mean absolute percentage error (MASE) or root mean square error (RMSE). The calculated performance difference is compared with a preset threshold, which can be set according to the business requirements for prediction accuracy, for example, a difference in MASE of less than 1%. If the performance difference is less than the set threshold, the prediction performance of the two models is considered to be relatively close. In this case, the inverse error normalization method is used to calculate the ensemble weights. The core logic is that the smaller the model validation error, the higher the assigned weight. Specifically, the weight of a single model is equal to the validation error of the other model divided by the sum of the validation errors of the two models, ensuring that the sum of the weights of the two models is 1.

[0040] S45. The optimal candidate model and the second-best candidate model are weighted and fused based on the integrated weight, and the fused model is used as the gas consumption prediction model for user groups. Specifically, for step S45, the complete training parameters and structure of the optimal and second-best candidate models are retained, without altering their independent predictive capabilities. The object of weighted fusion is determined to be the predicted gas consumption values ​​for future time periods output by both models, not the model parameters themselves. In the actual prediction phase, the predicted values ​​output by the two models for the same time period are multiplied by their respective fusion weights, and the products are then summed to obtain the final predicted value for that time period. The calculation rules for weighted fusion are solidified into the group prediction process, enabling the fused model to directly output the final prediction result, serving as the dedicated gas consumption prediction model for that user group.

[0041] This embodiment filters out the best and second-best models with similar performance by setting a performance difference threshold, and forms a cluster prediction model by using an error-inverse weighted fusion method. This can give full play to the fitting advantages of different models, effectively reduce the risk of prediction inaccuracy caused by data fluctuations in a single model, and further improve the stability and reliability of the cluster gas consumption prediction results.

[0042] Furthermore, in some embodiments, step S4, "determining the corresponding gas consumption prediction model based on the aggregated gas consumption data of each user group," may specifically include: S41A. Calculate the predefined clustering pattern index of the historical aggregated gas consumption sequence for each user cluster; Specifically, for step S41A, for each generated historical aggregated gas consumption sequence of user groups, a grouping pattern indicator that can characterize the core features of the gas consumption pattern of the group is calculated according to preset rules. The indicator needs to cover key dimensions such as the trend, seasonality, and volatility of the gas consumption sequence. In some scenarios, external factor correlation indicators can be added.

[0043] The trend strength index reflects the significance of long-term increases or decreases in the gas consumption cluster sequence. It is calculated by performing linear regression fitting on the aggregated gas consumption sequence, calculating the slope and coefficient of determination of the fitted line. A larger absolute slope and a coefficient of determination closer to 1 indicate a stronger trend. The seasonality index reflects the periodic significance of seasonal variations in gas consumption clusters. It can be achieved by separating the seasonal component of the sequence using a seasonal decomposition algorithm and calculating the proportion of the variance of the seasonal component to the total variance of the original sequence. A higher proportion indicates stronger seasonality. Alternatively, the ratio of gas consumption during typical seasonal periods can be directly calculated, such as the ratio of average monthly gas consumption in winter to average monthly gas consumption in summer. The volatility index reflects the stability of the gas consumption cluster sequence. It is achieved by calculating the standard deviation, coefficient of variation, or number of abnormal fluctuations in the sequence. Smaller standard deviations and coefficients of variation indicate smaller fluctuations and greater stability. The external factor correlation index reflects the degree of correlation between gas consumption clusters and exogenous variables such as temperature and holidays. It is achieved by calculating the Pearson or Spearman correlation coefficient between the aggregated gas consumption sequence and the exogenous variable sequence. A correlation coefficient closer to 1 indicates a stronger correlation. After all indicators are calculated, they are integrated into a pattern indicator vector for that cluster, which serves as the input for subsequent model matching.

[0044] S41B. Input the clustering pattern index into the pre-built model matching rule base to obtain the recommended prediction model type; Specifically, for step S41B, which involves pre-constructing a model matching rule base, the construction process is as follows: Select multiple representative user groups and collect their pattern indicator vectors; conduct complete training and validation on these representative groups for various mainstream time-series prediction models (such as TimeXer, TimesNet, and DLinear), recording the prediction errors of different models on different indicator feature groups; analyze and summarize the correlation between group pattern indicator features and model prediction performance, solidifying these patterns into judgment rules to form a model matching rule base. Input the pattern indicator vectors of the groups to be matched into the rule base. The rule base will perform match-by-match according to the preset judgment logic, outputting the prediction model type most suitable for the indicator features of that group. The judgment logic of the rule base can adopt a decision tree structure or conditional judgment statements, and the core logic must follow the principle of matching group patterns with model advantages.

[0045] S41C. Determine the gas consumption prediction model corresponding to the user group based on the recommended prediction model type; Specifically, for step S41C, based on the recommended model type output by the rule base, a mature time-series prediction model of that type is selected as the gas consumption prediction model for that user group. During the selection process, it must be ensured that the basic architecture of the model fully matches the recommended type. If the recommended type is a model that supports exogenous variables, then a model version with exogenous variable input branches must be selected. Simultaneously, the general initialization parameters for that model type can be directly used, or the basic parameters can be fine-tuned based on features such as group sequence length and time granularity, without needing to perform full training and validation on all candidate models.

[0046] This embodiment calculates the cluster pattern index and combines it with a pre-built rule base to match and recommend models. It eliminates the need to train and verify all candidate models, which greatly reduces the computational overhead and time cost of model selection. At the same time, it ensures that the selected model is highly compatible with the gas consumption patterns of the clusters, effectively guaranteeing the accuracy and efficiency of gas consumption prediction for the clusters.

[0047] Furthermore, in some embodiments, step S5, "using the gas consumption prediction model corresponding to each user group to predict the future gas consumption of each user group," may specifically include: S51. Determine the future time granularity and the number of forecast periods; Specifically, for step S51, two core forecasting parameters are defined based on actual business needs: the future time granularity and the forecast period. The choice of time granularity must match the business application scenario. If used for medium- to long-term urban gas supply planning, a monthly or quarterly granularity can be selected; if used for short-term pipeline peak-shaving scheduling, a daily or hourly granularity should be selected. The setting of the forecast period must be combined with the length of historical data and business needs, while ensuring that the period is within the effective forecast range of the model to avoid distortion of results due to an excessively long forecast period. After determining the parameters, the time granularity and forecast period must be synchronized to the forecasting process of all user groups to ensure that the forecasting results of each group are consistent in the time dimension.

[0048] S52. For each user segment, obtain the external influencing factor data corresponding to the prediction period; Specifically, for step S52, analyze and screen external influencing factors that can affect the gas consumption patterns of this group. Common factors include meteorological factors, holiday factors, and population flow factors. For the determined prediction time granularity and period, obtain the external influencing factor data for the corresponding period. The data must meet the requirement of time dimension alignment. If the prediction granularity is monthly, data such as the monthly average temperature and the number of monthly holidays need to be obtained; if it is daily, data such as the daily maximum temperature and whether the day is a holiday need to be obtained. At the same time, according to the gas consumption characteristics of the group, targeted supplementary data on core influencing factors should be obtained. For example, heating-type groups need to focus on obtaining temperature data, and holiday-sensitive groups need to focus on obtaining holiday distribution data.

[0049] S53. Input the historical aggregated gas consumption sequence and corresponding external influencing factor data of each user group into the gas consumption prediction model determined by each user group to obtain the gas consumption sequence prediction results of each user group at the future time granularity. Specifically, for step S53, the input data is first preprocessed by precisely aligning the historical aggregated gas consumption sequence of user groups with the corresponding external influencing factor data in the time dimension, ensuring that each historical gas consumption data is matched with the corresponding external factor data. Then, according to the input format requirements of the prediction model, the preprocessed historical aggregated gas consumption sequence is used as the main time series input, and the external influencing factor data corresponding to the prediction period is used as the exogenous variable input, and synchronously input into the gas consumption prediction model of the group that has been determined. Next, the model extrapolates the gas consumption of each future period based on the correlation between the gas consumption pattern learned from historical data and external factors, generating a preliminary prediction sequence. Finally, using methods such as quantile regression or Bootstrap, based on the residual distribution during the model training process, the prediction interval of gas consumption for each future period is calculated, ultimately forming a complete gas consumption sequence prediction result that includes the predicted point value and the prediction interval.

[0050] S54. Output the gas consumption sequence prediction results for each user group. The gas consumption sequence prediction results include point prediction values ​​and prediction intervals. Specifically, for step S54, the prediction results for each user group are compiled according to a unified format. The results must include four core elements: group identifier, prediction time node, predicted point value, and upper and lower limits of the prediction interval. The output format can be a table or a time series data file, facilitating subsequent aggregation calculations and business applications. Simultaneously, the prediction results must be labeled to determine key parameters such as prediction time granularity, prediction period, and confidence level, ensuring the traceability and interpretability of the results.

[0051] This embodiment, by clearly defining the prediction granularity and period, and combining the prediction with the core external influencing factors of the cluster, enables the model to output gas consumption sequence results that are more in line with business needs. At the same time, the output point prediction values ​​and prediction intervals provide not only clear reference values ​​for gas demand, but also the boundary range of demand fluctuations, effectively improving the practicality and guidance of the cluster prediction results, and providing more comprehensive data support for subsequent overall gas consumption prediction and gas dispatch in the target area.

[0052] Furthermore, in some embodiments, step S53, "inputting the historical aggregated gas consumption sequence and corresponding external influencing factor data of each user group into the gas consumption prediction model determined for each user group, to obtain the gas consumption sequence prediction results of each user group at the future time granularity," may specifically include: S531. Based on historical aggregated gas consumption sequences and corresponding external influencing factor data, construct time series samples that conform to the input format of the gas consumption prediction model; Specifically, for step S531, the time dimension of the data is precisely aligned. The historical aggregated gas consumption sequences of user groups are matched one by one with the external influencing factor data of the corresponding time period according to the timestamp, ensuring that each historical gas consumption data corresponds to a set of external factor data of the same period, forming a combined data pair of gas consumption data and external factors. The input format requirements of the target prediction model are analyzed to determine the required time series input window length and exogenous variable dimension of the model. The time series input window length refers to the number of historical data periods input into the model at one time, and the exogenous variable dimension refers to the number of types of external influencing factors. A sliding window method is used to generate time series samples. Taking the prediction of gas consumption in the future time period T as an example, the historical aggregated gas consumption data from time period TN to T-1 is selected as the main time series input part, and the external influencing factor data of the same period is selected as the exogenous variable input part. The combination of the two is a complete prediction input sample. The input sample set covering all prediction time periods is generated sequentially according to this rule to ensure that the sample format is completely matched with the model input interface.

[0053] S532. Input the time series samples into the gas consumption prediction model, and obtain the preliminary prediction sequence corresponding to the future time granularity through the forward calculation of the model; Specifically, for step S532, it is confirmed that the prediction model has been trained and its parameters have been fixed. The model's network structure and weight parameters have been adapted to the gas consumption patterns and external factor correlation characteristics of this user group. All the predicted time series samples constructed in the previous step are input into the model in chronological order, triggering the model's forward calculation process. During the calculation process, the model will perform feature extraction, time-series dependency modeling, and pattern deduction for each input sample based on the correlation patterns between historical gas consumption sequences and external factors learned during the training phase, and output the predicted gas consumption value for each sample in the future single time period. All predicted values ​​are arranged in chronological order to form a preliminary prediction sequence corresponding to the future time granularity. This sequence only reflects the model's original calculation results and has not been verified by business rules.

[0054] S533. Post-process the preliminary prediction sequence, including at least one of the following operations: non-negation processing according to business rules, smoothing correction of abnormal prediction values ​​exceeding a preset threshold, and converting the prediction results to the target dimension. Specifically, for step S533, for the preliminary prediction sequence output by the model, at least one post-processing operation is selected for optimization based on actual business needs, as follows: Non-negativity processing: Since natural gas consumption is a non-negative physical quantity, if there are negative predicted values ​​in the preliminary prediction sequence, they need to be corrected to 0 or the minimum value allowed by the industry to ensure that the prediction results are consistent with objective reality.

[0055] Smoothing correction of outlier predictions: Based on the historical aggregated gas consumption data of this cluster, a threshold for the normal gas consumption range is calculated in advance. A common method is the historical mean ± 3 standard deviations. If the preliminary prediction value exceeds this threshold, it is determined to be an outlier. The correction of outliers adopts a smoothing strategy, adjusting them to the threshold boundary value, or replacing them with the mean of the prediction values ​​of adjacent time periods, to avoid the interference of single-point outliers on the overall pattern of the sequence.

[0056] Target unit conversion: If the units of the preliminary forecast results are inconsistent with the requirements of business applications, a unified conversion is required, such as converting "cubic meters" to "ten thousand cubic meters" or "thousand cubic meters" to facilitate subsequent summary calculations and report display.

[0057] S534. Use the post-processed prediction sequence as the prediction result of the gas consumption sequence corresponding to the user group; Specifically, for step S534, after completing the selected post-processing operation, the optimized predicted values ​​are rearranged in chronological order to form the final user group gas consumption sequence prediction results.

[0058] This embodiment constructs time-series samples that match the input format of the model to ensure that the model can effectively exert its fitting ability to output a preliminary prediction sequence. Then, through post-processing operations such as nonnegation, anomaly correction, and dimension conversion, unreasonable values ​​in the original prediction results of the model are corrected, so that the final gas consumption prediction sequence of the group is more in line with objective reality and business needs, thereby further improving the accuracy and practicality of the prediction results.

[0059] Furthermore, in some embodiments, step S6, "summarizing the future gas consumption forecast results of each user group to obtain the overall gas consumption forecast result for the target area," may specifically include: S61. Sum the predicted future gas consumption values ​​for each user group to obtain a preliminary total predicted value; Specifically, for step S61, firstly, a unified time statistical dimension is determined. This dimension must be consistent with the prediction time granularity of each user group. If the prediction granularity of a group is monthly, the time dimension is unified to the month; if it is daily, it is unified to the date. Then, the predicted future gas consumption values ​​of all user groups for the same time period are retrieved. Using an arithmetic summation method, the predicted values ​​of all groups within each time period are accumulated to obtain the preliminary total predicted value for the target area for the corresponding time period. The summation process must ensure coverage of all user groups, without omitting the prediction data of any group, ensuring that the preliminary total predicted value can fully reflect the sum of the gas demand of each group.

[0060] S62. The preliminary total gas consumption forecast is calibrated to ensure that the final forecast meets the preset business constraints, thus obtaining the total gas consumption forecast result; Specifically, for step S62, the preset business constraints are first determined. These constraints need to be formulated based on the actual gas supply and management needs of the target area. Common business constraints include the normal fluctuation range of historical total gas consumption data, the maximum gas supply capacity limit of gas pipelines, phased policy control requirements, and gas supply guarantee needs for major events. Then, the preliminary total forecast value is adjusted using the corresponding calibration method. The calibration method can be selected according to the constraint type. For fluctuation range constraints, the mean and standard deviation of historical data for the same period can be referenced to adjust the preliminary value exceeding the range to a reasonable range. For gas supply capacity constraints, if the preliminary value exceeds the maximum gas supply capacity, it is corrected according to the capacity limit. For policy or event needs, incremental or decremental adjustments can be made in conjunction with relevant contingency plans. After calibration, the value that satisfies all business constraints is output as the overall gas consumption forecast result for the target area.

[0061] This embodiment first obtains a preliminary total gas demand forecast by summing the results, and then calibrates the forecast by combining it with actual business constraints. This not only fully integrates the gas demand forecasts of each subgroup, but also avoids situations where the preliminary forecasts may exceed the actual supply capacity or the normal fluctuation range. This makes the final overall gas demand forecast result more in line with the actual needs of urban gas dispatching and planning, and effectively improves the practicality and reliability of the forecast results.

[0062] Furthermore, in some embodiments, step S62, "calibrating the preliminary total forecast value to ensure that the final forecast value meets preset business constraints, thereby obtaining the overall gas consumption forecast result," may specifically include: S621. Generate independent top-level gas consumption forecasts based on historical overall gas consumption data for the target area; Specifically, for step S621, historical overall gas consumption data covering multiple years and time periods for the target area is retrieved. The time granularity of the data must be consistent with that of the cluster forecast, and the data must be continuous, complete, and able to reflect the long-term changing patterns of overall gas consumption in the region. An independent forecasting model that does not rely on the cluster forecasting model is selected for modeling. The model type can be a statistical time series model, a machine learning model, or a deep learning model. The modeling process is completely independent of the cluster forecasting process to avoid the propagation or superposition of biases from the cluster forecasts. The historical overall gas consumption data is fitted with patterns using this independent model to extrapolate future gas demand and generate a top-level gas consumption forecast value. This value represents the macro-constraint target for overall gas demand in the region.

[0063] S622. Using the top-level gas consumption forecast as the target, the future gas consumption forecast of each user group is adjusted through an optimization algorithm so that the sum of the adjusted forecast values ​​of each user group is consistent with the top-level gas consumption forecast. Specifically, for step S622, the core objective of the optimization algorithm is first determined: to make the sum of all sub-group predictions equal to the top-level gas consumption prediction value while minimizing the adjustment range of the sub-group predictions. Optional optimization algorithms include least squares, gradient descent, and minimum trace calibration (MinT). The algorithm must consider the stability of the gas consumption trends of each sub-group to avoid over-adjustment of the predictions for a single sub-group. During adjustment, the original predictions for each sub-group are used as a basis, and the adjustment amount is allocated according to factors such as the error weight of the sub-group's historical predictions and its gas consumption proportion. Sub-groups with higher proportions and smaller errors receive smaller adjustments to ensure that the individual gas consumption patterns of each sub-group are not disrupted. After adjustment, it is necessary to verify whether the changing trend of each sub-group's predictions conforms to its inherent gas consumption pattern to avoid adjustment results that violate common business sense.

[0064] S623. The sum of the adjusted predicted values ​​for each user group shall be taken as the final overall gas consumption prediction result; Specifically, for step S623, the adjusted future gas consumption forecasts for all user groups are collected and summed over time to obtain the adjusted total value. This value undergoes final verification to confirm that it simultaneously meets two conditions: first, it is completely consistent with the top-level gas consumption forecast; second, the adjusted forecast values ​​for each group conform to its own gas consumption patterns and business constraints. After verification, the adjusted total value is determined as the final overall gas consumption forecast result for the target area. Simultaneously, the values ​​before and after the adjustment for each group, along with the basis for the adjustment, are retained to ensure the traceability of the forecasting process.

[0065] This embodiment generates independent top-level gas consumption forecast values ​​to provide macro-level constraints for the aggregated results of the sub-group forecasts. Combined with optimization algorithms, precise adjustments are made to ensure that the sum of the sub-group forecast values ​​is completely consistent with the top-level target while preserving the individual gas consumption patterns of each sub-group to the greatest extent. This effectively avoids the cumulative error of sub-group forecasts. The final output of the overall gas consumption forecast not only meets the differentiated gas consumption needs of user groups but also conforms to the long-term development pattern of regional overall gas consumption, thereby improving the accuracy, consistency, and practicality of the forecast results.

[0066] To facilitate understanding of the gas demand forecasting method based on user segmentation and model adaptation provided in this embodiment, this embodiment will provide a detailed description in conjunction with an urban residential natural gas consumption forecasting system that implements the above forecasting method. This system includes at least: a data acquisition module, a data preprocessing module, a gas consumption profile feature extraction module, a clustering module, a model training module, a model evaluation and selection module, a training cycle adjustment module, a forecast execution module, and a result aggregation and consistency calibration module. Each module can interact with data through HTTP / RPC interfaces or message queues to achieve an end-to-end automated forecasting process. First, historical monthly residential gas consumption data covering multiple years is obtained from the gas company. This data is cleaned and aligned at the user level to form a continuous monthly time series. Then, periodic analysis and trend identification are performed on the user series, profile features are extracted, and clustering is completed to construct clustered gas consumption sequences (for soft clustering, weighted aggregation is performed based on membership degree). Multiple candidate forecasting models (e.g., statistical models, machine learning models, and deep learning time series models) are trained for each cluster. The performance is evaluated using metrics such as MAPE and MSE, and the model with the smallest error or the best overall performance is selected as the forecasting model for that cluster. During forecasting, each cluster model generates a future monthly gas consumption sequence. The system then calibrates the cluster results and aggregates them to obtain the city's total demand. For example... Figure 3 As shown, Figure 3 A schematic diagram of the architecture of a natural gas consumption prediction system for urban residents.

[0067] The data acquisition module is used to determine the time range parameters and sampling granularity parameters (e.g., monthly / daily / hourly) based on the forecast requirements, and dynamically acquire target gas consumption data from the gas metering / reading system, billing system or data warehouse; optionally, it can simultaneously acquire data on external influencing factors (such as temperature, holidays, population or major event tags) and align them by timestamp.

[0068] The data preprocessing module is used to clean and align the target gas consumption data, including at least outlier handling, missing value imputation, standardization and normalization / standardization. Outliers can be removed / truncated using the 3σ criterion or box plot method, and missing values ​​can be filled using neighborhood mean, linear interpolation or model interpolation. The processing parameters (mean μ, standard deviation σ, etc.) are solidified for online prediction and reuse.

[0069] The gas consumption profile feature extraction module is used to extract profile feature vectors from users' historical gas consumption time series. The profile features include at least: gas consumption level features (mean / quantile / peak-to-valley ratio), trend features (regression slope / trend strength), seasonality features (seasonal intensity after seasonal decomposition / winter-summer ratio), fluctuation features (standard deviation / coefficient of variation / number of abnormal fluctuations), and optional external sensitivity features (correlation coefficient or regression coefficient with exogenous variables such as temperature and holidays).

[0070] The clustering module is used to cluster users based on their profile feature vectors. Clustering methods can include K-means, hierarchical clustering, GMM, Fuzzy C-Means, or time-series clustering based on DTW distance. The number of clusters K can be automatically determined using criteria such as silhouette coefficient, Davies-Bouldin index, or BIC. When using soft clustering, the system can output the user's membership degree to each cluster for subsequent weighted allocation of "boundary users" in prediction. Furthermore, the system can construct a cluster gas consumption sequence by summing or averaging the gas consumption of users within each cluster over time. When using soft clustering, the gas consumption is weighted and summarized according to the user's membership degree to the cluster. In practical applications, the clustering strategy can be adjusted based on model stability and business needs in small-sample scenarios. For example, when certain user clusters have highly similar gas consumption patterns, they can be merged into a larger cluster for unified modeling; conversely, clusters with significant internal differences can be further subdivided into sub-clusters. This clustering adjustment does not depend on administrative divisions and can be triggered by cluster center drift, intra-cluster similarity decrease, etc., while maintaining the overall "divide first, then merge" architecture.

[0071] The model training module is used to build candidate models for each subgroup and train them to obtain a set of trained candidate models. Candidate models may include statistical models (SARIMA / ETS, etc.), machine learning regression models (random forest / gradient boosting / support vector regression, etc.), and deep learning time series models (LSTM / TCN / Transformer-like models, etc.). During training, rolling window cross-validation can be used, combined with strategies such as early stopping, regularization, and efficient parameter fine-tuning (such as Adapter / LoRA) to improve small sample stability.

[0072] The model evaluation and selection module is used to evaluate candidate models for each cluster based on preset evaluation metrics, and determine the best prediction model or weighted ensemble model for each cluster. Evaluation metrics may include at least MAPE, MAE, RMSE, and MSE. Optionally, the model ranked first is selected as the best model using a priority order of "MAPE ascending → RMSE ascending → training time ascending" to balance accuracy and deployment cost. Preferably, the system selects the single best model with the smallest validation error. Optionally, when the error difference between the best and second-best models is less than a preset threshold, weighted ensemble is performed according to the inverse error normalization, and the weights are determined.

[0073] The training cycle adjustment module is used to link the sampling granularity parameters / time range parameters used in the training of the best model with the subsequent training cycles. For example, if the best model is trained based on monthly data and the prediction target is monthly planning, the training cycle is set to once a month. If the best model performs better on daily / hourly peak data, the training cycle is adjusted to once a day / once an hour, or once every X hours. It can also automatically trigger early retraining based on recent residual drift (error exceeds the threshold).

[0074] The system comprises a prediction execution module and a aggregation and calibration module. The prediction execution module generates gas consumption prediction sequences for the next H periods using the best models for each cluster. The aggregation and calibration module weights and aggregates the cluster predictions according to their membership degrees to obtain the overall city prediction. It can also adjust the cluster predictions using hierarchical consistency calibration (such as optimization calibration with bottom-up and top-level joint constraints) to ensure the sum of the clusters matches the total volume constraint, while applying operational constraints such as non-negativity, maximum increase, and peak smoothing. Optionally, it outputs the prediction interval to provide scheduling risk boundaries. This embodiment uses a bottom-up aggregation method to obtain the total volume prediction. A hierarchical prediction correction mechanism can also be introduced, for example, simultaneously establishing a top-level prediction model and cluster models for the city's total gas consumption, and then adjusting the difference between the sum of the cluster predictions and the top-level prediction using an optimization algorithm (prediction consistency constraint / hierarchical calibration). This method can further improve the overall prediction reliability by utilizing information from the total volume model while maintaining the independence of the cluster models.

[0075] Based on the above system implementation, such as Figure 4 As shown, the prediction method in this embodiment can be executed according to the following steps: (1) Determine the time range parameters and sampling granularity parameters based on the predicted demand, and dynamically acquire the target gas consumption data; the specific process is as follows: Figure 5 As shown, (2) Preprocess the target gas consumption data; (3) Extract gas consumption profile features and complete clustering; construct clustered gas consumption sequences (optionally weighted summarization based on membership degree); (4) Train multiple candidate models for each subgroup and perform rolling validation; (5) Determine the optimal clustering model based on the evaluation index; optionally, determine the integration weight when the error difference is less than a preset threshold. (6) Perform cluster prediction and aggregate by weight; (7) Perform consistency calibration and deviation / abnormality correction; (8) Output point predictions and interval predictions and publish them; (9) Adaptively adjust subsequent training cycles and update the model version based on the granularity and error drift corresponding to the optimal model. The specific process is as follows: Figure 6 As shown.

[0076] In another embodiment, the model selection module of this example can automatically recommend models based solely on the clustering feature indicators after the gas profile is grouped (clustered), without needing to perform full training and backtesting on all candidate models for each cluster. This embodiment generally follows the technical approach of "dividing by cluster and modeling independently," the difference being that the optimal model for each cluster is automatically selected by a predefined decision tree or rule base. Specifically, it includes the following steps: (1) Calculation of cluster characteristic indicators, such as Figure 7 As shown.

[0077] For each subgroup, based on historical monthly residential gas consumption data (small sample scenario), characteristic indicators are calculated to characterize the gas consumption pattern of that subgroup; the characteristic indicators include at least: trend strength indicators, seasonality strength indicators, volatility indicators, and optional external factor correlation indicators.

[0078] Trend strength indicators are used to reflect the significance of the overall upward or downward trend of the monthly gas consumption sequence of this group, such as by using linear regression fitting slope, coefficient of determination, etc. Seasonal intensity indicators are used to reflect the significance of seasonality within a year, such as by the variance proportion of seasonal components after seasonal decomposition, or by the magnitude of the difference in the mean of different months. Volatility indicators are used to reflect the stationarity and volatility of a series, such as standard deviation, coefficient of variation, and number of outliers. External factor correlation indicators are used to reflect the degree of correlation between gas consumption in different clusters and exogenous variables such as temperature and holidays. These are characterized by statistical measures such as correlation coefficients and regression coefficients. Based on the current scheme, more exogenous variables can be added to improve prediction accuracy. For example, meteorological data such as temperature and humidity, population and economic indicators, and the impact of large-scale events on gas consumption can be combined. These features can be easily incorporated into each cluster model during design (especially models that support exogenous variables). The proposed changes include adding external feature input interfaces to each cluster model and selecting appropriate model architectures for different features (e.g., prediction models with exogenous variable branches).

[0079] The aforementioned feature indicators constitute the feature vector of this group, serving as the basis for subsequent decision tree inputs. Meanwhile, the grouping process can employ methods such as K-means, hierarchical clustering, or temporal clustering based on DTW distance, and can be periodically updated based on new data.

[0080] (2) The specific process of constructing a decision tree is as follows: Figure 8 As shown.

[0081] Based on prior experimental results on several representative clusters, this invention constructs the correspondence between cluster features and model performance through the following steps: On representative clusters, several candidate models (including but not limited to Autoformer, DLinear, iTransformer, TimesNet, TimeXer, etc.) are fully trained and validated, and the error metrics (such as MAPE, MSE) and stability performance of each model on each cluster are recorded. Simultaneously record the feature vectors corresponding to these clusters (trend strength, seasonality, volatility, correlation with external factors, etc.); Analyze the correspondence between different group characteristics and the performance of each model, and solidify the empirical rules into a decision tree or several decision rules.

[0082] For example, the following schematic decision logic can be constructed: When the correlation index of external factors is greater than the preset first threshold, it is determined that the group is highly sensitive to exogenous variables such as temperature and holidays. The model selection module will give priority to recommending the TimeXer or iTransformer models that can explicitly model exogenous variables. When the correlation index of external factors is not high and the seasonality index is greater than the preset second threshold, it is determined that the group has significant annual periodicity and moderate dependence on exogenous variables. The model selection module should give priority to models that are good at periodic modeling, such as Autoformer or TimesNet. When the seasonal intensity index is low, the volatility index is small, and the overall trend is approximately linear, the gas consumption sequence structure of this subgroup is relatively simple, and the model selection module should prioritize DLinear or other linear models.

[0083] The aforementioned first threshold, second threshold, and other thresholds can be set and adjusted based on prior experimental results, and are not limited to specific values.

[0084] (3) Automatic model recommendation in the online stage.

[0085] In the actual model selection stage, for new clusters or clusters where the optimal model has not yet been determined, this invention does not require training and backtesting all candidate models one by one. Instead, it adopts the following automatic recommendation process: First, the corresponding feature vector is calculated based on the historical monthly gas consumption data and external characteristics of this group; Input the cluster feature vector into a pre-built decision tree or rule base; The decision tree automatically outputs the recommended candidate model types for this cluster (such as TimeXer, TimesNet, DLinear, etc.), and the model selection module determines the prediction model for this cluster accordingly.

[0086] In this implementation, the model selection process mainly relies on the pre-learned relationship between cluster features and model performance, thereby avoiding repeated training and evaluation of all candidate models in each cluster, reducing computational overhead and deployment costs.

[0087] Besides selecting a single optimal model, model ensemble approaches can be considered to improve robustness. For example, multiple prediction models can be deployed simultaneously for certain clusters, using methods such as weighted averaging, stacking, or voting to obtain cluster prediction results, thereby reducing the risk of single-model inaccuracies. This variant design retains the framework of cluster-based prediction and can dynamically adjust model weights based on validation performance.

[0088] (4) Manual review process.

[0089] In some embodiments, this embodiment can also provide a manual review or adjustment interface based on the automatic recommendation results of the decision tree. For example, when business personnel discover that a certain type of user has special business needs or that there has been a sudden change in recent gas usage patterns, they can manually modify the model recommended by the decision tree or re-trigger the complete model selection process. This manual review step is optional and does not change the basic technical principle of "automatically recommending candidate models based on cluster feature indicators" of this invention.

[0090] Through the above implementation methods, this embodiment provides an "automatic model selection scheme based on cluster feature decision tree" in addition to the main scheme of "cluster optimal model selection based on verification error". Both of them take gas profile clustering and model selection as the core idea and belong to different implementation forms under the same technical concept of this invention.

[0091] Optionally, the decision tree can be incrementally updated with the full backtest results of new data and new subgroups, and each recommendation result (recommendation model type, threshold version, update time) can be recorded in the configuration file or model registry to achieve traceable online model selection and gray-scale switching; when the recommendation model deteriorates in the rolling validation, it can automatically fall back to the main process of "dynamic evaluation of all candidate models + optimal model selection / integration".

[0092] In terms of the training process, to improve the training stability and generalization ability in small sample scenarios, this embodiment makes the following improvements to the training process based on cluster modeling (which can be used individually or in combination): (a) Self-supervised pre-training: Design mask value prediction, sequence reconstruction or contrastive learning tasks on the monthly gas consumption sequence of all users to obtain a shared temporal encoder; (b) Efficient parameter fine-tuning: Only a small number of adaptation parameters (such as Adapter / LoRA layers) are fine-tuned for each subgroup, and regularization such as early stopping and weight decay is combined to suppress overfitting; (c) Rolling cross-validation: Walk-forward / rolling window validation is used instead of one-time splitting to obtain more robust model evaluation results; (d) Dynamic training window and hyperparameter adaptation: Parallel training and evaluation on multiple candidate training windows (such as the last few months / year) and multiple sets of hyperparameters, selecting the optimal combination and automatically updating the training cycle.

[0093] (e) Multi-time range / multi-granularity joint training: For the same cluster, datasets of different granularities such as monthly, weekly, and daily can be constructed in parallel for training and validation. The prediction error and stability under different granularities are compared, and the model corresponding to the optimal granularity is selected to enter the online stage. (f) Adaptive training window: Parallel backtesting is performed on a set of candidate window lengths (e.g., the last 12 / 24 / 36 months or the last N weeks / M days), and the optimal window is automatically selected based on the rolling validation error. This window length is then used as the time range parameter for subsequent training.

[0094] The implementation methods for optimizing and adjusting the prediction results are as follows: Figure 9 As shown, To improve the availability and business consistency of the prediction output, this embodiment optimizes and adjusts the prediction results as follows: (a) Consistency calibration: Based on the bottom-up aggregation of the clusters, the total city model can be trained simultaneously, and the hierarchical prediction calibration algorithm can be used to adjust the cluster predictions so that the sum of the cluster predictions is consistent with the total city constraint. (b) Deviation correction and anomaly correction: An error correction model (such as Kalman filtering / residual regression) is established based on the residual sequence of the most recent period, and business constraints such as non-negativity and maximum increase are post-processed; (c) Weighted allocation of boundary users: When the membership degree of a user to multiple subgroups is similar, the predicted value is weighted by the membership degree weight to avoid the jump caused by hard partitioning; (d) Interval output: Generate prediction intervals based on quantile regression or Bootstrap to provide risk boundaries for scheduling.

[0095] In the specific implementation of consistency calibration, an optimization method that minimizes the adjustment cost can be adopted (such as least squares calibration with the covariance of the prediction residuals of each subgroup as the weight) to obtain the calibrated subgroup predictions; and business constraints such as the upper limit of gas supply capacity and peak shaving constraints can be further superimposed to make the prediction results more in line with the urban gas dispatching scenario.

[0096] Furthermore, the clustering method can be extended from unsupervised clustering to rule-based clustering (such as by user profile tags, gas consumption level, seasonality, etc.) or hybrid clustering; the model selection strategy can introduce multi-model weighted fusion, and the training process can adopt mechanisms such as dynamic training windows and online incremental updates; the aggregation mechanism can overlay top-level prediction calibration results and post-processing of business constraints (non-negative / smooth / peak sensitive) to improve consistency and stability. The introduction of external variables can be added or removed as needed by business requirements, and the prediction granularity can be extended from monthly to daily or even finer granularity for peak shaving scheduling. The system can also support online learning and real-time prediction applications.

[0097] In summary, the gas demand forecasting method based on user segmentation and model adaptation provided in this embodiment improves model specificity and prediction accuracy by organizing data through gas consumption profile clustering and selecting the optimal model or weighted ensemble for each segment, thus avoiding the error amplification problem caused by unified modeling. The independent operation of the segmented models supports parallel processing, improving efficiency and maintainability. Simultaneously, training improvements such as self-supervised pre-training, efficient parameter fine-tuning, and rolling verification enhance training stability in small-sample scenarios. Post-processing on the output side, including consistency calibration, bias correction, and boundary weighting allocation, improves the consistency and business availability of the aggregated predictions. Furthermore, through adaptive linkage between "optimal granularity and training cycle," this invention avoids unnecessary high-frequency retraining while ensuring accuracy, reducing computational resource consumption, and promptly triggers retraining when gas consumption patterns drift to maintain long-term effectiveness.

[0098] To facilitate better implementation of the gas demand forecasting method based on user segmentation and model adaptation in the embodiments of this application, this application also provides a gas demand forecasting device based on user segmentation and model adaptation, which is based on the aforementioned gas demand forecasting method based on user segmentation and model adaptation. The meanings of the terms used are the same as in the aforementioned gas demand forecasting method based on user segmentation and model adaptation, and specific implementation details can be found in the descriptions in the method embodiments.

[0099] Please see Figure 10 , Figure 10 The schematic diagram below illustrates the structure of a gas demand forecasting device based on user segmentation and model adaptation provided in this application embodiment. Specifically, this device may include a data acquisition module 201, a feature extraction module 202, a user segmentation module 203, a model determination module 204, a forecast execution module 205, and a summary calibration module 206, as follows: Data acquisition module 201 is used to acquire historical gas consumption data of each user in the target area; Feature extraction module 202 is used to extract corresponding gas consumption profile features based on the historical gas consumption data of each user; User segmentation module 203 is used to perform cluster analysis based on the gas usage profile characteristics of all users, and to divide all users into at least one user segment. The model determination module 204 is used to determine the corresponding gas consumption prediction model based on the aggregated gas consumption data of each user group. The prediction execution module 205 is used to predict the future gas consumption of each user group using the gas consumption prediction model corresponding to each user group. The summary calibration module 206 is used to summarize the future gas consumption prediction results of each user group to obtain the overall gas consumption prediction result of the target area.

[0100] For specific limitations regarding the gas demand forecasting device based on user segmentation and model adaptation, please refer to the limitations of the gas demand forecasting method based on user segmentation and model adaptation mentioned above, which will not be repeated here. Each module in the aforementioned gas demand forecasting device based on user segmentation and model adaptation can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the corresponding operations of each module.

[0101] The gas demand forecasting device based on user grouping and model adaptation provided in this embodiment can accurately capture the gas consumption patterns of different user groups by clustering users according to their gas consumption profile characteristics, independently modeling and forecasting each group, and then summarizing the data. This improves the accuracy and stability of gas demand forecasting in the target area and meets the actual gas supply scheduling needs.

[0102] Furthermore, embodiments of this application also provide an electronic device, such as... Figure 11 As shown, it illustrates a structural schematic diagram of the electronic device involved in the embodiments of this application, specifically: The electronic device may include components such as a processor 301 with one or more processing cores, a memory 302 with one or more computer-readable storage media, a power supply 303, and an input unit 304. Those skilled in the art will understand that... Figure 11 The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein: The processor 301 is the control center of the electronic device. It connects various parts of the electronic device via various interfaces and lines, and performs various functions and processes data by running or executing software programs and / or modules stored in the memory 302, and by calling data stored in the memory 302, thereby providing overall monitoring of the electronic device. Optionally, the processor 301 may include one or more processing cores; preferably, the processor 301 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 301.

[0103] The memory 302 can be used to store software programs and modules. The processor 301 executes various functional applications and gas demand forecasting methods based on user segmentation and model adaptation by running the software programs and modules stored in the memory 302. The memory 302 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created based on the use of electronic devices, etc. In addition, the memory 302 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 302 may also include a memory controller to provide the processor 301 with access to the memory 302.

[0104] The electronic device also includes a power supply 303 that supplies power to various components. Preferably, the power supply 303 can be logically connected to the processor 301 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 303 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0105] The electronic device may also include an input unit 304, which can be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.

[0106] Although not shown, the electronic device may also include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 301 in the electronic device loads the executable files corresponding to the processes of one or more applications into the memory 302 according to the following instructions, and the processor 301 runs the applications stored in the memory 302 to realize various functions, as follows: Obtain historical gas consumption data for each user within the target area; extract corresponding gas consumption profile features based on the historical gas consumption data of each user; perform cluster analysis based on the gas consumption profile features of all users to divide all users into at least one user group; determine the corresponding gas consumption prediction model based on the aggregated gas consumption data of each user group; predict the future gas consumption of each user group using the gas consumption prediction model corresponding to each user group; summarize the future gas consumption prediction results of each user group to obtain the overall gas consumption prediction result for the target area.

[0107] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.

[0108] This application embodiment, by clustering users according to their gas consumption profile characteristics, independently modeling and predicting each cluster, and then summarizing the data, can accurately capture the gas consumption patterns of different user groups, improve the accuracy and stability of gas demand forecasting in the target area, and meet the actual gas supply scheduling needs.

[0109] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.

[0110] To this end, embodiments of this application provide a storage medium storing a plurality of instructions that can be loaded by a processor to execute steps in any of the gas demand forecasting methods based on user segmentation and model adaptation provided in embodiments of this application. For example, the instructions can execute the following steps: Obtain historical gas consumption data for each user within the target area; extract corresponding gas consumption profile features based on the historical gas consumption data of each user; perform cluster analysis based on the gas consumption profile features of all users to divide all users into at least one user group; determine the corresponding gas consumption prediction model based on the aggregated gas consumption data of each user group; predict the future gas consumption of each user group using the gas consumption prediction model corresponding to each user group; summarize the future gas consumption prediction results of each user group to obtain the overall gas consumption prediction result for the target area.

[0111] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.

[0112] The storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0113] Since the instructions stored in the storage medium can execute the steps in any of the gas demand forecasting methods based on user segmentation and model adaptation provided in the embodiments of this application, the beneficial effects that any of the gas demand forecasting methods based on user segmentation and model adaptation provided in the embodiments of this application can achieve can be realized, as detailed in the preceding embodiments, and will not be repeated here.

[0114] The above provides a detailed description of a gas demand forecasting method and apparatus based on user segmentation and model adaptation provided in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A gas demand forecasting method based on user segmentation and model adaptation, characterized in that, include: Obtain historical gas consumption data for each user within the target area; Based on the historical gas consumption data of each user, extract the corresponding gas consumption profile features; Cluster analysis was performed based on the gas usage profile characteristics of all users to divide all users into at least one user group; Based on the aggregated gas consumption data of each user group, a corresponding gas consumption prediction model is determined. Using the gas consumption prediction model corresponding to each user group, the future gas consumption of each user group is predicted respectively; By summarizing the future gas consumption forecasts for each user group, the overall gas consumption forecast for the target area is obtained.

2. The gas demand forecasting method based on user segmentation and model adaptation according to claim 1, characterized in that, The clustering analysis based on the gas usage profile characteristics of all users divides all users into at least one user group, including: Based on the gas usage profile characteristics of all users, user grouping results are generated through clustering algorithms; Based on the user grouping results, the historical gas consumption data of users belonging to the same group are aggregated according to the time dimension to form the historical aggregated gas consumption sequence of each user group.

3. The gas demand forecasting method based on user segmentation and model adaptation according to claim 2, characterized in that, The step involves aggregating historical gas consumption data of users belonging to the same user group according to the time dimension, based on the user grouping results, to form historical aggregated gas consumption sequences for each user group, including: Obtain the membership degree of each user to each user segment; The user's gas consumption data is weighted according to the membership degree; The weighted gas consumption data is superimposed along the time dimension to generate the historical aggregated gas consumption sequence.

4. The gas demand forecasting method based on user segmentation and model adaptation according to claim 1, characterized in that, The step of determining the corresponding gas consumption prediction model based on the aggregated gas consumption data of each user group includes: Predefine a set of candidate prediction models for each user group; Based on the historical aggregated gas consumption sequences of user groups, each candidate prediction model is trained and validated using a rolling time window cross-validation method to obtain the validation results. Based on the verification results, one model is selected from the candidate prediction models as the gas consumption prediction model corresponding to the user group.

5. The gas demand forecasting method based on user segmentation and model adaptation according to claim 4, characterized in that, The step of determining the corresponding gas consumption prediction model based on the aggregated gas consumption data of each user group further includes: If the performance difference between the optimal candidate model and the second-best candidate model is less than a set threshold, then the ensemble weight is calculated based on the validation performance of the optimal candidate model and the second-best candidate model. The optimal candidate model and the second-best candidate model are weighted and fused based on the integrated weights, and the fused model is used as the gas consumption prediction model for user grouping.

6. The gas demand forecasting method based on user segmentation and model adaptation according to claim 1, characterized in that, The step of determining the corresponding gas consumption prediction model based on the aggregated gas consumption data of each user group includes: Calculate predefined clustering pattern metrics for the historical aggregated gas consumption sequence of each user cluster; The clustering pattern index is input into a pre-built model matching rule base to obtain the recommended prediction model type; Based on the recommended prediction model type, determine the gas consumption prediction model corresponding to the user group.

7. The gas demand forecasting method based on user segmentation and model adaptation according to claim 1, characterized in that, The step of using the gas consumption prediction model corresponding to each user group to predict the future gas consumption of each user group includes: Determine the future time granularity and the number of periods to be predicted; For each user segment, obtain the external influencing factor data corresponding to the prediction period; The historical aggregated gas consumption sequence of each user group and the corresponding external influencing factor data are input into the gas consumption prediction model determined by each user group to obtain the gas consumption sequence prediction result of each user group at the future time granularity. Output the gas consumption sequence prediction results for each user group, which include point prediction values ​​and prediction intervals.

8. The gas demand forecasting method based on user segmentation and model adaptation according to claim 7, characterized in that, The step of inputting the historical aggregated gas consumption sequence of each user group and the corresponding external influencing factor data into the gas consumption prediction model determined for each user group to obtain the gas consumption sequence prediction result of each user group at the future time granularity includes: Based on the historical aggregated gas consumption sequence and the corresponding external influencing factor data, a time series sample conforming to the input format of the gas consumption prediction model is constructed; The time series samples are input into the gas consumption prediction model, and a preliminary prediction sequence corresponding to the future time granularity is obtained through the forward calculation of the model. The preliminary prediction sequence is post-processed, and the post-processing includes at least one of the following operations: non-negation processing according to business rules, smoothing correction of abnormal prediction values ​​that exceed a preset threshold, and converting the prediction results to the target dimension. The post-processed prediction sequence is used as the prediction result of the gas consumption sequence corresponding to the user group.

9. The gas demand forecasting method based on user segmentation and model adaptation according to claim 1, characterized in that, The summarizing of future gas consumption forecasts for each user group yields the overall gas consumption forecast for the target area, including: The preliminary total gas consumption forecast is obtained by summing the future gas consumption forecasts for each user group. The preliminary total gas consumption forecast is calibrated to ensure that the final forecast meets the preset business constraints, thus obtaining the total gas consumption forecast result. The calibration process includes: Based on the historical total gas consumption data of the target area, an independent top-level gas consumption forecast value is generated; Using the top-level gas consumption prediction value as the target, the future gas consumption prediction values ​​of each user group are adjusted through an optimization algorithm so that the sum of the adjusted prediction values ​​of each user group is consistent with the top-level gas consumption prediction value. The sum of the adjusted predicted values ​​for each user group is taken as the final overall gas consumption prediction result.

10. A gas demand forecasting device based on user segmentation and model adaptation, characterized in that, include: The data acquisition module is used to acquire historical gas consumption data for each user within the target area; The feature extraction module is used to extract corresponding gas consumption profile features based on the historical gas consumption data of each user. The user segmentation module is used to perform cluster analysis based on the gas usage profile characteristics of all users, and to divide all users into at least one user segment. The model determination module is used to determine the corresponding gas consumption prediction model based on the aggregated gas consumption data of each user group. The prediction execution module is used to predict the future gas consumption of each user group using the gas consumption prediction model corresponding to each user group. The aggregation calibration module is used to aggregate the future gas consumption prediction results of each user group to obtain the overall gas consumption prediction result of the target area.