Training method and device for gas load prediction model

By calculating and sorting the similarity values ​​of the gas data sets, selecting the data sets with high similarity for horizontal joint learning, the problem of low accuracy of the gas load prediction model is solved, and accurate prediction and management support for urban gas companies is achieved.

CN113988434BActive Publication Date: 2024-12-13新奥新智科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111280086.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-28
Publication Date
2024-12-13
Estimated Expiration
2041-10-28

AI Technical Summary

Technical Problem

The existing gas load prediction model has low prediction accuracy and cannot provide urban gas companies with accurate scheduling management and operational control data, mainly due to the lack of sufficient sample data and the failure to consider the similarity of sample data.

Method used

By obtaining the gas data sets of the initiator and the participant, compute and sort the similarity values, select the data sets of the participant with high similarity for horizontal joint learning, and train the gas load prediction model.

Benefits of technology

The accuracy of the gas load prediction model is improved, accurate gas load prediction data is provided, and the scheduling management and operation control capabilities of urban gas companies are enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113988434B_ABST
    Figure CN113988434B_ABST
Patent Text Reader

Abstract

The present disclosure relates to the technical field of gas load prediction, and provides a method and device for training a gas load prediction model. The method comprises: in response to a gas load prediction request sent by a gas load prediction initiator, obtaining an initiator gas data set of the gas load prediction initiator and a participant gas data set of at least one gas load prediction participant; calculating the similarity value between the data in the initiator gas data set and the data in the participant gas data set, and sorting the similarity values ​​in ascending order to obtain a sorted data group; selecting any similarity value in the sorted data group and at least one similarity value that is less than and equal to any similarity value; determining to use at least one participant gas data set corresponding to at least one similarity value as joint learning data; horizontally combining the initiator gas data set and the joint learning data to train the gas load prediction model. The present disclosure improves the accuracy of the gas load prediction model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of gas load prediction, and in particular to a training method, device, electronic device and computer-readable storage medium for a gas load prediction model. Background Art

[0002] With the development of social economy and the improvement of people's living standards, the demand for energy is also increasing. As the reserves of traditional energy sources such as coal, oil, and natural gas are irreversibly decreasing, the supply of gas sources is becoming increasingly tight, which has shortened the gas procurement cycle of various enterprises, diversified gas sources, and increased prices. The demand for accurate prediction of gas load is becoming more and more urgent. Accurate prediction of gas load can not only improve the accuracy of gas volume planning and allocation, but also reduce the investment and cost of gas storage facilities and reduce the overall procurement cost.

[0003] In recent years, with the development of science and technology, the application of machine learning (ML) has become more and more extensive, especially the use of machine learning for gas load forecasting modeling, and the prediction of gas load based on the gas load forecasting model obtained by modeling. However, the existing gas load forecasting model not only lacks sufficient sample data, but also does not consider the similarity of the sample data to be combined when horizontally joint learning is performed on the sample data, resulting in low prediction accuracy of the gas load forecasting model, which cannot provide accurate gas load forecasting data for the dispatching management and operation control of urban gas companies. Summary of the invention

[0004] In view of this, the embodiments of the present disclosure provide a training method, device, electronic device and computer-readable storage medium for a gas load prediction model to solve the problem that the gas load prediction model in the prior art has low prediction accuracy and cannot provide accurate gas load prediction data for the dispatching management and operation control of urban gas companies.

[0005] According to a first aspect of an embodiment of the present disclosure, a method for training a gas load prediction model is provided, comprising: in response to a gas load prediction request sent by a gas load prediction initiator, obtaining an initiator gas data set of the gas load prediction initiator and a participant gas data set of at least one gas load prediction participant; calculating a similarity value between data in the initiator gas data set and data in the participant gas data set to obtain a similarity data group; sorting the similarity values ​​in the similarity data group in ascending order to obtain a sorted data group; selecting any similarity value in the sorted data group, and selecting at least one similarity value that is less than and equal to any similarity value from the sorted data group based on any similarity value; determining to use at least one participant gas data set corresponding to at least one similarity value as joint learning data; and based on horizontal joint learning, horizontally combining the initiator gas data set and the joint learning data to train the gas load prediction model.

[0006] According to a second aspect of an embodiment of the present disclosure, a training device for a gas load prediction model is provided, comprising: an acquisition module, configured to obtain, in response to a gas load prediction request sent by a gas load prediction initiator, a gas data set of the initiator of the gas load prediction and a participant gas data set of at least one gas load prediction participant; a calculation module, configured to calculate a similarity value between data in the initiator gas data set and data in the participant gas data set to obtain a similarity data group; a sorting module, configured to sort the similarity values ​​in the similarity data group in ascending order to obtain a sorted data group; a selection module, configured to select any similarity value in the sorted data group, and based on any similarity value, select at least one similarity value that is less than and equal to any similarity value from the sorted data group; a determination module, configured to determine to use at least one participant gas data set corresponding to at least one similarity value as joint learning data; and a training module, configured to train the gas load prediction model by horizontally combining the initiator gas data set and the joint learning data based on horizontal joint learning.

[0007] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.

[0008] According to a fourth aspect of the embodiments of the present disclosure, a computer-readable storage medium is provided, which stores a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.

[0009] Compared with the prior art, the embodiments of the present disclosure have the following beneficial effects: by responding to a gas load forecasting request sent by a gas load forecasting initiator, obtaining an initiator gas data set of the gas load forecasting initiator and a participant gas data set of at least one gas load forecasting participant; calculating the similarity value between the data in the initiator gas data set and the data in the participant gas data set to obtain a similarity data group; sorting the similarity values ​​in the similarity data group in ascending order to obtain a sorted data group; selecting any similarity value in the sorted data group, and selecting at least one similarity value that is less than and equal to any similarity value from the sorted data group based on any similarity value; determining to use at least one participant gas data set corresponding to at least one similarity value as joint learning data; based on horizontal joint learning, horizontally combining the initiator gas data set and the joint learning data to train the gas load forecasting model, which can improve the accuracy of the gas load forecasting model, thereby providing accurate gas load forecasting data for the dispatching management and operation control of the urban gas company. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0011] Figure 1 is a schematic diagram of a joint learning architecture of an embodiment of the present disclosure;

[0012] Figure 2 It is a flowchart of a method for training a gas load prediction model provided by an embodiment of the present disclosure;

[0013] Figure 3 It is a flowchart of another gas load prediction model training method provided by an embodiment of the present disclosure;

[0014] Figure 4 It is a structural schematic diagram of a training device for a gas load prediction model provided by an embodiment of the present disclosure;

[0015] Figure 5 It is a structural schematic diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION

[0016] In the following description, specific details such as specific system structures and technologies are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present disclosure. However, it should be clear to those skilled in the art that the present disclosure may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid obstructing the description of the present disclosure with unnecessary details.

[0017] In addition, persons of ordinary skill in the art will appreciate that the drawings provided herein are for illustration purposes and are not necessarily drawn to scale.

[0018] Unless the context clearly requires otherwise, throughout the specification and claims, the words "include", "comprising" and similar words should be interpreted in an inclusive sense rather than an exclusive or exhaustive sense; that is, in the sense of "including but not limited to".

[0019] In the description of the present disclosure, it should be understood that the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In addition, in the description of the present disclosure, unless otherwise specified, the meaning of "plurality" is two or more.

[0020] As part of urban energy, gas is affected by the structural changes in the types of urban energy demand. For example, replacing gas with electricity will significantly change traditional gas consumption indicators, gas unevenness coefficient and other gas load parameters. All these changes will change the state and law of gas load in terms of quantity and nature. The purpose of accurate prediction of gas load is to improve the scientific decision-making of urban gas sources, the rational planning of gas pipelines and the optimal scheduling of gas operation, so as to improve the reliability of gas supply and better play the investment benefits of urban gas facilities. The core issue of gas load prediction is to use existing historical data (for example, historical load operation data, corresponding meteorological data, etc.) and use appropriate mathematical prediction models to estimate the load value of the prediction object. Therefore, the complete reliability of historical data and the feasibility of prediction methods and corresponding means are two conditions required for effective gas load prediction.

[0021] In the field of gas load forecasting, gas data is distributed in different city gas companies, forming data islands, and federated learning is a good way to solve data islands. Federated Learning (FL), also known as federated learning or alliance learning, is a distributed machine learning technology or a machine learning framework. Its goal is to achieve joint modeling on the basis of ensuring data privacy and legal compliance, thereby improving the effect of artificial intelligence (AI) models. Federated learning can be divided into three categories according to the distribution of data sources of the participating parties: horizontal federated learning, vertical federated learning, and joint transfer learning. Horizontal federated learning is the union of samples, which is suitable for scenarios with many overlapping features and few overlapping users; vertical federated learning is the union of features, which is suitable for scenarios with many overlapping users and few overlapping features; joint transfer learning is mainly suitable for scenarios with deep neural networks as the base model, that is, it is suitable for scenarios with few overlapping features and users.

[0022] In the process of gas load forecasting, the initiator may have insufficient sample data when training the model due to cold start and other reasons, which further leads to inaccurate establishment of the gas load forecasting model. Therefore, it is impossible to provide accurate gas load forecasting data for the dispatching management and operation control of the city gas company. In addition, in order to improve the prediction accuracy of the gas load forecasting model, the amount of sample data is increased through horizontal joint learning. However, when the data is horizontally joined, only the sample data is fully joined, partially joined or randomly joined, and the similarity of the sample data to be joined is not considered, resulting in poor prediction accuracy of the gas load forecasting model and inaccurate prediction results.

[0023] It can be seen that the current model training method cannot obtain enough sample data, and cannot judge the similarity of the obtained sample data, so it is impossible to screen out effective sample data with high similarity. Therefore, it is necessary to provide a solution that can screen sample data based on data similarity to optimize sample data, improve modeling quality, and improve prediction accuracy.

[0024] A method and device for training a gas load prediction model according to an embodiment of the present disclosure will be described in detail below with reference to the accompanying drawings.

[0025] Federated learning refers to the comprehensive use of various AI (Artificial Intelligence) technologies to jointly explore the value of data and give rise to new intelligent formats and models based on joint modeling, while ensuring data security and user privacy. Federated learning has at least the following characteristics:

[0026] (1) A weakly centralized joint training model in which participating nodes control their own data to ensure data privacy and security in the process of co-creating intelligence.

[0027] (2) In different application scenarios, we use screening and / or combination of AI algorithms and privacy-preserving computing to establish multiple model aggregation optimization strategies to obtain high-level, high-quality models.

[0028] (3) Under the premise of ensuring data security and user privacy, methods to improve the performance of the federated learning engine are obtained based on multiple model aggregation optimization strategies. The performance method can be achieved by solving problems including computing architecture parallelism, information interaction in large-scale cross-domain networks, intelligent perception, and exception handling mechanisms to improve the overall performance of the federated learning engine.

[0029] (4) Obtain the needs of multiple users in each scenario, determine a reasonable assessment of the true contribution of each joint participant through a mutual trust mechanism, and distribute incentives.

[0030] Based on the above methods, we can establish an AI technology ecosystem based on federated learning, give full play to the value of industry data, and promote the implementation of scenarios in vertical fields.

[0031] Figure 1 Schematic diagram of a joint learning architecture of an embodiment of the present disclosure. Figure 1 As shown, the architecture of the federated learning may include a server (central node) 101 and participants 102 , 103 , and 104 .

[0032] In the joint learning process, the basic model can be established by the server 101, and the server 101 sends the model to the participants 102, 103, and 104 with which the communication connection is established. The basic model can also be uploaded to the server 101 by any participant after establishment, and the server 101 sends the model to other participants with which the communication connection is established. The participants 102, 103, and 104 build the model according to the downloaded basic structure and model parameters, use local data to train the model, obtain updated model parameters, and encrypt and upload the updated model parameters to the server 101. The server 101 aggregates the model parameters sent by the participants 102, 103, and 104 to obtain the global model parameters, and transmits the global model parameters back to the participants 102, 103, and 104. The participants 102, 103, and 104 iterate their respective models according to the received global model parameters until the model finally converges, thereby realizing the training of the model. During the joint learning process, the data uploaded by participants 102, 103 and 104 are model parameters, local data will not be uploaded to server 101, and all participants can share the final model parameters, so joint modeling can be achieved while ensuring data privacy.

[0033] It should be noted that the number of participants is not limited to three as described above, but can be set as needed, and the embodiments of the present disclosure do not limit this.

[0034] Figure 2 It is a flowchart of a method for training a gas load prediction model provided in an embodiment of the present disclosure. Figure 2 The training method of the gas load prediction model can be executed by a server or a terminal device. Figure 2 As shown, the training method of the gas load prediction model includes:

[0035] S201, in response to a gas load forecasting request sent by a gas load forecasting initiator, obtaining an initiator gas data set of the gas load forecasting initiator and a participant gas data set of at least one gas load forecasting participant;

[0036] S202, calculating the similarity value between the data in the gas data set of the initiator and the data in the gas data set of the participant to obtain a similarity data group;

[0037] S203, sorting the similarity values ​​in the similarity data group in ascending order to obtain a sorted data group;

[0038] S204, selecting any similarity value in the sorted data group, and based on any similarity value, selecting at least one similarity value less than and equal to any similarity value from the sorted data group;

[0039] S205, determining to use at least one gas data set of a participating party corresponding to at least one similarity value as joint learning data;

[0040] S206, based on horizontal joint learning, horizontally combine the initiator's gas data set and the joint learning data to train the gas load prediction model.

[0041] Specifically, taking the server as an example, after receiving the gas load prediction request sent by the initiator of the gas load prediction, the server obtains the initiator gas data set of the gas load prediction initiator and the participant gas data set of at least one gas load prediction participant, and performs similarity calculation on the data in the initiator gas data set and the data in the participant gas data set to obtain a similarity data group containing multiple similarity values; the server sorts the multiple similarity values ​​in the similarity data group in ascending order to obtain a sorted data group containing multiple similarity values, and selects any similarity value and at least one similarity value that is less than and equal to any similarity value from the multiple similarity values ​​in the sorted data group; further, the server determines to use at least one participant gas data set corresponding to at least one similarity value as joint learning data, and based on horizontal joint learning, horizontally combines the initiator gas data set and the joint learning data to train the gas load prediction model.

[0042] Here, the server may be a server that provides various services, for example, a background server that receives a request sent by a terminal device that establishes a communication connection with it, and the background server may receive and analyze the request sent by the terminal device, and generate a processing result. The server may be a single server, or a server cluster consisting of several servers, or a cloud computing service center, and the embodiments of the present disclosure do not limit this. Furthermore, the server may be hardware or software. When the server is hardware, it may be various electronic devices that provide various services to the terminal device. When the server is software, it may be multiple software or software modules that provide various services to the terminal device, or it may be a single software or software module that provides various services to the terminal device, and the embodiments of the present disclosure do not limit this. It should be noted that the specific type, quantity and combination of the server can be adjusted according to the actual needs of the application scenario, and the embodiments of the present disclosure do not limit this.

[0043] The terminal device can be hardware or software. When the terminal device is hardware, it can be various electronic devices with a display screen and supporting communication with a server, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers; when the terminal device is software, it can be installed in the electronic devices described above. The terminal device can be implemented as multiple software or software modules, or as a single software or software module, and the embodiments of the present disclosure do not limit this.

[0044] The research on gas load forecasting relies on the periodicity, trend, randomness and other characteristics of natural gas. There are many factors that affect gas load, such as weather, temperature, humidity, visibility, dew point, air pressure, wind speed, holidays, seasons, population, residents' living standards, living habits, energy policies, and social and economic development levels.

[0045] The initiator of the gas load forecast is the initiator of the gas load forecast, that is, the party that initiates the gas load forecast request according to the gas consumption characteristics of different application scenarios and / or different forecast periods; the gas load forecast participant is the participant of the gas load forecast, that is, the party that participates in the joint modeling and provides the corresponding gas data set in response to the gas load forecast request of the initiator. It should be noted that the gas load forecast initiator and the gas load forecast participant can be located in the same area or in different areas, and the embodiment of the present disclosure does not limit this. For example, the gas load forecast initiator can be Beijing Gas Company, Shanghai Gas Company, Beijing Gas Company Chaoyang District Service Outlet, etc., and the gas load forecast participant can be Tianjin Gas Company, Shijiazhuang Gas Company, Shenzhen Gas Company, Beijing Gas Company Haidian District Service Outlet, etc. In addition, it should be noted that the embodiment of the present disclosure does not limit the number of gas load forecast participants. For example, the number of gas load forecast participants can be one, two, three or more.

[0046] The initiator's gas data set and the participant's gas data set are time series data (TSD), that is, time series data, which is a data column recorded in chronological order for the same unified indicator. Each data in the same data column must be of the same caliber and must be comparable. Time series data can be a period number or a time point number. The purpose of time series analysis is to construct a time series model and perform out-of-sample prediction by finding the statistical characteristics and development regularity of the time series within the sample. Furthermore, the initiator's gas data set and the participant's gas data set may include but are not limited to the weather, temperature, humidity, visibility, dew point, air pressure, wind speed, holidays, seasons, population, residents' living standards, living habits, energy policies, social and economic development levels, etc. as described above. The selected gas data set depends on the gas usage characteristics of the initiator of the gas load forecast in different application scenarios and / or different forecast periods. For example, the initiator's gas data set may be shown in Table 1 below.

[0047] date Gas consumption 20210905 1 20210906 2 20210907 3 20210908 2

[0048] Table 1

[0049] A similarity data set refers to a data set consisting of a plurality of similarity data (i.e., similarity values). A sorted data set refers to a data set obtained by sorting a plurality of similarity values ​​in the similarity data set in an ascending order. It should be noted that the sorting method of the plurality of similarity values ​​in the sorted data set is not limited to the ascending order as described above, for example, it may also be in a descending order.

[0050] Federated learning is a machine learning framework that can effectively help multiple institutions use data and conduct machine learning modeling while meeting the requirements of user privacy protection, data security and government regulations. As a distributed machine learning paradigm, federated learning can effectively solve the problem of data silos, allowing participants to jointly model without sharing data, which can technically break data silos and achieve AI collaboration. Federated learning defines a machine learning framework, under which virtual models are designed to solve the problem of different data owners collaborating without exchanging data. The virtual model is the optimal model for all parties to aggregate data together, and each region serves local goals based on the model. Federated learning requires that the modeling result should be infinitely close to the traditional model, that is, the result of aggregating the data of multiple data owners in one place for modeling. Under the federation mechanism, the identity and status of each participant are the same, and a shared data strategy can be established. Since the data is not transferred, user privacy will not be leaked or data specifications will not be affected. In order to protect data privacy and meet legal and compliance requirements.

[0051] Federated learning can be divided into three categories according to the distribution of data sources of the participating parties: horizontal federated learning, vertical federated learning, and joint transfer learning. Here, horizontal federated learning is when the user features of the two data sets overlap more and the users overlap less, the data sets are divided horizontally (i.e., user dimension), and the data with the same user features but different users are taken out for training; vertical federated learning is when the user overlap of the two data sets is more and the user features overlap less, the data sets are divided vertically (i.e., feature dimension), and the data with the same users but different user features are taken out for training; joint transfer learning is when the users and user features of the two data sets overlap less, the data is not divided, and transfer learning can be used to overcome the situation of insufficient data or labels. In the embodiment of the present disclosure, the federated learning is horizontal federated learning.

[0052] A model refers to a formalized expression of a practical problem or objective thing or law after abstraction, and is usually composed of three parts: objectives, variables, and relationships. Models may include, but are not limited to, mathematical models, program models, logical models, structural models, method models, analysis models, prediction models, management models, data models, system models, etc. In the embodiment of the present disclosure, the model may be a gas load prediction model, which may include any one of a linear regression model, a support vector regression model, and an XGBoost model.

[0053] It should be noted that the gas load prediction model of the embodiment of the present disclosure is not limited to the linear regression model, support vector regression model and XGBoost model described above. For example, it can also be a logistic regression model (LogisticRegression Model), a polynomial regression model (Polynomial Regression Model), a stepwise regression model (Stepwise Regression Model), a ridge regression model (Ridge Regression Model), a lasso regression model (Lasso Regression Model) and an ElasticNet regression model, etc.

[0054] According to the technical solution provided by the embodiment of the present disclosure, by responding to the gas load forecasting request sent by the gas load forecasting initiator, the initiator gas data set of the gas load forecasting initiator and the participant gas data set of at least one gas load forecasting participant are obtained; the similarity value between the data in the initiator gas data set and the data in the participant gas data set is calculated to obtain a similarity data group; the similarity values ​​in the similarity data group are sorted in ascending order to obtain a sorted data group; any similarity value in the sorted data group is selected, and based on any similarity value, at least one similarity value that is less than and equal to any similarity value is selected from the sorted data group; at least one participant gas data set corresponding to at least one similarity value is determined to be used as joint learning data; based on horizontal joint learning, the initiator gas data set and the joint learning data are horizontally combined to train the gas load forecasting model, which can improve the accuracy of the gas load forecasting model, thereby providing accurate gas load forecasting data for the dispatching management and operation control of the urban gas company.

[0055] In some embodiments, a similarity value between data in an initiator's gas data set and data in a participant's gas data set is calculated to obtain a similarity data group, including: performing feature extraction on the initiator's gas data set and the participant's gas data set respectively to obtain a feature vector of the initiator's gas data set and a feature vector of the participant's gas data set; calculating the distance between the feature vector of the initiator's gas data set and the feature vector of the participant's gas data set, and using the distance as the similarity value between the initiator's gas data set and the participant's gas data set to obtain a similarity data group.

[0056] Specifically, feature extraction is the conversion of raw features into a set of features with obvious physical or statistical meaning or kernel. In machine learning, pattern recognition and image processing, feature extraction starts with an initial set of measurement data and establishes derived values ​​(features) designed to provide information and non-redundant information, thereby facilitating subsequent learning and generalization steps, and in some cases bringing better interpretability. Feature extraction is related to dimensionality reduction, and the quality of features has a crucial impact on generalization ability. Feature extraction methods may include but are not limited to principal component analysis (PCA), linear discriminant analysis (LDA), independent component analysis (ICA), latent semantic indexing (LSI), etc. Furthermore, feature extraction will obtain a new feature space through data conversion or data mapping. Taking the initiator gas data set in Table 1 as an example, assuming that the feature selection is the gas consumption in the previous three days, the initiator gas data set (one-dimensional time series data) is feature extracted, and the feature vector (multi-dimensional feature vector) of the initiator gas data set is [1, 2, 3] and [2, 3, 2], that is, two training data (sample data) can be constructed.

[0057] Similarity (vector similarity) refers to the similarity measurement between different samples. The method usually adopted is to calculate the "distance" between sample data. It should be understood that the closer the distance between two vectors, the greater the similarity. In the embodiment of the present disclosure, the "distance" between sample data refers to the distance between the feature vector of the initiator's gas data set and the feature vector of at least one participating party's gas data set, that is, the similarity value.

[0058] In some embodiments, calculating the distance between the feature vector of the initiator's gas data set and the feature vector of the participant's gas data set includes: using a distance formula to calculate the distance between the feature vector of the initiator's gas data set and the feature vector of the participant's gas data set, wherein the distance formula includes any one of a Euclidean distance formula, a Manhattan distance formula, a Mahalanobis distance formula, and a cosine distance formula.

[0059] Specifically, the vector similarity can be calculated by any distance formula among Euclidean distance, Manhattan distance, Chebyshev distance, Standardized Euclidean distance, Mahalanobis distance, Cosine, Hamming distance, Jaccard Similarity Coefficient or Jaccard distance, Pearson Correlation Coefficient (PCC), etc. Preferably, in the embodiment of the present disclosure, the distance formula is the Euclidean distance formula.

[0060] Euclidean distance, also known as Euclidean metric or Euclidean distance, refers to the true distance between two points in m-dimensional space, or the natural length of a vector (i.e., the distance from the point to the origin). Euclidean distance is the most common distance metric, which measures the absolute distance between two points in multidimensional space. Euclidean distance can reflect the absolute difference of individual values, and is more used in analysis that needs to reflect the difference from the numerical size of the dimension, such as using user behavior indicators to evaluate user similarity and difference.

[0061] The Euclidean distance in two-dimensional and three-dimensional space is the actual distance between two points. The Euclidean distance formula in n-dimensional space is as follows:

[0062]

[0063] Where x=(x1,...,x n ), y=(y1,...,y n ), n is a positive integer greater than or equal to 1.

[0064] In some embodiments, any similarity value in the sorted data group is selected, and based on any similarity value, at least one similarity value that is less than and equal to any similarity value is selected from the sorted data group, including: selecting a corresponding similarity value from the sorted data group according to the gas usage characteristics of the gas load forecast initiator in different application scenarios and / or different forecast periods; based on the similarity value, selecting at least one similarity value that is less than and equal to the similarity value from the sorted data group.

[0065] Specifically, different categories of users have different gas usage patterns; users of the same category have different gas usage patterns in different application scenarios, for example, users in different regions; even users of the same category have different gas usage patterns when predicted in different periods in the same application scenario. Different prediction periods can be, for example, hours, days, weeks, months, years, etc., which are not limited in the embodiments of the present disclosure.

[0066] In the case where at least one similarity value includes multiple similarity values, the multiple similarity values ​​can be sorted in ascending order; when one similarity value among the multiple similarity values ​​is selected, the second gas data set corresponding to all similarity values ​​less than and equal to the similarity value can be used as joint learning data.

[0067] It should be noted that the method of sorting multiple similarity values ​​is not limited to the order from small to large as described above. For example, multiple similarity values ​​can also be sorted in order from large to small. In addition, it should be noted that a similarity value can be selected according to actual needs, and the second gas data set corresponding to all similarity values ​​that are less than or equal to the similarity value, greater than or equal to the similarity value, or greater than and equal to the similarity value is used as joint learning data.

[0068] In some embodiments, based on horizontal joint learning, the gas data set of the horizontal joint initiator and the joint learning data are used to train the gas load prediction model, including: based on horizontal joint learning, the gas data set of the horizontal joint initiator and the joint learning data are used to obtain horizontal joint data; the horizontal joint data are input into the gas load prediction model, and the gas load prediction model is trained through a machine learning algorithm.

[0069] Specifically, machine learning is a multi-disciplinary subject that involves probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory, etc. It specializes in studying how computers simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance.

[0070] Machine learning algorithms can be divided into three categories: supervised learning (SL), unsupervised learning (UL), and reinforcement learning (RL). Here, supervised learning can be used for a specific data set (training set) with a certain attribute (label), but other data do not have labels or need to predict labels. Unsupervised learning can be used for a given unlabeled data set (the data is not pre-assigned), and the purpose is to find the potential relationship between the data. Reinforcement learning is between the two, and each prediction has some form of feedback, but there is no precise label or error information.

[0071] Furthermore, supervised learning may include but is not limited to decision trees, naive Bayesian classification, ordinary least squares regression, logistic regression, support vector machine (SVM), ensemble methods, etc. Unsupervised learning may include but is not limited to clustering algorithms, principal component analysis (PCA), singular value decomposition (SVD), and independent component analysis (ICA).

[0072] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present application, which will not be described one by one here.

[0073] Figure 3 It is a flowchart of another gas load prediction model training method provided in an embodiment of the present disclosure. Figure 3 The training method of the gas load prediction model can be executed by a server or a terminal device. Figure 3 As shown, the training method of the gas load prediction model includes:

[0074] S301, receiving a gas load forecasting request sent by a gas load forecasting initiator, where the gas load forecasting request is used to request a forecast of the gas load at a certain moment;

[0075] S302, in response to a gas load forecasting request, obtaining a gas data set of an initiator of the gas load forecasting initiator and a participant gas data set of at least one gas load forecasting participant;

[0076] S303, extracting features from the initiator's gas data set and the participant's gas data set to obtain feature vectors of the initiator's gas data set and feature vectors of the participant's gas data set;

[0077] S304, using a distance formula to calculate the distance between the feature vector of the initiator's gas data set and the feature vector of the participant's gas data set;

[0078] S305, using the distance as the similarity value between the initiator's gas data set and the participant's gas data set to obtain a similarity data set;

[0079] S306, sorting the similarity values ​​in the similarity data group in ascending order to obtain a sorted data group;

[0080] S307, selecting corresponding similarity values ​​from the sorted data group according to the gas usage characteristics of the gas load forecast initiator in different application scenarios and / or different forecast periods;

[0081] S308, based on the similarity value, selecting at least one similarity value less than and equal to the similarity value from the sorted data group;

[0082] S309, determining to use at least one gas data set of a participating party corresponding to at least one similarity value as joint learning data;

[0083] S310, obtaining horizontal joint data based on the horizontal joint learning horizontal joint initiator gas data set and the joint learning data;

[0084] S311, input the horizontal joint data into the gas load prediction model, and train the gas load prediction model through a machine learning algorithm.

[0085] Specifically, upon receiving a gas load prediction request sent by a gas load prediction initiator for requesting a prediction of the gas load at a certain moment, the server responds to the gas load prediction request and obtains the initiator gas data set of the gas load prediction initiator and the participant gas data set of at least one gas load prediction participant; subsequently, the server performs feature extraction on the initiator gas data set and the participant gas data set respectively to obtain a feature vector of the initiator gas data set and a feature vector of the participant gas data set, and uses a distance formula to calculate the distance between the feature vector of the initiator gas data set and the feature vector of the participant gas data set; further, the server uses the distance as a similarity value between the initiator gas data set and the participant gas data set to obtain a similarity. data group, and sorts the similarity values ​​in the similarity data group in ascending order to obtain a sorted data group; further, the server selects corresponding similarity values ​​from the sorted data group according to the gas usage characteristics of the gas load forecast initiator in different application scenarios and / or different forecast periods, and selects at least one similarity value less than and equal to the similarity value from the sorted data group based on the similarity value; finally, the server determines to use at least one participating party gas data set corresponding to at least one similarity value as joint learning data, and based on horizontal joint learning, horizontally combines the initiator's gas data set and the joint learning data to obtain horizontal joint data, and inputs the horizontal joint data into the gas load forecasting model, and trains the gas load forecasting model through a machine learning algorithm.

[0086] According to the technical solution provided by the embodiment of the present disclosure, by calculating the similarity between the initiator gas data set of the gas load forecast initiator and the participant gas data set of at least one gas load forecast participant, and selecting the participant gas data set with high similarity as the joint learning data, the quality of the sample data required for training the gas load forecast model can be improved, thereby improving the accuracy of the prediction results of the gas load forecast model, thereby improving the accuracy of the city gas company's gas volume plan formulation and allocation, reducing the investment and cost of gas storage facilities, and reducing the overall procurement cost.

[0087] The following describes in detail the training method of the gas load prediction model according to the embodiment of the present disclosure through specific examples.

[0088] Assume that the initiator of gas load forecasting is "Beijing Gas Company", and the feature vector obtained by feature extraction of its gas data set is x1 = [1, 2, 3]; the first participant of gas load forecasting is "Tianjin Gas Company", and the feature vectors obtained by feature extraction of its gas data set are x2 = [1.1, 2.1, 3.1] and x3 = [10, 300, 20]; the second participant of gas load forecasting is "Shijiazhuang Gas Company", and the feature vectors obtained by feature extraction of its gas data set are x4 = [2, 3, 4] and x5 = [200, 500, 200], then the Euclidean distance formula is used to calculate:

[0089]

[0090]

[0091]

[0092]

[0093] Among them, d 12 represents the distance between x1 and x2 (i.e., the similarity between the gas dataset of the initiator and the gas dataset of the first participant), d 13 represents the distance between x1 and x3, d 14 represents the distance between x1 and x4, d 15 Represents the distance between x1 and x5.

[0094] Furthermore, assuming that 0.17 is selected as the similarity value, the joint learning data for horizontal joint learning with x1 is x2; assuming that 1.73 is selected as the similarity value, the joint learning data for horizontal joint learning with x1 is x2 and x4; assuming that 298.62 is selected as the similarity value, the joint learning data for horizontal joint learning with x1 is x2, x3 and x4; assuming that 571.32 is selected as the similarity value, the joint learning data for horizontal joint learning with x1 is x2, x3, x4 and x5.

[0095] Finally, based on horizontal joint learning, x1 and x2, or x1, x2 and x4, or x1, x2, x3 and x4, or x1, x2, x3, x4 and x5 are horizontally combined, and the data after horizontal combination are input into the gas load prediction model as training samples, and the gas load prediction model is trained by the machine learning algorithm to obtain the trained gas load prediction model.

[0096] The following are embodiments of the device disclosed herein, which can be used to execute the method embodiments disclosed herein. For details not disclosed in the device embodiments disclosed herein, please refer to the method embodiments disclosed herein.

[0097] Figure 4 Schematic diagram of a gas load prediction model training device provided by an embodiment of the present disclosure. Figure 4 As shown, the training device of the gas load prediction model includes:

[0098] The acquisition module 401 is configured to acquire, in response to a gas load forecasting request sent by a gas load forecasting initiator, a gas data set of the initiator of the gas load forecasting initiator and a participant gas data set of at least one gas load forecasting participant;

[0099] The calculation module 402 is configured to calculate the similarity value between the data in the initiator's gas data set and the data in the participant's gas data set to obtain a similarity data group;

[0100] A sorting module 403 is configured to sort the similarity values ​​in the similarity data group in ascending order to obtain a sorted data group;

[0101] A selection module 404 is configured to select any similarity value in the sorted data set, and based on any similarity value, select at least one similarity value from the sorted data set that is less than and equal to any similarity value;

[0102] A determination module 405 is configured to determine to use at least one gas data set of a participant corresponding to at least one similarity value as joint learning data;

[0103] The training module 406 is configured to train the gas load prediction model based on horizontal joint learning, horizontal joint initiator gas data set and joint learning data.

[0104] According to the technical solution provided by the embodiment of the present disclosure, by responding to the gas load forecasting request sent by the gas load forecasting initiator, the initiator gas data set of the gas load forecasting initiator and the participant gas data set of at least one gas load forecasting participant are obtained; the similarity value between the data in the initiator gas data set and the data in the participant gas data set is calculated to obtain a similarity data group; the similarity values ​​in the similarity data group are sorted in ascending order to obtain a sorted data group; any similarity value in the sorted data group is selected, and based on any similarity value, at least one similarity value that is less than and equal to any similarity value is selected from the sorted data group; at least one participant gas data set corresponding to at least one similarity value is determined to be used as joint learning data; based on horizontal joint learning, the initiator gas data set and the joint learning data are horizontally combined to train the gas load forecasting model, which can improve the accuracy of the gas load forecasting model, thereby providing accurate gas load forecasting data for the dispatching management and operation control of the urban gas company.

[0105] In some embodiments, Figure 4 The calculation module 402 extracts features from the initiator's gas data set and the participant's gas data set respectively to obtain a feature vector of the initiator's gas data set and a feature vector of the participant's gas data set; calculates the distance between the feature vector of the initiator's gas data set and the feature vector of the participant's gas data set, and uses the distance as a similarity value between the initiator's gas data set and the participant's gas data set to obtain a similarity data set.

[0106] In some embodiments, Figure 4 The calculation module 402 calculates the distance between the feature vector of the initiator's gas data set and the feature vector of the participant's gas data set using a distance formula, wherein the distance formula includes any one of a Euclidean distance formula, a Manhattan distance formula, a Mahalanobis distance formula, and a cosine distance formula.

[0107] In some embodiments, the distance formula is a Euclidean distance formula.

[0108] In some embodiments, Figure 4 The selection module 404 selects corresponding similarity values ​​from the sorted data group according to the gas usage characteristics of the gas load forecast initiator in different application scenarios and / or different forecast periods; based on the similarity value, selects at least one similarity value less than and equal to the similarity value from the sorted data group.

[0109] In some embodiments, Figure 4The training module 406 is based on horizontal joint learning, horizontally combines the initiator's gas data set and the joint learning data to obtain horizontal joint data; inputs the horizontal joint data into the gas load prediction model, and trains the gas load prediction model through a machine learning algorithm.

[0110] In some embodiments, the gas load prediction model includes any one of a linear regression model, a support vector regression model, and an XGBoost model.

[0111] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present disclosure.

[0112] Figure 5 Schematic diagram of the structure of an electronic device 5 provided by an embodiment of the present disclosure. Figure 5 As shown, the electronic device 5 of this embodiment includes: a processor 501, a memory 502, and a computer program 503 stored in the memory 502 and executable on the processor 501. When the processor 501 executes the computer program 503, the steps in the above-mentioned method embodiments are implemented. Alternatively, when the processor 501 executes the computer program 503, the functions of the modules / units in the above-mentioned device embodiments are implemented.

[0113] Exemplarily, the computer program 503 may be divided into one or more modules / units, which are stored in the memory 502 and executed by the processor 501 to complete the present disclosure. The one or more modules / units may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program 503 in the electronic device 5.

[0114] The electronic device 5 may be a desktop computer, a notebook, a PDA, a cloud server, or other electronic device. The electronic device 5 may include, but is not limited to, a processor 501 and a memory 502. Those skilled in the art will appreciate that Figure 5 It is only an example of the electronic device 5 and does not constitute a limitation of the electronic device 5. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the electronic device may also include input and output devices, network access devices, buses, etc.

[0115] The processor 501 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.

[0116] The memory 502 may be an internal storage unit of the electronic device 5, for example, a hard disk or memory of the electronic device 5. The memory 502 may also be an external storage device of the electronic device 5, for example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 5. Further, the memory 502 may also include both an internal storage unit of the electronic device 5 and an external storage device. The memory 502 is used to store computer programs and other programs and data required by the electronic device. The memory 502 may also be used to temporarily store data that has been output or is to be output.

[0117] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0118] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0119] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this disclosure.

[0120] In the embodiments provided in the present disclosure, it should be understood that the disclosed devices / electronic devices and methods can be implemented in other ways. For example, the device / electronic device embodiments described above are merely schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation. Multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, indirect coupling or communication connection of devices or units, which may be electrical, mechanical or other forms.

[0121] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0122] In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0123] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present disclosure implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. The computer program may include computer program code, and the computer program code may be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electric carrier signals and telecommunication signals.

[0124] The above embodiments are only used to illustrate the technical solutions of the present disclosure, rather than to limit them. Although the present disclosure has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should all be included in the protection scope of the present disclosure.

Claims

1. A method for training a gas load prediction model, characterized in that: include: In response to a gas load forecasting request sent by a gas load forecasting initiator, obtaining an initiator gas data set of the gas load forecasting initiator and a participant gas data set of at least one gas load forecasting participant; Calculating the similarity value between the data in the initiator's gas data set and the data in the participant's gas data set to obtain a similarity data group; The similarity value is the distance between the feature vector of the initiator's gas data set and the feature vector of the participant's gas data set; Sorting the similarity values ​​in the similarity data group in ascending order to obtain a sorted data group; Selecting any similarity value in the sorted data set, and selecting at least one similarity value from the sorted data set that is less than and equal to the any similarity value based on the any similarity value; Determine to use at least one gas data set of a participating party corresponding to the at least one similarity value as joint learning data; Based on horizontal joint learning, the initiator gas data set and the joint learning data are horizontally combined to train the gas load prediction model.

2. The method according to claim 1, characterized in that: The calculating the similarity value between the data in the initiator's gas data set and the data in the participant's gas data set to obtain a similarity data group includes: Performing feature extraction on the initiator's gas data set and the participant's gas data set respectively to obtain a feature vector of the initiator's gas data set and a feature vector of the participant's gas data set; The distance between the feature vector of the initiator's gas data set and the feature vector of the participant's gas data set is calculated to obtain the similarity data set.

3. The method according to claim 2, characterized in that The calculating the distance between the feature vector of the initiator's gas data set and the feature vector of the participant's gas data set includes: The distance between the feature vector of the initiator's gas data set and the feature vector of the participant's gas data set is calculated using a distance formula, wherein the distance formula includes any one of a Euclidean distance formula, a Manhattan distance formula, a Mahalanobis distance formula, and a cosine distance formula.

4. The method according to claim 3, characterized in that: The distance formula is the Euclidean distance formula.

5. The method according to claim 1, characterized in that The selecting any similarity value in the sorted data set, and selecting at least one similarity value less than and equal to the any similarity value from the sorted data set based on the any similarity value, comprises: According to the gas usage characteristics of the gas load forecast initiator in different application scenarios and / or different forecast periods, selecting a corresponding similarity value from the sorted data group; Based on the similarity value, at least one similarity value less than and equal to the similarity value is selected from the sorted data set.

6. The method according to claim 1, characterized in that Based on the horizontal joint learning, horizontally combining the initiator gas data set and the joint learning data to train the gas load prediction model includes: Based on horizontal joint learning, horizontally combining the initiator gas data set and the joint learning data to obtain horizontal joint data; The horizontal joint data is input into the gas load prediction model, and the gas load prediction model is trained by a machine learning algorithm.

7. The method according to any one of claims 1 to 6, characterized in that The gas load prediction model includes any one of a linear regression model, a support vector regression model and an XGBoost model.

8. A training device for a gas load prediction model, characterized in that: include: An acquisition module is configured to acquire, in response to a gas load forecasting request sent by a gas load forecasting initiator, a gas data set of the gas load forecasting initiator and a participant gas data set of at least one gas load forecasting participant; A calculation module is configured to calculate a similarity value between the data in the initiator's gas data set and the data in the participant's gas data set to obtain a similarity data group; The similarity value is the distance between the feature vector of the initiator's gas data set and the feature vector of the participant's gas data set; A sorting module is configured to sort the similarity values ​​in the similarity data group in ascending order to obtain a sorted data group; a selection module configured to select any similarity value in the sorted data group, and select at least one similarity value less than and equal to the any similarity value from the sorted data group based on the any similarity value; A determination module is configured to determine to use at least one gas data set of a participant corresponding to the at least one similarity value as joint learning data; The training module is configured to horizontally combine the initiator gas data set and the joint learning data based on horizontal joint learning to train the gas load prediction model.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.