Neural network model training method and device, equipment and medium
By constructing a heterogeneous graph neural network and training the neural network model with a loss term based on physical laws, the instability and irrationality of existing models are solved, and the accuracy and consistency of prediction results are improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-25
- Publication Date
- 2026-03-10
AI Technical Summary
Existing neural network models lack physical consistency during training, have insufficient generalization ability, and cannot fully utilize physical knowledge, resulting in unstable and unreasonable prediction results.
By constructing a heterogeneous graph neural network, combining node datasets, boundary rules, and physical loss terms, and training it using a training sample set and loss function, physical laws are incorporated to improve the accuracy and stability of the model.
This improved the accuracy and rationality of neural network model training and time series calculation results, and enhanced the model's physical consistency and generalization ability.
Smart Images

Figure CN121638320A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of model training, in particular to a neural network model training method, a time series calculation method, device and equipment and medium. BACKGROUND
[0002] When modeling complex physical systems, existing neural networks mainly adopt a data-driven approach. The core idea is to minimize the error between the predicted value and the true value by continuously adjusting the model parameters, thereby completing the training of the model. When the amount of available data is sufficient, this method can indeed achieve good prediction accuracy to some extent.
[0003] However, this data-driven neural network model has exposed many problems that cannot be ignored in practical applications. First, the model lacks physical consistency: traditional neural network models often violate known physical laws, such as the law of conservation of energy and the law of conservation of mass, during prediction, making it difficult to provide a reasonable explanation for the prediction results in actual physical scenarios and unable to provide reliable theoretical support for actual physical processes. Second, the model's generalization ability is insufficient: a model that relies solely on historical data for learning often performs very unstable when faced with new working conditions or scenarios where data is missing. Due to the complexity and variability of real-world physical systems and working conditions, it is difficult for a model trained solely on historical data to make accurate predictions for new and unknown situations. Third, physical knowledge is underutilized: existing methods simply constrain physical quantities at the input or output of the neural network, lacking a systematic way to incorporate physical laws during model training, which limits the model's ability to utilize physical laws to assist in prediction when dealing with complex physical system problems, thereby limiting the model's modeling ability and prediction accuracy for complex physical systems.
[0004] In summary, the existing neural network model training method has the problem of poor accuracy and stability of the neural network model obtained by training, which further leads to poor correctness and rationality of the time series calculation results obtained by the neural network model. SUMMARY
[0005] The present application provides a neural network model training method, a time series calculation method, device and equipment and medium, which can solve the problem of poor accuracy and stability of the neural network model obtained by training in the existing neural network model training method, which further leads to poor correctness and rationality of the time series calculation results obtained by the neural network model.
[0006] In a first aspect, embodiments of the present invention provide a method for training a neural network model, the method comprising:
[0007] Construct a heterogeneous graph neural network based on a node dataset and at least one boundary rule;
[0008] Obtain a pre-set training sample set, a list of loss formulas, and at least one target prediction type;
[0009] The heterogeneous graph neural network is trained using the training sample set and the first loss function to obtain a first neural network model;
[0010] At least one physical loss term is obtained based on the list of loss formulas and the node dataset. The first neural network model is then trained based on the training sample set, each target prediction type, each physical loss term, and the second loss function to obtain the target neural network model.
[0011] Secondly, embodiments of the present invention provide a method for calculating time series data, the method comprising:
[0012] Obtain the node sequence dataset of the target physical system, at least one target boundary rule, and at least one target physical relationship;
[0013] Based on the node sequence dataset, the boundary rules of each target, and the physical relationships of each target, a target heterogeneous graph matching the target physical system is constructed.
[0014] The target heterogeneous graph and the node sequence dataset are input into the target neural network model trained by the method described in any one of claims 1-6 to obtain the time series calculation results of the target physical system matching.
[0015] Thirdly, embodiments of the present invention provide a training apparatus for a neural network model, the apparatus comprising:
[0016] A neural network building module for constructing heterogeneous graph neural networks based on a node dataset and at least one boundary rule;
[0017] The data acquisition module is used to acquire a pre-set training sample set, a list of loss formulas, and at least one target prediction type;
[0018] The first training module is used to train the heterogeneous graph neural network using the training sample set and the first loss function to obtain a first neural network model;
[0019] The second training module is used to obtain at least one physical loss term based on the list of loss formulas and the node dataset, and to train the first neural network model based on the training sample set, each target prediction type, each physical loss term and the second loss function to obtain the target neural network model.
[0020] Fourthly, embodiments of the present invention provide a time series computing device, the device comprising:
[0021] The system data acquisition module is used to acquire the node sequence dataset of the target physical system, at least one target boundary rule, and at least one target physical relationship.
[0022] The heterogeneous graph construction module is used to construct a target heterogeneous graph that matches the target physical system based on the node sequence dataset, each target boundary rule and each target physical relationship;
[0023] The model calculation module is used to input the target heterogeneous graph and the node sequence dataset into the target neural network model trained by a pre-configured method to obtain the time series calculation results of the target physical system matching.
[0024] Fifthly, embodiments of the present invention provide an electronic device, the electronic device comprising:
[0025] At least one processor; and
[0026] A memory communicatively connected to the at least one processor; wherein,
[0027] The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to execute a method for training a neural network model and a method for calculating a time series, as described in any embodiment of the present invention.
[0028] In a sixth aspect, embodiments of the present invention provide a computer-readable storage medium storing computer instructions, which are used to cause a processor to execute a method for training a neural network model and a method for calculating a time series as described in any embodiment of the present invention.
[0029] The technical solution of this invention involves constructing a heterogeneous graph neural network based on a node dataset and at least one boundary rule, obtaining a pre-set training sample set, a list of loss formulas, and at least one target prediction type, then training the heterogeneous graph neural network using the training sample set and a first loss function to obtain a first neural network model, obtaining at least one physical loss term based on the list of loss formulas and the node dataset, and training the first neural network model using the training sample set, each target prediction type, each physical loss term, and a second loss function to obtain a target neural network model, and finally obtaining a node sequence dataset of the target physical system, at least one target boundary rule, and at least one target physical... The relationship is established, and a target heterogeneous graph matching the target physical system is constructed based on the node sequence dataset, the boundary rules of each target, and the physical relationships of each target. Finally, the target heterogeneous graph and the node sequence dataset are input into the target neural network model trained in the above steps to obtain the time series calculation results matching the target physical system. This solves the problem that the accuracy and stability of the trained neural network model are poor in the existing neural network model training methods, which leads to poor correctness and rationality of the time series calculation results obtained by the neural network model. This method realizes the training of the neural network model and the calculation of the time series, and improves the correctness and rationality of the time series calculation results obtained by the neural network model.
[0030] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0031] To more clearly illustrate the technical solutions in the embodiments of the present invention, 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 the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0032] Figure 1 This is a flowchart of a training method for a neural network model according to Embodiment 1 of the present invention;
[0033] Figure 2 This is a flowchart of a time series calculation method provided according to Embodiment 2 of the present invention;
[0034] Figure 3 This is a schematic diagram of the structure of a training device for a neural network model according to Embodiment 3 of the present invention;
[0035] Figure 4 This is a schematic diagram of the structure of a time series computing device according to Embodiment 4 of the present invention;
[0036] Figure 5 This is a schematic diagram of the structure of an electronic device that implements a neural network model training method and a time series calculation method according to embodiments of the present invention. Detailed Implementation
[0037] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0038] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, any variations of the terms "comprising" and "having" are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0039] Example 1
[0040] Figure 1 This is a flowchart of a training method for a neural network model provided in Embodiment 1 of the present invention. This embodiment is applicable to the training of a neural network model using a physical loss term. The method can be executed by a training device for the neural network model, which can be implemented in hardware and / or software. The training device for the neural network model can be configured in a terminal or server with neural network model training function.
[0041] like Figure 1 As shown, the method includes:
[0042] S110. Construct a heterogeneous graph neural network based on the node dataset and at least one boundary rule.
[0043] The method of constructing a heterogeneous graph neural network based on a node dataset and at least one boundary rule includes: performing data cleaning operations on each node data in the node dataset based on a preset data cleaning rule to obtain a structured node dataset; obtaining at least one preset physical relationship that matches the structured node dataset, and obtaining each heterogeneous graph edge structure based on the structured node dataset and each physical relationship; and obtaining a heterogeneous graph neural network based on the structured node dataset and each heterogeneous graph edge structure.
[0044] The node dataset includes multi-dimensional information point data corresponding to each physical object in the target physical system, such as indoor temperature and humidity data corresponding to spatial objects in a building system, and operating power data corresponding to terminal equipment. Furthermore, the data cleaning rules can be set by the user in combination with the actual working conditions of the physical system, including removing outliers that exceed the reasonable range of physical quantities, filling missing data with interpolation methods based on physical laws, and removing duplicate and redundant data. Through the above operations, a structured node dataset with a unified format and reliable data is obtained, ensuring the effectiveness of subsequent modeling data.
[0045] Furthermore, a heterogeneous graph neural network is obtained based on the structured node dataset and each heterogeneous graph edge structure, including: clamping each structured node data in the structured node dataset based on each boundary rule to obtain each constrained node data that matches each boundary rule; performing topology pruning operation on each heterogeneous graph edge structure to obtain each constrained edge structure; and processing each constrained edge structure and each constrained node data using a pre-configured multi-object heterogeneous graph network to obtain the heterogeneous graph neural network.
[0046] The physical relationships are based on the interaction rules between objects extracted from known physical laws, such as the energy exchange relationship between spatial objects and fan coil units in a building system, and the flow distribution relationship between a cold source and terminal equipment. Each physical relationship corresponds to the interaction logic of different physical objects in the structured node dataset. The boundary rules are a set of rules formulated based on the physical constraints of complex physical systems, covering the boundary thresholds of physical quantities and the known physical quantity relationships on the system boundary. Furthermore, based on the types and data characteristics of each physical object contained in the structured node dataset, they are matched and associated with each physical relationship. Object nodes with physical interactions are connected through edge structures to obtain the edge structures of each heterogeneous graph, so that the edge structures can accurately represent the actual interaction relationships between physical objects.
[0047] In this embodiment, a heterogeneous graph neural network is obtained based on a structured node dataset and various heterogeneous graph edge structures. Specifically, this includes: First, clamping the structured node data in the structured node dataset based on boundary rules. This clamping process involves adjusting node data that exceeds the physical quantity constraints set in the boundary rules to ensure the node data conforms to physical rationality and feasibility. For example, clamping indoor building temperature data within the reasonable range of -10℃ to 50℃ under actual working conditions. This results in constrained node data matching the boundary rules. Next, a topology pruning operation is performed on each heterogeneous graph edge structure. This topology pruning operation is based on the validity and necessity of physical relationships, eliminating redundant edge structures that lack real physical interaction or do not conform to physical laws. For example, removing edge connections between two physical objects without energy exchange or matter transfer, while retaining edge structures corresponding to core physical interactions and optimizing their connection topology. This results in constrained edge structures, ensuring that the topological relationships of the edge structures are consistent with the actual interaction logic of the physical system. Finally, a pre-configured multi-object heterogeneous graph network is used to process each constrained edge structure and each constrained node data. Accordingly, in this embodiment, the multi-object heterogeneous graph network is used to simultaneously capture the feature information of the node data and the physical interaction features corresponding to the edge structure. The weight allocation logic of physical relationships is incorporated into the convolution operation. Through multi-layer feature extraction and fusion, a heterogeneous graph neural network that can accurately represent the object characteristics, interaction relationships and physical constraints in a complex physical system is finally obtained. This provides a reliable network foundation for introducing physical knowledge and improving the physical consistency and generalization ability of the model in subsequent phased training.
[0048] S120. Obtain a pre-set training sample set, a list of loss formulas, and at least one target prediction type.
[0049] The pre-set training sample set is a time series dataset constructed based on the historical operating data of complex physical systems. It includes the feature data and corresponding labels of each node in the multi-object heterogeneous graph at continuous time steps. For example, in the building energy system scenario, the sample set may contain node data such as indoor temperature, terminal equipment power, and cold source water supply collected every 15 minutes within 24 hours every day.
[0050] Furthermore, the loss formula list is a set of formulas pre-organized based on the physical laws and constraints involved in the complex physical system. Each formula in the loss formula list is pre-labeled with the applicable data type (such as temperature, flow rate, energy), applicable conditions, and physical dimensions, providing a clear basis for subsequent matching of physical loss terms.
[0051] Furthermore, the target prediction type is used to determine the model output direction based on the user's actual application needs. For example, in the field of construction, target prediction types such as building hourly energy consumption prediction can be set to ensure that subsequent model training always revolves around actual business needs.
[0052] S130. The heterogeneous graph neural network is trained using the training sample set and the first loss function to obtain a first neural network model.
[0053] The first loss function can be specifically a mean squared error function; further, the heterogeneous graph neural network is a deep learning model adapted to heterogeneous graph data, used to process heterogeneous graph data with diverse node and edge types, complex system physical knowledge and related feature data to obtain time series prediction results.
[0054] S140. Obtain at least one physical loss term based on the loss formula list and node dataset, and train the first neural network model based on the training sample set, each target prediction type, each physical loss term and the second loss function to obtain the target neural network model.
[0055] The process of obtaining at least one physical loss term based on the loss formula list and the node dataset includes: parsing the node dataset to obtain at least one data type that matches each node data; obtaining a pre-configured loss formula list and a target prediction type; and searching the loss formula list for at least one physical loss term and a target loss formula that matches the physical loss term based on each data type and each target prediction type.
[0056] For example, the process of obtaining at least one physical loss item based on the loss formula list and node dataset is as follows: First, the node dataset is parsed. The node dataset contains multi-dimensional time-series data of all nodes in the heterogeneous graph. By parsing the node data of each node, the physical attributes of each node's data are identified, and at least one data type matching each node's data is obtained. For example, the 25℃ data of a spatial node is labeled as temperature data, the 5kW data of a terminal device is labeled as power data, and the 10m³ / h data of a cold source is labeled as flow data. Simultaneously, the unit of measurement, acquisition frequency, and data integrity of each data type are recorded. Second, a pre-configured loss formula list and target prediction type are obtained. Based on the correspondence between each data type and each target prediction type, a suitable formula is searched in the loss formula list as a physical loss item, and a matching target loss formula is determined. For example, if the target prediction type is building hourly energy consumption prediction, the corresponding data type is power data and the data missing rate is 5%, then look up the algebraic formula applicable to power data and data missing scenarios in the list (such as total building energy consumption = sum of power of each terminal device × running time), determine the loss term corresponding to the formula as the energy consumption balance physical loss term, and the matching target loss formula is the above algebraic formula.
[0057] Further, the first neural network model is trained based on the training sample set, each target prediction type, each physical loss term, and the second loss function to obtain the target neural network model, including: obtaining any training sample from the training sample set as a target sample; inputting the target sample into the first neural network model to obtain a target result matching the target sample; calculating the total loss value of the second loss function based on the labeled data of the target sample and the target result, using the second loss function and each physical loss term; adjusting the parameters of the first neural network model using the backpropagation algorithm according to the total loss value; returning to the operation of obtaining the target training sample from the training sample set until the end of training conditions are met, and determining the trained first neural network model as the target neural network model.
[0058] Specifically, based on the labeled data of the target sample and the target result, the total loss value of the second loss function is calculated using the second loss function and each physical loss term. This includes: calculating a basic loss value using the first loss function based on the labeled data of the target sample and the target result; determining the data type of the target result and searching for a target loss term matching the target result in each physical loss term according to the data type; performing inverse normalization on the target result to obtain a test result; substituting the test result into the target loss formula matching the target loss term to calculate the physical constraint loss value; and calculating the total loss value of the second loss function using the second loss function on the basic loss value and the physical constraint loss value.
[0059] The second loss function is specifically defined as: Total loss value = Base loss value + λ(t)・α・Physical constraint loss value; where λ(t) is a physical loss weight function that increases linearly with the number of iterations, with an initial value of 0.1, increasing by 0.1 every 100 iterations until it reaches 1.0; α is the physical loss balance coefficient, and the specific value can be set and modified by the user according to the actual implementation scenario.
[0060] Furthermore, the inverse normalization refers to the process of reconstructing the normalized prediction results from model training into values with true physical dimensions using the original data and statistical parameters recorded before training. Those skilled in the art should understand that since the normalized prediction values are in a dimensionless range, they cannot be directly substituted into physical formulas. Inverse normalization can restore the prediction values to true physical quantities, thereby accurately verifying whether the prediction results conform to physical laws.
[0061] Specifically, the test results are substituted into the target loss formula that matches the target loss term to calculate the physical constraint loss value, including: substituting the test results into the target loss formula that matches the target loss term, and calculating the difference between the left and right sides of the equation, which is the physical constraint loss value.
[0062] The technical solution of this invention involves constructing a heterogeneous graph neural network based on a node dataset and at least one boundary rule, obtaining a pre-set training sample set, a list of loss formulas, and at least one target prediction type, then training the heterogeneous graph neural network using the training sample set and a first loss function to obtain a first neural network model, and finally obtaining at least one physical loss term based on the list of loss formulas and the node dataset, and training the first neural network model based on the training sample set, each target prediction type, each physical loss term, and a second loss function to obtain a target neural network model. This achieves the training of the neural network model and improves the correctness and rationality of the neural network model.
[0063] Example 2
[0064] Figure 2 This is a flowchart of a time series calculation method provided in Embodiment 2 of the present invention. This embodiment is applicable to the case of using a neural network model to calculate time series. The method can be executed by a time series calculation device, which can be implemented in hardware and / or software. The time series calculation device can be configured in a terminal or server with time series calculation function.
[0065] like Figure 2 As shown, the method includes:
[0066] S210. Obtain the node sequence dataset of the target physical system, at least one target boundary rule, and at least one target physical relationship.
[0067] The target physical system is a complex system with clearly defined physical constraints, such as a building energy system, a power transmission system, or an industrial fluid circulation system. Furthermore, the target boundary rules are constraints set by the user based on physical laws and actual operating conditions, used to limit the reasonable range of system operation and boundary interaction logic, such as rules like water temperature below 100 degrees Celsius and the difference between supply and return water flow rates ≤ 5%. Further, the target physical relationship is an edge structure used to annotate the interaction patterns between nodes. For example, the target physical relationship can annotate the energy transfer relationship between building space and fan coil units, and the fluid transport relationship between chiller units and pipelines. Each physical relationship includes the type and interaction property of two interacting nodes.
[0068] S220. Based on the node sequence dataset, the boundary rules of each target, and the physical relationships of each target, a target heterogeneous graph matching the target physical system is constructed.
[0069] Those skilled in the art should understand that the method for constructing heterogeneous graphs under the condition of known node sequence dataset, boundary rules of each target and physical relationship of each target is a mature existing technology, and the construction process and principle are not described in detail in this embodiment.
[0070] S230. Input the target heterogeneous graph and the node sequence dataset into the pre-trained target neural network model to obtain the time series calculation results of the target physical system matching.
[0071] For example, based on the above steps, time series data of each node for nearly 6 hours is set as input. When the target neural network model calculates, the preliminary prediction results are first denormalized, and then physical residual verification is used to ensure that the results conform to the target physical relationship and boundary rules. The final output time series calculation results need to match the core requirements of the target physical system, such as the hourly indoor temperature prediction results of the building energy system for the next 24 hours and the water supply pressure change curve of the chiller unit for the next 8 hours. The specific type of the time series calculation results matches the target prediction type in step S120 of Example 1.
[0072] The technical solution of this invention obtains a node sequence dataset of the target physical system, at least one target boundary rule, and at least one target physical relationship. Based on the node sequence dataset, each target boundary rule, and each target physical relationship, a target heterogeneous graph matching the target physical system is constructed. Finally, the target heterogeneous graph and the node sequence dataset are input into the target neural network model trained in the above steps to obtain the time series calculation result matching the target physical system. This realizes the calculation of time series and improves the correctness and rationality of the time series calculation result.
[0073] Example 3
[0074] Figure 3 This is a schematic diagram of the structure of a training device for a neural network model provided in Embodiment 3 of the present invention.
[0075] like Figure 3 As shown, the device includes:
[0076] Neural network building module 310 is used to build heterogeneous graph neural networks based on a node dataset and at least one boundary rule;
[0077] The data acquisition module 320 is used to acquire a pre-set training sample set, a list of loss formulas, and at least one target prediction type.
[0078] The first training module 330 is used to train the heterogeneous graph neural network using the training sample set and the first loss function to obtain a first neural network model;
[0079] The second training module 340 is used to obtain at least one physical loss term based on the loss formula list and the node dataset, and to train the first neural network model based on the training sample set, each target prediction type, each physical loss term and the second loss function to obtain the target neural network model.
[0080] The technical solution of this invention involves constructing a heterogeneous graph neural network based on a node dataset and at least one boundary rule, obtaining a pre-set training sample set, a list of loss formulas, and at least one target prediction type, then training the heterogeneous graph neural network using the training sample set and a first loss function to obtain a first neural network model, and finally obtaining at least one physical loss term based on the list of loss formulas and the node dataset, and training the first neural network model based on the training sample set, each target prediction type, each physical loss term, and a second loss function to obtain a target neural network model. This achieves the training of the neural network model and improves the correctness and rationality of the neural network model.
[0081] Based on the above embodiments, the second training module 340 includes:
[0082] A node data parsing unit is used to parse the node dataset to obtain at least one data type that matches the data of each node.
[0083] The loss term lookup unit is used to obtain a pre-configured list of loss formulas and target prediction types, and to find at least one physical loss term and a target loss formula that matches the physical loss term in the list of loss formulas based on each data type and each target prediction type.
[0084] Based on the above embodiments, the second training module 340 includes:
[0085] A target sample acquisition unit is used to acquire any training sample as a target sample from the training sample set.
[0086] The first model calculation unit is used to input the target sample into the first neural network model to obtain a target result that matches the target sample.
[0087] The total loss value calculation unit is used to calculate the total loss value of the second loss function based on the labeled data of the target sample and the target result, through the second loss function and each physical loss term;
[0088] The parameter tuning unit is used to adjust the parameters of the first neural network model using the backpropagation algorithm based on the total loss value.
[0089] The return execution unit is used to return to the operation of obtaining the target training sample in the training sample set until the end of training condition is met, and to determine the first neural network model obtained by training as the target neural network model.
[0090] Based on the above embodiments, the total loss value calculation unit further includes:
[0091] The basic loss value calculation unit is used to calculate the basic loss value based on the labeled data of the target sample and the target result using the first loss function;
[0092] The target loss item lookup unit is used to determine the data type of the target result and, based on the data type, search for the target loss item that matches the target result in each physical loss item.
[0093] The denormalization unit is used to perform denormalization processing on the target result to obtain the test result;
[0094] The constraint loss value calculation unit is used to substitute the test results into the target loss formula that matches the target loss item, and calculate the physical constraint loss value.
[0095] The loss function calculation unit is used to calculate the basic loss value and the physical constraint loss value using the second loss function to obtain the total loss value of the second loss function.
[0096] Based on the above embodiments, the neural network construction module 310 includes:
[0097] The data cleaning unit is used to perform data cleaning operations on the data of each node in the node dataset based on preset data cleaning rules, so as to obtain a structured node dataset.
[0098] The physical relationship acquisition unit is used to acquire at least one preset physical relationship that matches the structured node dataset, and to obtain the edge structure of each heterogeneous graph based on the structured node dataset and each physical relationship.
[0099] The network construction unit is used to obtain a heterogeneous graph neural network based on the structured node dataset and the edge structure of each heterogeneous graph.
[0100] Based on the above embodiments, the network construction unit includes:
[0101] The clamping processing unit is used to clamp the structured node data in the structured node dataset based on each boundary rule to obtain constrained node data that matches each boundary rule.
[0102] The topology trimming unit is used to perform topology trimming operations on the edge structures of each heterogeneous graph to obtain each constrained edge structure.
[0103] The fusion heterogeneous unit is used to process each constrained edge structure and each constrained node data using a pre-configured multi-object heterogeneous graph network to obtain a heterogeneous graph neural network.
[0104] The neural network model training device provided in this embodiment of the invention can execute the neural network model training method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0105] Example 4
[0106] Figure 4 This is a schematic diagram of the structure of a time series computing device provided in Embodiment 4 of the present invention.
[0107] like Figure 4 As shown, the device includes:
[0108] The system data acquisition module 410 is used to acquire the node sequence dataset of the target physical system, at least one target boundary rule, and at least one target physical relationship.
[0109] The heterogeneous graph construction module 420 is used to construct a target heterogeneous graph that matches the target physical system based on the node sequence dataset, each target boundary rule and each target physical relationship;
[0110] The model calculation module 430 is used to input the target heterogeneous graph and the node sequence dataset into the target neural network model trained by a pre-configured method to obtain the time series calculation result of the target physical system matching.
[0111] The technical solution of this invention obtains a node sequence dataset of the target physical system, at least one target boundary rule, and at least one target physical relationship. Based on the node sequence dataset, each target boundary rule, and each target physical relationship, a target heterogeneous graph matching the target physical system is constructed. Finally, the target heterogeneous graph and the node sequence dataset are input into the target neural network model trained in the above steps to obtain the time series calculation result matching the target physical system. This realizes the calculation of time series and improves the correctness and rationality of the time series calculation result.
[0112] The time series calculation device provided in this embodiment of the invention can execute the time series calculation method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the method execution.
[0113] Example 5
[0114] Figure 5A schematic diagram of an electronic device 10, which can be used to implement embodiments of the present invention, is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0115] like Figure 5 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded into the RAM 13 from storage unit 18. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0116] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0117] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as a method for training a neural network model and a method for calculating time series data.
[0118] Accordingly, a method for training a neural network model includes:
[0119] Construct a heterogeneous graph neural network based on a node dataset and at least one boundary rule;
[0120] Obtain a pre-set training sample set, a list of loss formulas, and at least one target prediction type;
[0121] The heterogeneous graph neural network is trained using the training sample set and the first loss function to obtain a first neural network model;
[0122] At least one physical loss term is obtained based on the list of loss formulas and the node dataset. The first neural network model is then trained based on the training sample set, each target prediction type, each physical loss term, and the second loss function to obtain the target neural network model.
[0123] In some embodiments, a method for training a neural network model and a method for calculating a time series can be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the method for training a neural network model and the method for calculating a time series described above can be performed. Alternatively, in other embodiments, processor 11 can be configured by any other suitable means (e.g., by means of firmware) to execute a method for training a neural network model and a method for calculating a time series.
[0124] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0125] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0126] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0127] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0128] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0129] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0130] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
Claims
1. A method for training a neural network model, the method comprising: The method comprises the following steps: constructing a heterogeneous graph neural network based on a node data set and at least one boundary rule; obtaining a pre-set training sample set, a loss formula list, and at least one target prediction type; training the heterogeneous graph neural network using the training sample set and a first loss function to obtain a first neural network model; obtaining at least one physical loss term based on the loss formula list and the node data set, and training the first neural network model based on the training sample set, each target prediction type, each physical loss term, and a second loss function to obtain a target neural network model.
2. The method of claim 1, wherein, obtaining at least one physical loss term based on the loss formula list and the node data set comprises: parsing the node data set to obtain at least one data category matched with each node data; obtaining a pre-configured loss formula list and a target prediction type, and finding at least one physical loss term and a target loss formula matched with the physical loss term in the loss formula list based on each data category and each target prediction type.
3. The method according to any of claims 1-2, characterized in that, training the first neural network model based on the training sample set, each target prediction type, each physical loss term, and a second loss function to obtain a target neural network model comprises: obtaining any training sample in the training sample set as a target sample; inputting the target sample into the first neural network model to obtain a target result matched with the target sample; calculating a total loss value of the second loss function based on the labeled data of the target sample and the target result, the second loss function, and each physical loss term; adjusting the parameters of the first neural network model based on the total loss value by using a back propagation algorithm; returning to the operation of obtaining a target training sample in the training sample set until a termination condition is met, and determining the trained first neural network model as the target neural network model.
4. The method of claim 3, wherein, calculating a total loss value of the second loss function based on the labeled data of the target sample and the target result, the second loss function, and each physical loss term comprises: calculating a basic loss value based on the labeled data of the target sample and the target result by using the first loss function; judging the data type of the target result, and finding a target loss term matched with the target result in each physical loss term according to the data type; performing inverse normalization processing on the target result to obtain a test result; substituting the test result into a target loss formula matched with the target loss term to calculate a physical constraint loss value; calculating the total loss value of the second loss function by using the second loss function on the basic loss value and the physical constraint loss value.
5. The method of claim 1, wherein, constructing a heterogeneous graph neural network based on a node data set and at least one boundary rule comprises: performing a data cleaning operation on each node data in the node data set based on a pre-set data cleaning rule to obtain a structured node data set; obtaining at least one preset physical relation matched with the structured node dataset, and obtaining each heterogeneous graph edge structure based on the structured node dataset and each physical relation; obtaining a heterogeneous graph neural network based on the structured node dataset and each heterogeneous graph edge structure.
6. The method of claim 5, wherein, obtaining a heterogeneous graph neural network based on the structured node dataset and each heterogeneous graph edge structure, comprising: clipping each structured node data in the structured node dataset based on each boundary rule to obtain each constraint node data matched with each boundary rule; performing a topological pruning operation on each heterogeneous graph edge structure to obtain each constraint edge structure; processing each constraint edge structure and each constraint node data using a pre-configured multi-object heterogeneous graph network to obtain the heterogeneous graph neural network.
7. A method of calculating a time series, characterized by, comprising: obtaining a node sequence dataset of a target physical system, at least one target boundary rule and at least one target physical relation; constructing a target heterogeneous graph matched with the target physical system based on the node sequence dataset, each target boundary rule and each target physical relation; inputting the target heterogeneous graph and the node sequence dataset into a target neural network model trained by the method of any one of claims 1-6 to obtain a time sequence calculation result matched with the target physical system.
8. A device for training a neural network model, comprising: comprising: a neural network construction module configured to construct a heterogeneous graph neural network based on a node dataset and at least one boundary rule; a data acquisition module configured to obtain a pre-set training sample set, a loss formula list and at least one target prediction type; a first training module configured to train the heterogeneous graph neural network using the training sample set and a first loss function to obtain a first neural network model; a second training module configured to obtain at least one physical loss term based on the loss formula list and the node dataset, and train the first neural network model based on the training sample set, each target prediction type, each physical loss term and a second loss function to obtain a target neural network model.
9. A time series calculation apparatus characterized by comprising: comprising: a calculation data acquisition module configured to obtain a node sequence dataset of a target physical system, at least one target boundary rule and at least one target physical relation; a heterogeneous graph construction module configured to construct a target heterogeneous graph matched with the target physical system based on the node sequence dataset, each target boundary rule and each target physical relation; a result calculation module configured to input the target heterogeneous graph and the node sequence dataset into a target neural network model trained by the method of any one of claims 1-6 to obtain a time sequence calculation result matched with the target physical system.
10. An electronic device, comprising: The electronic device comprises: at least one processor; and a memory connected in communication with the at least one processor; wherein the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the training method of the neural network model in any one of claims 1-6 and the calculation method of the time sequence in claim 7.