Causal relationship discovery method and system and related equipment
By dividing the data set into multiple category groups and combining knowledge set training to generate multiple causal graphs, the problem that the causal discovery algorithm in the existing technology can only output a single causal graph and has low accuracy, and efficient causal relationship discovery in small data volume scenarios is achieved.
Patent Information
- Application Number
- CN202311172042.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-12
- Publication Date
- 2025-03-14
AI Technical Summary
The existing causal discovery algorithm can only output a single causal graph, with low accuracy, and it is difficult to find accurate causal relationships in small data scenarios.
Multiple causal graphs are generated by dividing the dataset into multiple category groups and training multiple submodels using multiple category groups. At the same time, training is carried out in combination with knowledge sets, and prior knowledge is used to improve the accuracy of causal discovery in small data volume scenarios.
The ability to discover multiple causal graphs in small data volume scenarios is realized, which improves the accuracy and efficiency of causal discovery, and avoids the problems of low accuracy of causal discovery algorithm and the output of a single causal graph.
Smart Images

Figure CN119623610A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence (AI), and in particular to a causal relationship discovery method, system and related equipment. Background Art
[0002] Causal discovery refers to the process of AI models discovering potential causal relationships between variables from data and constructing a causal graph. The nodes in the causal graph represent variables, and the edges between nodes represent the causal relationships between variables. Usually, when constructing a causal graph, the causal discovery algorithm can first determine the edges that may exist in the causal graph, and then determine the causal estimate of each edge. The causal estimate is used to evaluate the strength of the causal relationship between the two variables connected by the edge, and then delete the edges with smaller causal estimates and retain the edges with higher causal estimates, thereby obtaining a causal graph.
[0003] However, in the actual processing environment, there may be multiple causal graphs between multiple variables in the data set, and the causal discovery algorithm can only obtain the causal graph with the strongest causal relationship, and cannot output all the causal graphs. In addition, the output causal graph may only be a causal graph with an erroneous causal structure composed of multiple strong causal relationships, resulting in low accuracy of the causal discovery algorithm. Summary of the invention
[0004] The present application provides a causal relationship discovery method, system and related equipment, which are used to solve the problem that the causal discovery algorithm can only output a single causal graph and the algorithm has low accuracy.
[0005] In a first aspect, a causal relationship discovery method is provided, the method comprising the following steps: obtaining a data set and a number of groups input by a user, dividing the data set into a plurality of category groups, wherein the data set comprises observation data of a plurality of objects, each of the plurality of category groups comprises at least one object, and objects in the same category group have the same causal graph, using the plurality of category groups to train a plurality of sub-models, and obtaining a causal graph corresponding to each of the plurality of category groups, wherein one category group is used to train one sub-model, and one sub-model is used to generate a causal graph corresponding to the category group.
[0006] Implement the method described in the first aspect, divide the data set into multiple category groups, and make the objects in the category groups objects of a common causal graph, use different category groups to train different sub-models, so that different sub-models can mine the causal graph of the observed data in the corresponding category groups, thereby obtaining multiple causal graphs corresponding to the data set. This can solve the problem that the current causal discovery algorithm can only recognize a single causal graph and cannot mine multiple causal graphs from the data.
[0007] In one possible implementation, when multiple sub-models are trained using multiple category groups, a knowledge set input by the user can be first obtained, wherein the observation data of multiple objects include multiple variables, and the knowledge set includes a known causal relationship between at least two of the multiple variables, and then the knowledge set and the multiple category groups are used to train the multiple sub-models.
[0008] Furthermore, known causal relationships refer to the known causal relationships between multiple variables in a data set. Each known causal relationship is obtained based on prior knowledge. This prior knowledge is used to guide the model to discover causal relationships. This prior knowledge can come from the experience of domain experts, domain theories, research results, etc.
[0009] In the above implementation, when the number of samples in the data set is small, the coverage and diversity of the data will be reduced, and only one-sided or even wrong causal relationships can be discovered through the data set. The present application combines prior knowledge with the data set through the knowledge set, which can improve the accuracy of causal discovery in small data volume scenarios.
[0010] In a possible implementation, the known causal relationship includes a first causal relationship with a determined causal direction and a determined quantitative relationship value.
[0011] Among them, the causal direction is used to describe that the change of one variable leads to the change of another variable. That is, one variable is considered to be the cause variable and the other variable is considered to be the result variable. The causal direction describes that the effect of this causal relationship is from the causal variable to the result variable. The causal direction can be unidirectional, indicating that the cause variable affects the result variable. The determination of the causal direction means that the cause variable and the result variable in the causal relationship are determined. For example, rain (cause) may cause the ground to be wet (result), but the wet ground will not cause rain, so the causal direction between "precipitation" and "ground humidity" is determined, that is, precipitation → ground humidity.
[0012] The quantitative relationship value refers to the specific numerical expression of the causal relationship between two variables, which is used to measure the specific situation of the quantitative relationship. The quantitative relationship value determination means that this specific numerical expression is determined. For example, for every increase of X by one unit, Y increases by 10 units, or A has a 5% effect on B. The above examples are for illustration only and are not specifically limited in this application.
[0013] In the specific implementation, for the first causal relationship with a determined causal direction and a determined quantitative relationship value, when training each sub-model, the model parameters that control the output of the first causal relationship can be frozen and not participate in the back propagation during the training process. In simple terms, a part of the parameters of the sub-model are initialized through the first causal relationship, and then during the training process, only the uninitialized parameters are allowed to be adjusted, thereby ensuring that the model parameters that control the output of the first causal relationship will not change with the model training, and ensuring that the causal graph output by the model includes the above-mentioned known first causal relationship.
[0014] It should be understood that the sub-model includes multiple parameters, each parameter is used to describe the strength, direction and type of possible causal relationships between variables. By training the model, the parameters of the model are continuously optimized so that the model can accurately reflect the causal relationship in the input observation data. Therefore, in order to ensure that the causal graph output by the model includes the first causal relationship, the frozen parameters can be parameters related to the first causal relationship, such as freezing the weight of the edge between the two variables of the first causal relationship in the causal graph. The weight of the edge will not be trained during model training, thereby ensuring that the causal graph output by the model includes the first causal relationship determined according to the prior knowledge. Or freeze the elements corresponding to the first causal relationship in the causal adjacency matrix so that it no longer changes with the training of the model, wherein the causal adjacency matrix is usually used to represent the causal relationship between variables during the training process, the rows and columns of the matrix represent different variables, and the elements in the matrix represent the causal relationship between these variables, and in the causal adjacency matrix, the element value corresponding to the determined causal direction is represented as a non-zero positive number. On the contrary, if there is a negative causal relationship, the element value is a negative number. The above examples are for illustration and are not specifically limited in this application.
[0015] In a possible implementation, the known causal relationship includes a second causal relationship with a determined causal direction and a quantitative relationship value that is a non-zero unknown value, wherein the non-zero quantitative relationship value means that a certain numerical relationship is determined between the two variables, but the relationship cannot be described by a specific numerical value.
[0016] In a specific implementation, when a sub-model is trained using a second causal relationship in which the causal direction is determined and the quantitative relationship value is a non-zero unknown value, a constraint that the causal direction is determined and the quantitative relationship value is non-0 can be set according to the second causal relationship, and then the model is trained in combination with the constraint. It should be understood that since the quantitative relationship value of the second causal relationship is unknown, it is necessary to learn this quantitative relationship value by fitting the data in the data set during the model training process, so that the weight parameters of the model of the second causal relationship are continuously optimized with multiple rounds of training. However, in order to avoid the direction of the second causal relationship from changing during the training process, the constraint of the causal direction is set, so that the trained model can output the second causal relationship with the correct causal direction and the quantitative relationship value inferred by the model.
[0017] Furthermore, the second causal relationship can be realized by the following constraints: set a constraint greater than 0 for the element in the causal adjacency matrix corresponding to the determined direction, and set a constraint equal to 0 for the element in the opposite direction. The causal adjacency matrix is usually used to represent causal relationships, the rows and columns of the matrix represent different variables, and the elements in the matrix represent the causal relationship between these variables. In the causal adjacency matrix, the element value corresponding to the determined causal direction is represented as a non-zero positive number. Conversely, if there is a negative causal relationship, the element value is a negative number.
[0018] It should be understood that setting the constraint of the element corresponding to the causal relationship to be greater than 0 can ensure the existence of this causal relationship in the forward causal relationship, and setting the constraint of the opposite element corresponding to the causal relationship to be equal to 0 can ensure the non-existence of this causal relationship in the reverse direction. Such constraint setting can help the sub-model to maintain the causal direction in the second causal relationship output by the model during the training process, even if the model parameters are continuously optimized.
[0019] In a possible implementation, the known causal relationship includes a third causal relationship with a determined causal direction and an unknown quantitative relationship value. The unknown quantitative relationship value means that it is difficult to determine whether there is a certain numerical relationship between the two variables, there may be a certain numerical relationship, but the value is unknown, or there may be no numerical relationship between the two variables.
[0020] In a specific implementation, when the sub-model is trained using a third causal relationship with a determined causal direction and an unknown quantitative relationship, a constraint that the causal direction is determined and the quantitative relationship is not restricted can be set according to the third causal relationship, that is, a constraint that the quantitative relationship may be 0, and then the model is trained in combination with the constraint. Further, the above-mentioned third causal relationship can be implemented by the following constraint: a constraint equal to 0 is set for the element in the causal adjacency matrix corresponding to the opposite direction to be determined. Referring to the foregoing content, it can be seen that in the causal adjacency matrix, the element value corresponding to the determined causal direction is represented as a positive number with a non-zero value. On the contrary, if there is a negative causal relationship, the element value is a negative number. Therefore, without constraining the positive elements, only constraining the reverse elements to 0, it can be ensured that there will be no reverse causal relationship in the third causal relationship, and at the same time, without constraining the positive causal relationship, the model can learn the quantitative relationship in the third causal relationship by fitting the data set, which may be 0 in the positive direction or a certain positive value. Such a constraint setting can help the sub-model in the training process, even if the model parameters are continuously optimized, the causal direction in the third causal relationship output by the model will not change.
[0021] It should be noted that at least one known causal relationship in the knowledge set can be one or more of the first causal relationship, the second causal relationship, and the third causal relationship. Each known causal relationship can be a causal relationship between two variables, or a causal relationship between more than two variables, that is, a causal diagram, which is not specifically limited in this application.
[0022] In the above implementation method, the sub-model is trained by combining the knowledge set and the data set, and the knowledge set includes at least one known causal relationship. These known causal relationships are at least causal relationships determined by the causal direction, which can provide guidance for the training of the sub-model. When the data set has a small amount of data, the coverage and diversity of the data will be reduced, and only one-sided or even erroneous causal relationships can be discovered through the data set alone. The present application combines prior knowledge with the data set through the knowledge set, which can improve the accuracy of causal discovery in small data volume scenarios.
[0023] In one possible implementation, multiple sub-models are trained using multiple category groups. When a causal graph corresponding to each of the multiple category groups is obtained, a penalty threshold input by the user can be first obtained, and then executed on any first model among the multiple sub-models: the first model is trained for multiple rounds using the category group corresponding to the first model. When the gap between the current output result of the first model and the output result of the previous round of training is not less than the penalty threshold, the next round of training is performed on the first model using the current output result as a penalty parameter. The penalty parameter is used to constrain the range of variation of the model parameters of the first model in the next round of training. The larger the penalty parameter, the smaller the constraint on the range of variation. When the gap between the output result of the first model and the output result of the previous round is less than the penalty threshold, the causal graph corresponding to each of the multiple category groups is obtained according to the output result of the first model.
[0024] Simply put, when the difference between the estimated value output by the model and the estimated value output in the previous round is not less than the penalty threshold, the estimated value output in this round is used as the penalty parameter for the next round of training, and so on for multiple rounds of training until the difference between the estimated value output by the current round and the estimated value output by the previous round is less than the penalty threshold.
[0025] In the above implementation, when the model estimates the causal relationship between variables, due to factors such as data noise and insufficient sample size, some deviations may occur in the individual estimated values output by the model. This deviation may affect the accuracy of causal discovery, making it possible for the algorithm to fail to fully capture the true causal structure. However, by using the estimated value of this round as a penalty parameter, this application can achieve the goal of imposing lower penalties on larger parameter values and higher penalties on smaller parameter values, so that the model can adjust the parameter update amplitude according to the output of the estimated value during the training process. The adjustment amplitude of the model during multiple rounds of training is more stable. Even if an erroneous estimated value appears, it will not cause a large swing in the parameter due to this erroneous estimated value, thereby achieving the effect of correction.
[0026] In one possible implementation, when a data set is divided into multiple category groups, the data set is first divided into multiple initial category groups according to the number of groupings input by the user, and then multiple sub-models are trained using the multiple initial category groups to obtain multiple initial causal graphs, wherein one initial category group is used to train one sub-model, and the observation data of each of the multiple objects is substituted into the multiple initial causal graphs to obtain multiple substitution results for each object, and finally, based on the multiple substitution results for each object, the category group to which each object belongs is determined to obtain multiple category groups of the data set.
[0027] Optionally, the observed data of each object can be substituted into each initial causal graph, and the category group corresponding to each object can be determined based on the substitution result of each initial causal graph, and then the multiple initial category groups can be updated. In a specific implementation, the loss value of each initial causal graph can be determined based on the substitution result of each initial causal graph, and then the category group corresponding to the initial causal graph with the smallest loss value can be determined as the category group of the object. For example, the observed data of object A is substituted into k initial causal graphs to obtain k loss values. The minimum value among the k loss values is the causal group. Figure 3 The loss value is, then the causal Figure 3 The corresponding category group 3 is the category group corresponding to the object A. Similarly, the category groups corresponding to the observation data of other objects can be obtained, thereby obtaining multiple updated category groups.
[0028] It should be understood that each initial causal graph is generated after training the sub-model using the category group, and the model parameters are updated by minimizing the loss function. The smaller the loss function, the better the model fits the potential causal structure in the observed data, and the causal graph generated by the model can more accurately describe the causal relationship between the observed data. Therefore, the smaller the loss value obtained by substituting the observed data of each object into the causal graph, the more the causal relationship described by the causal graph fits the causal relationship implied by the observed data of the object. In this way, the objects in each category group are updated, which can ensure that the multiple objects in the category group finally obtained are objects with a common causal graph, and the causal graphs of objects in different category groups are different.
[0029] Optionally, after updating the category group and obtaining multiple updated category groups, each updated category group can be used to train the corresponding sub-model, and then multiple updated initial causal graphs are obtained, and then the observation data of each object is substituted into the updated multiple initial causal graphs, and the category group of each object is determined according to the loss value of the multiple initial causal graphs, and so on, until the preset conditions are met, and multiple causal graphs corresponding to the multiple category groups are obtained. The preset conditions here can be the number of updates, or it can be that the objects in the category group are no longer changed after x consecutive rounds of updates, such as x is 2, and this application does not make specific limitations.
[0030] The above implementation method, through multiple rounds of updates to the category groups, allows objects sharing the same causal graph to be gradually divided into the same category group, and uses the observation data of the objects sharing the same causal graph to train the sub-model. In this way, even if the causal relationship in the causal graph of this category group is weak, the corresponding causal graph can be output, thereby solving the problem that the current causal discovery algorithm can only generate a single causal graph, and also solving the problem that the current causal discovery algorithm is prone to causal structure fusion.
[0031] In one possible implementation, data to be processed input by a user is obtained, the data to be processed includes observation data of multiple objects to be processed, the observation data of the multiple objects to be processed are substituted into multiple causal graphs, and multiple substitution results of each of the multiple objects to be processed are obtained; based on the multiple substitution results of each object to be processed, the category group to which each object to be processed belongs is determined; based on the causal graph corresponding to the category group to which each object to be processed belongs, one or more causal graphs corresponding to the data to be processed are determined.
[0032] Optionally, the observation data of each object to be processed can be substituted into multiple causal graphs respectively, and the category group corresponding to each object to be processed can be determined according to the loss value of each causal graph. In a specific implementation, the category group corresponding to the causal graph with the smallest loss value is the category group corresponding to the object to be processed.
[0033] In the above implementation method, for new data to be processed, each object to be processed in the data to be processed can be substituted into multiple causal graphs to determine the most suitable causal graph for each object to be processed, thereby determining one or more causal graphs corresponding to the data to be processed. This method enables new data to quickly complete causal discovery, and the discovered causal graph is not a single causal graph, and the accuracy and efficiency of causal discovery are very high.
[0034] In a second aspect, a causal relationship discovery system is provided, which includes: an acquisition unit, used to acquire a data set and a number of groups input by a user, and divide the data set into multiple category groups, wherein the data set includes observation data of multiple objects, each of the multiple category groups includes at least one object, and the causal graphs of objects in the same category group are the same; a training unit, used to train multiple sub-models using the multiple category groups, and obtain a causal graph corresponding to each of the multiple category groups, wherein one category group is used to train one sub-model, and one sub-model is used to generate the causal graph of the corresponding category group.
[0035] Implement the system described in the second aspect, divide the data set into multiple category groups, and make the objects in the category groups objects of the same causal graph. Use different category groups to train different sub-models, so that different sub-models can mine the causal graphs of the observed data in the corresponding category groups, thereby obtaining multiple causal graphs corresponding to the data set. This can solve the problem that the current causal discovery algorithm can only identify a single causal graph and cannot mine multiple causal graphs from the data.
[0036] In one possible implementation, the system also includes a knowledge injection unit and an acquisition unit for acquiring a knowledge set input by a user, wherein the observation data of multiple objects include multiple variables, the knowledge set includes a known causal relationship between at least two of the multiple variables, and the knowledge injection unit is used to train multiple sub-models using the knowledge set and multiple category groups.
[0037] In a possible implementation, the known causal relationship is obtained based on prior knowledge, and the known causal relationship includes a first causal relationship determined by a causal direction and a quantitative relationship value.
[0038] In a possible implementation, the known causal relationship includes a second causal relationship in which the causal direction is determined and the quantitative relationship value is a non-zero unknown value.
[0039] In a possible implementation, the known causal relationship includes a third causal relationship with a determined causal direction and an unknown quantitative relationship value.
[0040] In one possible implementation, the system also includes a penalty unit, an acquisition unit, which is used to obtain a penalty threshold input by a user, and a penalty unit, which is used to execute on any first model among the multiple sub-models: using the category group corresponding to the first model to perform multiple rounds of training on the first model, and when the gap between the current output result of the first model and the output result of the previous round of training is not less than the penalty threshold, using the current output result as a penalty parameter to perform the next round of training on the first model, the penalty parameter is used to constrain the range of variation of the model parameters of the first model in the next round of training, and the larger the penalty parameter, the smaller the constraint on the range of variation, and when the gap between the output result of the first model and the output result of the previous round is less than the penalty threshold, obtaining a causal graph corresponding to each category group in the multiple category groups according to the output result of the first model.
[0041] In one possible implementation, the system also includes a grouping unit and a grouping update unit. The grouping unit is used to divide the data set into multiple initial category groups according to the number of groups input by the user. The training unit is used to train multiple sub-models using the multiple initial category groups to obtain multiple initial causal graphs, wherein one initial category group is used to train one sub-model. The grouping update unit is used to substitute the observation data of each object of the multiple objects into the multiple initial causal graphs to obtain multiple substitution results for each object. The grouping update unit is used to determine the category group to which each object belongs based on the multiple substitution results of each object to obtain multiple category groups of the data set.
[0042] In one possible implementation, the system also includes an output unit and a group prediction unit. The acquisition unit is further used to acquire the data to be processed input by the user, and the data to be processed includes observation data of multiple objects to be processed. The group prediction unit is used to substitute the observation data of the multiple objects to be processed into multiple causal graphs to obtain multiple substitution results for each of the multiple objects to be processed. The group prediction unit is used to determine the category group to which each object to be processed belongs based on the multiple substitution results of each object to be processed. The output unit is used to determine one or more causal graphs corresponding to the data to be processed based on the causal graph corresponding to the category group to which each object to be processed belongs.
[0043] In a third aspect, a computing device is provided, which includes a processor and a memory, the memory is used to store instructions, and the processor is used to execute instructions, so that the computing device implements the method described in the first aspect.
[0044] In a fourth aspect, a computing device cluster is provided, which includes at least one computing device, each of the at least one computing device includes a processor and a memory, and the processor of the at least one computing device is used to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster implements the method described in the first aspect.
[0045] In a fifth aspect, a computer-readable storage medium is provided, in which instructions are stored. When the instructions are executed by a computing device or a computing device cluster, the method described in the first aspect is implemented.
[0046] In a sixth aspect, a computer program product comprising instructions is provided, wherein the computer program product includes instructions that can be run on a computing device or software or a program product stored in any available medium, and when the computer program product is run on a computing device or a computing device cluster, the computing device or the computing device cluster executes the method described in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 It is an architecture diagram of a causal relationship discovery system provided by this application;
[0048] Figure 2 It is a schematic diagram of the structure of the causal relationship discovery system provided by this application;
[0049] Figure 3 This is a flowchart of the steps of a causal relationship discovery method provided by the present application in the training phase;
[0050] Figure 4 It is a schematic diagram of the training process of each sub-model in the causal relationship discovery method provided by this application;
[0051] Figure 5 This is a schematic diagram of the steps of a causal relationship discovery method in the reasoning stage provided by the present application;
[0052] Figure 6 It is a schematic diagram of an interface provided by this application;
[0053] Figure 7 It is a structural schematic diagram of a computing device provided by this application. DETAILED DESCRIPTION
[0054] First, the application scenario "causal discovery" involved in this application is explained.
[0055] Causal discovery is one of the key steps in causal AI. Causal AI is a technology that uses causal relationships to improve the prediction and decision-making capabilities of artificial intelligence systems. It can help AI models better understand the causal relationships between variables, thereby improving the prediction and decision-making capabilities of the model and helping to solve problems in areas such as fault link detection, drug efficacy inference, and risk attribution. Causal AI includes two key steps: causal discovery and causal inference. Causal discovery is used to discover potential causal relationships between variables from data and construct a causal graph; causal inference is used to evaluate, infer or analyze the causal relationships based on the causal graph, such as inferring whether the causal relationship in the causal graph really exists and the strength of this causal relationship, thereby improving the accuracy of AI predictions and decisions.
[0056] For example, through causal discovery, it is determined that there is a causal relationship between advertising and sales, and through causal inference, the reliability and strength of the causal relationship can be estimated. The reliability here refers to whether the causal relationship between advertising and sales remains stable in different scenarios, and the strength here refers to the extent of the impact of advertising on sales. It should be understood that although causal discovery can be used to know that there is a causal relationship between advertising and sales, it is still necessary to use causal inference technology to control other potential interference factors to ensure the accuracy of the causal relationship finally obtained.
[0057] Therefore, causal discovery focuses on exploring and discovering causal relationships in large-scale data, while causal inference focuses on evaluating, analyzing, and reasoning about known causal relationships. Causal discovery is the basis of causal reasoning, and how to obtain a causal graph of data through observational data is an important research field. Usually, when constructing a causal graph, causal discovery can first determine the edges that may exist in the causal graph, and then determine the causal estimate of each edge. The causal estimate is used to evaluate the strength of the causal relationship between the two variables connected by the edge, and then delete the edges with smaller causal estimates and retain the edges with higher causal estimates to obtain a causal graph.
[0058] However, such an algorithm can only obtain one causal graph between multiple variables. In the actual processing environment, there may be multiple causal graphs between multiple variables in the data set. The causal discovery algorithm can only obtain a causal graph that contains strong causal relationships, thereby missing other causal graphs that may have weak causal relationships, and may even form an erroneous causal graph consisting of multiple strong causal relationships.
[0059] At the same time, such an algorithm requires a large amount of data support. When the number of samples is small, the coverage and diversity of the data will be reduced. The causal relationship obtained by using the causal discovery algorithm in this scenario is often one-sided and erroneous, which makes the causal discovery algorithm rely on large amounts of data and is insufficient to cope with small amounts of data. Most application scenarios have the problems of high data collection costs and difficulty in obtaining data, resulting in poor stability and low accuracy of the causal discovery algorithm.
[0060] In summary, the current causal discovery algorithm can only identify a causal graph of a data set, which is prone to causal graph omissions. In addition, the accuracy of the algorithm depends on the amount of data. In scenarios with small data volumes, the stability and accuracy of the algorithm are difficult to guarantee, which limits the causal discovery algorithm.
[0061] In order to solve the problem that the above-mentioned causal discovery algorithm can only identify a single causal graph, cannot mine multiple causal graphs from the data, and relies on a large amount of data, the stability and accuracy of the algorithm are difficult to guarantee in a small data volume scenario, the present application provides a causal relationship discovery system, which divides the data set into multiple category groups, and makes the objects in the category group objects of the common causal graph, uses different category groups to train different sub-models, so that different sub-models can mine the causal graph of the observed data in the corresponding category group, thereby obtaining multiple causal graphs corresponding to the data set, which can solve the problem that the current causal discovery algorithm can only identify a single causal graph, and cannot mine multiple causal graphs from the data. At the same time, each sub-model combines a knowledge set to train the model, and the knowledge set includes multiple known causal relationships determined by causal directions. These known causal relationships can provide guidance for the training of the sub-models, which can improve the accuracy of causal discovery in a small data volume scenario. Finally, during the training process, each sub-model uses the estimated value of this round as the penalty parameter for the next round of training, with the goal of imposing lower penalties on larger parameter values and higher penalties on smaller parameter values. This allows the model to adjust the parameter update amplitude according to the estimated value output during training. The adjustment amplitude of the model is more stable during multiple rounds of training. Even if an erroneous estimated value appears, the parameter will not swing drastically due to this erroneous estimated value, thereby achieving the effect of correction and ensuring the accuracy of the causal discovery algorithm.
[0062] The causal relationship discovery system provided by the present application is explained below with reference to the accompanying drawings.
[0063] Figure 1This is an architecture diagram of a causal relationship discovery system provided by the present application, and the architecture includes a client 100, a causal relationship discovery system 200, and a storage system 300, wherein the client 100, the causal relationship discovery system 200, and the storage system 300 establish a communication connection through a network, which can be a wired connection or a wireless connection, and the present application does not make specific restrictions. Among them, the number of clients 100 and storage systems 300 that establish a communication connection with the causal relationship discovery system 200 can be one or more, and the present application does not make specific restrictions.
[0064] The client 100 is used to realize human-computer interaction and can be deployed on terminal devices, including personal computers, smart phones, wearable devices, handheld processing devices, tablet computers, mobile notebooks, augmented reality (AR) devices, virtual reality (VR) devices, integrated handheld devices, wearable devices, vehicle-mounted devices, smart conference devices, smart advertising devices, smart home appliances, etc. Smart home appliances can be sweeping robots, mopping robots, etc., which are not specifically limited here.
[0065] In a specific implementation, the above-mentioned client 100 can be a software or application running on a terminal device or computing device controlled by a user, such as a personal computer (PC) client, or a web client accessed based on a browser, or an application (APP) client running on a mobile terminal, which is not specifically limited in this application.
[0066] Optionally, the client 100 can be a client of some data analysis type for obtaining causal relationships between data. In specific implementation, in different application scenarios, the client 100 is used to identify different types of causal relationships. For example, in the field of public health, the client 100 can analyze epidemic data to determine the causal relationship between the vaccination of a certain vaccine and the spread of the epidemic, and help decision makers formulate immunization strategies; in the financial field, the client 100 can analyze financial data to determine the causal relationship between GDP and the stock market index. These causal relationships can be used to predict and manage risks in the financial market so that investors and financial institutions can make corresponding decisions and risk management strategies; in the field of marketing, the client 100 can analyze business data to determine the causal relationship between commodity sales and advertising channels and promotion strategies, thereby providing companies with better marketing strategies and advertising strategies; in the field of autonomous driving, the client 100 can analyze vehicle sensor data, such as cameras, radars, acceleration sensors, etc., to determine the causal relationship between different sensor data and the acceleration, steering, and braking of the vehicle. The causal relationship can be used to improve the control algorithm and reaction speed of the vehicle, thereby improving the safety of the system and driving comfort. It should be understood that the above examples are for illustration and are not specifically limited in this application.
[0067] Optionally, client 100 may also be some application clients that need to use the causal discovery function. For example, in the financial field, client 100 may be a client that recommends stock purchase strategies. The client can analyze financial data, determine the causal relationship between some variables and stock market indexes, and predict risks in the financial market based on these causal relationships to generate stock purchase strategies. For example, in the field of autonomous driving, client 100 may be a client on an autonomous driving vehicle. The client can analyze sensor data, determine the causal relationship between different sensor data and the vehicle's acceleration, steering, braking and other behaviors, and improve the vehicle's control algorithm and reaction speed based on these causal relationships, thereby improving the system's safety and driving comfort. The above examples are for illustration only and are not specifically limited in this application.
[0068] Optionally, the client 100 can also be a console of the cloud platform, which provides the user with the function of causal discovery as a sub-service of the cloud platform. The user can use the causal relationship discovery method provided by this application by purchasing cloud services. In a specific implementation, the user can purchase the training service of the causal relationship discovery method provided by this application, and the cloud platform can provide the user with a training platform. The user can input parameters such as knowledge set, data set, number of groups, etc. through the training platform in combination with business needs, and the cloud platform uses the causal relationship discovery method provided by this application to train the causal discovery model. The user can also purchase the reasoning service of the causal relationship discovery method provided by this application, and the cloud platform can provide the user with a trained causal discovery model. The user can input the data to be processed into the causal discovery model to obtain multiple causal graphs of the data to be processed. The user can choose to use the training service and / or reasoning service in combination with his own business needs, which is not specifically limited in this application. In a specific implementation, the console can be a web-based client, an application client, or an application programming interface (API), which is not specifically limited in this application.
[0069] The causal relationship discovery system 200 is used to receive the data set, knowledge set, penalty threshold and training parameters sent by the client 100, train the causal discovery model using the data set, knowledge set, penalty threshold and number of groups, obtain at least one causal graph of the data to be processed, each causal graph may include multiple causal relationships, and then return the at least one causal graph to the client 100. In some application scenarios, the causal relationship discovery system 200 may also send the at least one causal graph to the storage system 300 for storage.
[0070] The storage system 300 is used to receive and store at least one causal graph sent by the causal relationship discovery system 200. In a specific implementation, the storage system 300 may be a database, a file system, or a cloud storage system, etc., which is not specifically limited in this application.
[0071] Furthermore, the storage system 300 can be connected to the causal reasoning system and send at least one stored causal graph to the causal reasoning system. The system can evaluate, verify and further reason on the at least one causal graph, such as inferring whether the causal relationship in each causal graph really exists and the strength of the causal relationship, to obtain a causal inference result. The causal reasoning system can feed back the causal inference result to the client 100, or send the causal inference result to the decision system to generate a decision result. The decision systems in different application scenarios may be different. For example, the decision system in the above-mentioned autonomous driving scenario can improve the vehicle's control algorithm and reaction speed based on these causal relationships, thereby improving the system's safety and driving comfort, or the decision system in the above-mentioned financial scenario can predict risks in the financial market based on these causal relationships and generate stock purchase strategies, etc. This application does not make specific limitations.
[0072] The causal relationship discovery system 200 and the storage system 300 can be deployed on a computing device, a computing device cluster or a terminal device, wherein the computing device includes a bare metal server (BMS), a virtual machine, a container or an edge computing device. BMS refers to a general physical server, such as an ARM server or an X86 server; a virtual machine refers to a complete computer system with complete hardware system functions and running in a completely isolated environment simulated by software. All the work that can be done in a physical computer can be done in a virtual machine. When creating a virtual machine in a computing device, part of the hard disk and memory capacity of the physical machine needs to be used as the hard disk and memory capacity of the virtual machine. Each virtual machine has an independent basic input / output system (CMOS), hard disk and operating system, and can operate the virtual machine like a physical machine; a container is a portable software unit that can merge an application and all its dependencies into a software package that is not limited by the underlying host operating system, so there is no need to build a complex environment, simplifying the process from application development to deployment; an edge computing device refers to a device that is closer to the data source and end user, with low latency and high bandwidth characteristics, such as smart routing, edge servers, etc. The computing device cluster may include multiple computing devices as described above, such as a data center, which is not specifically limited in this application; the description of the terminal device can refer to the aforementioned content and will not be repeated here.
[0073] Optionally, the causal relationship discovery system 200 can be deployed on the same terminal device as the client 100; or, the causal relationship discovery system 200 is deployed on a computing device, and the client 100 is deployed on a terminal device; or, the causal relationship discovery system 200 is deployed on a computing device cluster, and the client 100 is deployed on a terminal device. It should be understood that the above examples are for illustration purposes only, and the specific deployment of the causal relationship discovery system 200 and the client 100 can be determined based on the actual application scenario.
[0074] Optionally, the causal relationship discovery system 200 can be deployed on the same computing device as the storage system 300; or, the causal relationship discovery system 200 and the storage system 300 are deployed on different computing devices in the same computing device cluster; or, the causal relationship discovery system 200 and the storage system 300 are deployed on different computing devices in different computing device clusters, and this application does not make specific limitations. For example, the causal relationship discovery system 200 can be any one in a data center, and the storage system 300 is deployed on another computing device in the data center, or the storage system 300 is deployed in other data centers. The above examples are for illustration only and this application does not make specific limitations.
[0075] Further, Figure 2 The causal relationship discovery system 200 in the embodiment can be further divided into a plurality of unit modules. For example, Figure 2 is a schematic diagram of the structure of the causal relationship discovery system 200 provided by the present application, such as Figure 2 As shown, the causal relationship discovery system 200 may include an acquisition unit 211, a grouping unit 212, a training unit 213, a knowledge injection unit 214, a penalty unit 215, a grouping update unit 216, a grouping prediction unit 217, and an output unit 218. It should be understood that Figure 2 This is an exemplary division method. The causal relationship discovery system 200 may also include more or fewer units, which is not specifically limited in this application.
[0076] Among them, the acquisition unit 211, the grouping unit 212, the training unit 213, the knowledge injection unit 214, the penalty unit 215, the grouping update unit 216, the grouping prediction unit 217 and the output unit 218 can be implemented by software or by hardware. Exemplarily, the implementation of the training unit 213 is introduced below by taking the training unit 213 as an example. Similarly, the implementation of the acquisition unit 211, the grouping unit 212, the knowledge injection unit 214, the penalty unit 215, the grouping update unit 216, the grouping prediction unit 217 and the output unit 218 can refer to the implementation of the training unit 213.
[0077] The training unit 213 is an example of a software functional unit. The training unit 213 may include code running on a computing instance. The computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Furthermore, the computing instance may be one or more. For example, the training unit 213 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers for running the code may be deployed in the same data center or in different data centers. When the multiple hosts / virtual machines / containers for running the code are deployed in different data centers, the different data centers may be distributed in the same region or in different regions. The region here is used to describe the location of the data center. The data centers in the same region share public services such as elastic computing, block storage, and object storage. The different data centers may also be distributed in the same availability zone (AZ) or in different AZs. Each AZ includes one data center or multiple data centers with similar geographical locations. An AZ is a collection of one or more physical data centers. The computing, network, storage, and other resources are logically divided into multiple clusters in the AZ. Usually, a region can include multiple AZs, and multiple AZs in a region are connected by high-speed optical fibers to meet the needs of users to build high-availability systems across AZs.
[0078] The training unit 213 is an example of a hardware functional unit. The training unit 213 can also be implemented by an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD can be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof. For example, the training unit 213 can be implemented by a data processing unit (DPU), which is not limited in the present application.
[0079] Need to explain, Figure 2The structure shown may be an implementation of the causal relationship discovery system 200 deployed on a single computing device. When the causal relationship discovery system 200 is deployed on a computing device cluster consisting of multiple computing devices, different computing devices in the computing device cluster may respectively store instructions for implementing the functions of the acquisition unit 211, the grouping unit 212, the training unit 213, the knowledge injection unit 214, the penalty unit 215, the grouping update unit 216, the grouping prediction unit 217 and the output unit 218. For example, computing device A in the computing device cluster stores instructions for implementing the acquisition unit 211, the grouping unit 212, the training unit 213, the knowledge injection unit 214, the penalty unit 215 and the grouping update unit 216, and computing device B stores instructions for implementing the functions of the grouping prediction unit 217 and the output unit 218. Of course, different computing devices may also store the same instructions. For example, computing device A and computing device C both store instructions of the acquisition unit 211, the grouping unit 212, the training unit 213, the knowledge injection unit 214, the penalty unit 215, and the grouping update unit 216, which are used to combine and implement the functions of the above-mentioned acquisition unit 211, the grouping unit 212, the training unit 213, the knowledge injection unit 214, the penalty unit 215, and the grouping update unit 216. This application does not make specific limitations.
[0080] The functions of each unit module in the causal relationship discovery system 200 are described below.
[0081] The acquisition unit 211 is used to acquire a data set.
[0082] In an embodiment of the present application, a data set includes multiple observation data, and the multiple observation data may include feature variables, target variables, and confounding variables, wherein the feature variables are input variables used to infer causal relationships, the target variables are variables that are expected to be predicted or inferred, that is, predicted results, and the confounding variables are other variables that may affect the relationship between the feature variables and the target variables. In some embodiments, the data set may also include irrelevant variables, which may be irrelevant to the causal relationship between the feature variables and the target variables, or have little effect on the causal relationship, but still exist in the data. For example, in the example of autonomous driving, the feature variables may be the acceleration, speed, road conditions, traffic signs, etc. of the vehicle, the target variables may be the predicted results of the vehicle behavior, such as braking, steering, etc., the confounding variables may be the vehicle model, load, weather conditions, etc., and the irrelevant variables may be the license plate number, vehicle color, air conditioning temperature, etc. It should be understood that the above examples are used for example, and the present application does not make specific limitations.
[0083] Furthermore, the multiple observation data in the data set may be observation data from multiple objects, wherein each object refers to a single observation unit, individual or entity in the data set. For example, an object may be a person, a car, a family, a company, etc., depending on the actual application scenario. Objects usually have unique identifiers or identities to distinguish observation data of different objects. In a specific implementation, the above-mentioned multiple observation data may also be data obtained by multiple observations of each object. For example, a data set includes y observation data of x objects, and one observation data of each object may include the above-mentioned feature variables, target variables, interference variables and irrelevant variables.
[0084] For example, taking the above-mentioned autonomous driving scenario as an example, the data set consists of multiple observation data of multiple objects (car A, car B, car C). Each object records the acceleration, speed, road conditions, traffic signs of the vehicle at different times, and also records the corresponding vehicle behavior, such as braking and steering. At the same time, it also records the weather conditions, load, vehicle model, license plate number, vehicle color, air conditioning temperature, etc. at the time. The causal discovery model can obtain the causal relationship between variables from these data, analyze the impact of various factors on vehicle behavior, and realize the automatic driving of the vehicle. For another example, taking the financial scenario as an example, the data set consists of multiple observation data of multiple objects (company A, company B, company C). Each observation data of each object can be obtained from the quarterly report or annual report of each object. Each observation data includes one or more of the company's financial data (such as sales, profit, R&D expenditure, etc.), operating data (such as the number of employees, number of product releases, customer satisfaction, etc.), and financial index data (such as the overall industry growth rate, gross domestic product, inflation rate, etc.). The causal discovery model can obtain the causal relationship between variables from these data and analyze the correlation and impact between different companies' financial decisions and financial indexes.
[0085] Furthermore, there may be at least one causal graph for multiple observation data in the data set, and each causal graph may include a causal structure and a quantitative relationship value, wherein the causal structure describes the causal relationship between variables, and the quantitative relationship value describes the strength of these causal relationships. In a specific implementation, different objects may correspond to the same or different causal graphs. In other words, some objects in the data set can share a causal graph, while the causal graphs of the observation data of some objects are different and cannot share a causal graph. It should be noted that at least one causal graph existing in the observation data is unknown, and it is necessary to infer at least one causal graph existing in the observation data through the causal discovery algorithm provided in this application.
[0086] Optionally, different objects correspond to different causal graphs, which may be due to different causal structures of different objects. For example, in the medical field, some drugs are effective for young people but not for the elderly. Then the causal graph for young people contains the causal relationship between the drug and the treatment effect, while the causal graph for the elderly does not contain the causal relationship. The objects here refer to people of different ages, and there are differences in the causal graphs of different objects in this application scenario. For example, in the financial scenario, Company A is a large company and Company B is a small company. Then some financial indicators of Company A have an impact on its business decisions, but Company B may not have an impact. The objects here refer to different companies, and the causal structures of different objects in this application scenario are different, so there are differences in the causal graphs.
[0087] Alternatively, the causal graphs corresponding to different objects are different, which may also be because the causal structures of different objects are the same but the quantitative relationship values are different, that is, the strength of the causal relationship between different objects is different. For example, the same causal structure: vehicle speed → fuel consumption, that is, vehicle speed will affect fuel consumption. For small cars, an increase in vehicle speed will lead to an increase in fuel consumption, but for large trucks, since they often run on highways, most large trucks have energy-saving designs, resulting in a relatively small impact of vehicle speed on fuel consumption for large trucks. Therefore, in this example, the causal structures corresponding to different individuals are the same but the quantitative relationship values are different, so the causal graphs of the two are also different. For another example, the same causal structure: exercise frequency → weight, that is, exercise frequency will affect weight, but for person A, an increase in exercise frequency will directly lead to a significant weight loss, and for person B, an increase in exercise frequency has little effect on weight, and may need to combine diet and lifestyle habits to achieve weight loss. The reason for the difference in the above causal graphs may be that there are differences in the metabolism and physical state of person A and person B, resulting in the same causal structure corresponding to different individuals in this application scenario, but different quantitative relationship values, so the causal graphs of the two are also different. The above examples are for illustration only and are not specifically limited in this application.
[0088] It is understandable that, since multiple observation data in a data set may include multiple causal graphs, if the traditional causal discovery method described in the background technology is used to process them, only a causal graph consisting of multiple strong causal relationships can be obtained in the end. This causal graph may be a causal graph of a certain object, or it may be an erroneous causal graph that does not belong to any object and is pieced together by multiple strong causal relationships. In order to solve this problem, the present application divides the observation data into multiple category groups through the grouping unit 212 and the grouping update unit 216, so that the observation data of objects that share the causal graph can be divided into one category group, and objects that do not share the causal graph are divided into different category groups. Then, the observation data of multiple category groups are used by the training unit 213 to train multiple sub-models, and one category group corresponds to one sub-model, thereby obtaining multiple causal graphs corresponding to multiple category groups, that is, multiple causal graphs corresponding to the data set. The following is a detailed explanation of how the grouping unit 212, the grouping update unit 216 and the training unit 213 implement the above process.
[0089] In a possible implementation, the acquisition unit 211 is further used to obtain the number of groups input by the user, and the grouping unit 212 is used to divide the multiple observation data in the data set into multiple category groups according to the number of groups, wherein each category group includes the observation data of at least one object. Each object has its corresponding category group. The grouping update unit 216 is used to update the multiple category groups generated by the grouping unit 212. In a specific implementation, the grouping update unit 216 can be combined with multiple rounds of training by the training unit 213 to perform multiple rounds of updates on the multiple category groups, so that the objects in each category group are multiple objects that share a common causal graph.
[0090] In a specific implementation, the grouping unit 212 can determine a corresponding number of multiple category groups according to the number of groups, and then randomly allocate the observation data of the objects in each category group. For example, the observation data of multiple objects are randomly allocated into multiple category groups by sampling without replacement. Of course, other sampling methods can also be used to implement the above process, which is not specifically limited in this application.
[0091] Optionally, the grouping unit 212 may also allocate the observation data of the objects in each category group according to preset rules, so that the objects sharing the causal graph are allocated to the same category group as much as possible. The preset rules may be determined specifically according to the actual application scenario. For example, the preset rules may be to group company objects of the same size and similar fields into one category group, or to group vehicle objects of the same brand and similar configuration into one category group, or to group user objects in the same region into one category group, and so on. Specifically, according to the actual application scenario, multiple objects that may share a causal graph may be placed in the same category group, and the present application is not limited to this.
[0092] It should be noted that the user can input the number of groups according to the actual application scenario and experience. For example, based on the deviation of the objects in the observed data, it is determined that the number of possible causal graphs is at least 2, and the number of groups input is also at least 2; the number of groups can also be input and the training results are obtained, and then the number of groups is adjusted according to the training results until the best training results are achieved. For example, the number of groups is 10, and the training results show that 2 of the 10 causal graphs obtained are the same or similar. In other words, these two causal graphs not only have the same or similar causal structures, but also the same or similar quantitative relationship values. Then the user can change the number of groups from 10 to 8, and then use the number of groups 8 for further training. The above examples are for illustration only and are not specifically limited in this application.
[0093] The training unit 213 is used to train the causal discovery model 220 using the observation data of multiple category groups to obtain multiple initial causal graphs, wherein the causal discovery model 220 includes multiple sub-models, and one category group is used to train one sub-model to obtain the initial causal graph of the corresponding category group.
[0094] In a specific implementation, the training unit 213 may use the observed data of category group 1 to train the group 1 sub-model to obtain the causal relationship of category group 1. Figure 1 , use the observed data of category group 2 to train the group 2 sub-model to obtain the causal relationship of category group 2 Figure 2 , and so on, k category groups can obtain k causal graphs. Moreover, the above training process can be trained in parallel according to the processing power. Among them, the above sub-models may include but are not limited to convolutional neural network (CNN), recurrent neural network (RNN), graph neural network (GNN), long short-term memory network (LSTM), etc., which are not specifically limited in this application. At the same time, when using k category groups to train k sub-models, some causal discovery algorithms can be selected according to the application scenario, such as PC, FCI, Notears, Notears-MLP, etc., which are not specifically limited in this application.
[0095] It should be noted that the causal discovery algorithms used by different sub-models are the same, but the observation data used to train different sub-models are different. One category group is used to train one sub-model, so that each sub-model can generate an initial causal graph of the corresponding category group, thereby obtaining multiple initial causal graphs of the data set.
[0096] The grouping updating unit 216 is used to update the objects in the category group according to the multiple initial causal graphs obtained by the training unit 213, and determine the category group corresponding to the observation data of each object.
[0097] Optionally, the grouping update unit 216 may substitute the observed data of each object into each initial causal graph, and determine the category group corresponding to each object according to the substitution result of each initial causal graph. In a specific implementation, the loss value of each initial causal graph may be determined according to the substitution result of each initial causal graph, and then the category group corresponding to the initial causal graph with the smallest loss value is determined as the category group of the object. For example, the observed data of object A is substituted into k initial causal graphs to obtain k loss values, and the minimum value among the k loss values is the causal group. Figure 3 The loss value is, then the causal Figure 3 The corresponding category group 3 is the category group corresponding to the object A. Similarly, the category groups corresponding to the observation data of other objects can be obtained, thereby obtaining multiple updated category groups.
[0098] It should be understood that each initial causal graph is generated after training the sub-model using the category group, and the model parameters are updated by minimizing the loss function. The smaller the loss function, the better the model fits the potential causal structure in the observed data, and the causal graph generated by the model can more accurately describe the causal relationship between the observed data. Therefore, the smaller the loss value obtained by substituting the observed data of each object into the causal graph, the more the causal relationship described by the causal graph fits the causal relationship implied by the observed data of the object. In this way, the objects in each category group are updated, which can ensure that the multiple objects in the category group finally obtained are objects with a common causal graph, and the causal graphs of objects in different category groups are different.
[0099] Optionally, the grouping update unit 216 updates the category group to obtain multiple updated category groups, and the training unit 213 can use each updated category group to train the corresponding sub-model, and then obtain multiple updated initial causal graphs, and then substitute the observation data of each object into the updated multiple initial causal graphs, and determine the category group of each object according to the loss value of the multiple initial causal graphs, and so on, until the preset conditions are met, and multiple causal graphs corresponding to the multiple category groups are obtained. The preset condition here can be the number of updates, or it can be that the objects in the category group are no longer changed after x consecutive rounds of updates, such as x is 2, and this application does not make specific limitations.
[0100] It should be understood that through multiple rounds of updates to the category groups, objects sharing the causal graph can be gradually divided into the same category group, and the sub-model can be trained using the observation data of the objects sharing the causal graph. In this way, even if the causal relationship in the causal graph of this category group is weak, the corresponding causal graph can be output, thereby solving the problem that the current causal discovery algorithm can only generate a single causal graph, and also solving the problem that the current causal discovery algorithm is prone to causal structure fusion.
[0101] In a possible implementation, the acquisition unit 211 is further used to acquire a knowledge set input by a user, and the training unit 213 trains multiple sub-models in combination with the data set and the knowledge set. Specifically, the training unit 213 can train multiple sub-models in combination with the knowledge set and the observation data of multiple category groups, and each sub-model is trained using the observation data of different category groups, but shares the same knowledge set.
[0102] In a specific implementation, the knowledge set may include at least one known causal relationship determined by a causal direction, wherein the causal direction is used to describe that the change of one variable leads to the change of another variable, that is, one variable is considered to be a cause variable, and the other variable is considered to be a result variable, and the causal direction describes that the effect of this causal relationship is from the causal variable to the result variable. The causal direction can be unidirectional, indicating that the cause variable affects the result variable. The determination of the causal direction refers to the determination of the cause variable and the result variable in the causal relationship. For example, rain (cause) may cause the ground to be wet (result), but the wet ground will not cause rain, so the causal direction between "precipitation" and "ground humidity" is determined, that is, precipitation → ground humidity.
[0103] Furthermore, known causal relationships refer to known causal relationships between multiple variables in a data set. Each known causal relationship is obtained based on prior knowledge. This prior knowledge is used to guide the model to discover causal relationships. This prior knowledge can come from the experience of domain experts, domain theories, research results, etc. It should be understood that when the number of samples in a data set is small, the coverage and diversity of the data will be reduced. Only one-sided or even wrong causal relationships can be discovered through the data set. This application combines prior knowledge with the data set through a knowledge set, which can improve the accuracy of causal discovery in small data volume scenarios.
[0104] Optionally, the knowledge set may include a first causal relationship with a determined causal direction and a determined quantitative relationship value. The description of the causal direction may refer to the aforementioned content. The quantitative relationship value refers to a specific numerical expression of the causal relationship between two variables, which is used to measure the specific situation of the quantitative relationship. The quantitative relationship value determination means that this specific numerical expression is determined. For example, for every increase of one unit in X, Y increases by 10 units, or A has a 5% effect on B. The above examples are for illustration and are not specifically limited in this application.
[0105] In the specific implementation, the content and acquisition method of the first causal relationship in different application scenarios are different. Taking the financial scenario as an example, the first causal relationship with a causal direction determined and a quantitative relationship value determined can be obtained according to a large number of indicator calculation formulas in the scenario. For example, the days sales outstanding (DSO) is a financial indicator used to measure the company's accounts receivable management efficiency. It represents the average time from the generation of sales to the actual payment of customers. The lower the DSO, the faster the company converts sales into cash, thereby better managing working capital. The calculation formula of DSO is as follows: DSO = (accounts receivable / total sales) * days. In this example, in the causal relationship obtained based on prior knowledge (financial indicators), the causal direction is determined: accounts receivable have an impact on the value of DSO, and the quantitative relationship value is determined: DSO = (accounts receivable / total sales) * days, so the prior knowledge can be used as the first causal relationship in the knowledge set to participate in the training of each sub-model. It should be understood that the above examples are for illustration and are not specifically limited in this application.
[0106] For another example, taking the autonomous driving scenario as an example, the first causal relationship with a causal direction determined and a quantitative relationship value determined can be derived from a large number of physical formulas in the scenario. For example, the relationship between the braking strength of the vehicle and the stopping distance of the vehicle can be derived based on Newton's second law F=ma (force equals mass multiplied by acceleration), where force can represent the braking force, and mass is the mass of the vehicle. According to this formula, the deceleration a of the vehicle under different braking forces can be determined, and the parking time and parking distance of the vehicle can be derived according to the current speed and deceleration, thereby obtaining the derivation formula between the braking force and the parking distance, and then combining the relationship between different braking strengths and braking forces, thereby deriving the derivation formula between the braking strength and the parking distance. In this example, in the causal relationship obtained according to the prior knowledge (physical theoretical knowledge), the causal direction is determined: the braking strength affects the parking distance, and the quantitative relationship value is determined: the derivation formula between the above braking strength and the parking distance, so the prior knowledge can be used as the first causal relationship in the knowledge set to participate in the training of each sub-model. It should be understood that the above examples are for illustration and are not specifically limited in this application.
[0107] In a specific implementation, for the first causal relationship with a determined causal direction and a determined quantitative relationship value, when the training unit 213 trains each sub-model, the model parameters that control the output of the first causal relationship can be frozen and not participate in the back propagation during the training process. In short, a part of the parameters of the sub-model are initialized through the first causal relationship, and then during the training process, only the uninitialized parameters are allowed to be adjusted, so as to ensure that the model parameters that control the output of the first causal relationship will not change with the model training, and ensure that the causal graph output by the model includes the above-mentioned known first causal relationship. It should be understood that the sub-model includes multiple parameters, each parameter is used to describe the strength, direction and type of the possible causal relationship between the variables, and the parameters of the model are continuously optimized by training the model, so that the model can accurately reflect the causal relationship in the input observation data. Therefore, in order to ensure that the causal graph output by the model includes the first causal relationship, the frozen parameters can be parameters related to the first causal relationship, such as freezing the weight of the edge between the two variables of the first causal relationship in the causal graph, and the weight of the edge will not be trained during model training, so as to ensure that the causal graph output by the model includes the above-mentioned first causal relationship determined according to prior knowledge. Or freeze the element corresponding to the first causal relationship in the causal adjacency matrix so that it no longer changes with the training of the model, wherein the causal adjacency matrix is usually used to represent the causal relationship between variables during the training process, the rows and columns of the matrix represent different variables, and the elements in the matrix represent the causal relationship between these variables, and in the causal adjacency matrix, the element value corresponding to the determined causal direction is represented as a non-zero positive number. On the contrary, if there is a negative causal relationship, the element value is a negative number. The above examples are for illustration and are not specifically limited in this application.
[0108] Optionally, the knowledge set may include a second causal relationship with a determined causal direction and a quantitative relationship value that is a non-zero unknown value. The description of the causal direction and the quantitative relationship value can refer to the above content, which will not be repeated here, wherein the non-zero quantitative relationship value means that it is determined that there is a certain numerical relationship between the two variables, but this relationship cannot be described by a specific numerical value.
[0109] For example, in the field of finance, based on the known viewpoints in economic theory: increasing the money supply may lead to an increase in the inflation rate, and we can know that the causal direction between the money supply and the inflation rate is: money supply → inflation rate, but the impact of the money supply on the inflation rate is affected by many factors, such as output level, market expectations, monetary policy, etc. Therefore, although it is determined based on the known viewpoints that an increase in the money supply may be related to an increase in the inflation rate, it is impossible to provide a specific, universal quantitative formula to accurately predict the magnitude of inflation changes, so based on this prior knowledge, we can only obtain a second causal relationship with a determined causal direction and a non-zero quantitative relationship value.
[0110] To give another example, in the field of autonomous driving, based on driving experience that “roads are slippery on rainy days and accidents are prone to occur”, we can know that the causal direction between rainfall and accident rate is: rainfall → accident rate. However, driver behavior, vehicle technology, etc. will also have an impact on the accident rate. Therefore, although it is determined based on known experience that an increase in rainfall may be related to an increase in the accident rate, it is impossible to provide a specific quantitative relationship value to accurately describe the relationship between the increase in rainfall and the increase in the accident rate. Therefore, based on this prior knowledge, only a second causal relationship with a determined causal direction and a non-zero quantitative relationship value can be obtained.
[0111] In a specific implementation, when the sub-model is trained using the second causal relationship with a determined causal direction and a non-zero unknown value of the quantized relationship value, the training unit 213 can set the causal direction to be determined and the quantized relationship value to be non-0 according to the second causal relationship, and then train the model in combination with the constraint. It should be understood that since the quantized relationship value of the second causal relationship is unknown, it is necessary to learn the quantized relationship value by fitting the data in the data set during the model training process, so that the weight parameters of the model of the second causal relationship are continuously optimized with multiple rounds of training. However, in order to avoid the direction of the second causal relationship from changing during the training process, the constraint of the causal direction is set, so that the trained model can output the second causal relationship with the correct causal direction and the quantized relationship value inferred by the model.
[0112] Furthermore, the above-mentioned second causal relationship can be realized by the following constraints: setting a constraint greater than 0 for the elements in the causal adjacency matrix corresponding to the determined direction, and setting a constraint equal to 0 for the elements in the opposite direction. Among them, the causal adjacency matrix is usually used to represent causal relationships, the rows and columns of the matrix represent different variables, and the elements in the matrix represent the causal relationship between these variables. In the causal adjacency matrix, the element value corresponding to the determined causal direction is represented as a non-zero positive number. On the contrary, if there is a negative causal relationship, the element value is a negative number. Therefore, setting a constraint greater than 0 for the element corresponding to the causal relationship can ensure the existence of this causal relationship in the positive causal relationship, and setting a constraint equal to 0 for the opposite element corresponding to the causal relationship can ensure the non-existence of this causal relationship in the reverse direction. Such constraint settings can help the sub-model in the training process, even if the model parameters are continuously optimized, the causal direction in the second causal relationship output by the model will not change.
[0113] Optionally, the knowledge set may include a third causal relationship with a determined causal direction and an unknown quantitative relationship value. The description of the causal direction and the quantitative relationship value can refer to the aforementioned content and will not be repeated here. Among them, the unknown quantitative relationship value means that it is difficult to determine whether there is a certain numerical relationship between the two variables. There may be a certain numerical relationship, but the value is unknown, or there may be no numerical relationship between the two variables at all.
[0114] For example, in the financial field, according to expert experience, increasing advertising spending can increase sales, that is, the causal direction between advertising spending and sales is determined, but the actual increase in sales will also be affected by market demand, competition and other aspects. Under the influence of various factors, the increase in advertising spending may have a very small impact on sales, or even zero. Therefore, based on the above expert experience, only a third causal relationship with a determined causal direction and unknown quantitative relationship can be obtained.
[0115] To give another example, in the field of autonomous driving, based on theoretical knowledge, we can know that lidar technology will provide more accurate environmental perception, thereby improving the safety of autonomous vehicles. That is, the causal direction between the number of lidar units and driving safety is determined, but the degree of improvement in safety with each newly added lidar unit may vary depending on factors such as vehicle design and road conditions. It is possible that the degree of improvement in safety with a newly added lidar unit is very weak or even zero. Therefore, based on the above theoretical knowledge, we can only obtain a third causal relationship with a determined causal direction and an unknown quantitative relationship.
[0116] In a specific implementation, when the sub-model is trained using a third causal relationship with a determined causal direction and an unknown quantitative relationship, the training unit 213 can set a constraint that the causal direction is determined and the quantitative relationship is not restricted according to the third causal relationship, that is, a constraint that the quantitative relationship may be 0, and then train the model in combination with the constraint. Further, the above-mentioned third causal relationship can be implemented by the following constraint: the constraint equal to 0 is set for the element in the causal adjacency matrix corresponding to the opposite direction to be determined. With reference to the foregoing content, it can be known that in the causal adjacency matrix, the element value corresponding to the determined causal direction is represented as a positive number with a non-zero value. On the contrary, if there is a negative causal relationship, the element value is a negative number. Therefore, without constraining the positive elements, only constraining the reverse elements to 0, it can be ensured that there will be no reverse causal relationship in the third causal relationship, and at the same time, without constraining the positive causal relationship, the model can learn the quantitative relationship in the third causal relationship by fitting the data set, which may be 0 in the positive direction or a certain positive value. Such constraint setting can help the sub-model in the training process, even if the model parameters are continuously optimized, the causal direction in the third causal relationship output by the model will not change.
[0117] It should be noted that at least one known causal relationship in the knowledge set may be one or more of the first causal relationship, the second causal relationship, and the third causal relationship. Each known causal relationship may be a causal relationship between two variables or a causal relationship between more than two variables, that is, a causal graph. For example, the data set includes observation data of variables A to E, and the knowledge set includes the causal relationships among variables A, B, and C. Figure 1, there is a first causal relationship 1 between variable A and variable B, and there is a first causal relationship 2 between variable B and variable C. The two form a causal relationship Figure 1 However, the causal relationship between variables D, E and other variables is not determined. The causal relationship between variables A to E can be output through the sub-model. Figure 2 , the cause and effect Figure 2 Including the causal relationship between variables A, B and C Figure 1 The above examples are for illustration only and are not intended to be limiting in this application.
[0118] It should be understood that the present application trains the sub-model by combining a knowledge set and a data set, and the knowledge set includes at least one known causal relationship, which is at least a causal relationship determined by the causal direction, and can provide guidance for the training of the sub-model. When the data set has a small amount of data, the coverage and diversity of the data will be reduced, and only one-sided or even erroneous causal relationships can be discovered through the data set alone. The present application combines prior knowledge with the data set through the knowledge set, which can improve the accuracy of causal discovery in small data volume scenarios.
[0119] In a possible implementation, the acquisition unit 211 is further used to acquire a penalty threshold value input by a user, and the training unit 213 performs adaptive penalty training on the sub-model through the penalty unit 215 and the penalty threshold value input by the user. Specifically, when the training unit 213 trains multiple sub-models in combination with the knowledge set and the observation data of multiple category groups, each sub-model uses the penalty threshold value for adaptive penalty training.
[0120] Optionally, the loss function of the model includes a penalty parameter, the value of which is the same as the estimated value of the causal relationship output by the model in the previous round. A larger estimated value can be punished less, and a smaller estimated value can be punished more, thereby realizing the function of parameter correction. Among them, the larger the estimated value of the causal relationship, the stronger the causal relationship, and vice versa. It should be understood that if the output estimated value is large, the larger estimated value means that the model has a better fit to certain features of the data. If the larger estimated value is punished too highly, it may hinder the model from learning these important features, thereby affecting the performance of the model. Therefore, a lower penalty is imposed on the larger estimated value, and the constraint is small. This will not only not hinder the learning of the model, but also avoid underfitting of the model; on the contrary, if the output estimated value is small, the smaller estimated value means that the model cannot fit the complex relationship in the data. By imposing a higher penalty, the model is encouraged to pay more attention to the characteristics of the training data, improve the performance of the model, and a large constraint can avoid the problem of overfitting of the model. Therefore, using the estimated value of this round as a penalty parameter to participate in the next round of training can achieve the goal of imposing a lower penalty on larger parameter values and a higher penalty on smaller parameter values. This design can adaptively adjust the training objectives based on the results of each round of training, automatically solve the problems of overfitting and underfitting, and thus achieve parameter correction.
[0121] Optionally, the penalty threshold input by the user is used to determine the convergence condition of the model. Specifically, when the difference between the estimated value of the causal relationship output by the model and the estimated value of the causal relationship in the previous round is less than the penalty threshold, the model converges. In simple terms, when the difference between the estimated value output by the model and the estimated value output in the previous round is not less than the penalty threshold, the estimated value output in this round is used as the penalty parameter to perform the next round of training, and so on for multiple rounds of training until the difference between the estimated value output by the current round and the estimated value output by the previous round is less than the penalty threshold.
[0122] For example, the penalty parameter is initialized to 1, and then the model is trained to obtain the parameter estimate of the t-th round causal relationship of the k-th category group. When the difference between the estimate in round t and the estimate in round t-1 is less than the penalty threshold input by the user, a sub-model corresponding to the trained k-th category group is generated. If it is not less than the penalty threshold, the estimate in round t can be used as the penalty parameter to perform round t+1 training to obtain the parameter estimate of the t+1-th round causal relationship of the k-th category group. When the difference between the estimate in round t and the estimate in round t+1 is less than the penalty threshold input by the user, a sub-model corresponding to the k-th category group is generated. If it is not less than the penalty threshold, the estimate in round t+1 can be used as the penalty parameter to perform round t+2 training, and so on, until the difference between the estimate of the current output and the estimate of the previous round is less than the penalty threshold.
[0123] It should be understood that when the model estimates the causal relationship between variables, due to factors such as data noise and insufficient sample size, the individual estimated values output by the model may have certain deviations. This deviation may affect the accuracy of causal discovery, making the algorithm unable to fully capture the true causal structure. However, by using the estimated value of this round as a penalty parameter, the present application can achieve the goal of imposing lower penalties on larger parameter values and higher penalties on smaller parameter values, so that the model can adjust the parameter update amplitude according to the output of the estimated value during the training process. The adjustment amplitude of the model during multiple rounds of training is more stable. Even if a wrong estimated value appears, it will not cause a large swing in the parameter due to this wrong estimated value, thereby achieving the effect of correction.
[0124] It should be noted that the penalty parameter can be a penalty for a single parameter or a combination of multiple parameters. In other words, the penalty parameter can be an estimated value weight for a single causal relationship or an estimated value weight for multiple causal relationships, and this application does not make specific limitations.
[0125] In one possible implementation, the training unit 213 can also add directed acyclic graph (DAG) constraints to each sub-model so that the causal graph output by the trained model is an acyclic graph without cyclic relationships, thereby avoiding cyclic effects. In the presence of cycles, causal relationships become confusing and unexplainable. In other words, DAG constraints are used to ensure that the generated causal graph is reasonable and follows the basic properties of causality.
[0126] In an embodiment of the present application, the penalty unit 215 and the knowledge injection unit 214 are used to train multiple sub-models. After the model converges according to the penalty threshold input by the user, the corresponding initial causal graph is output, and then the objects in the category group are updated using the initial causal graph. Then, the updated category group is used to perform the next round of training on the multiple sub-models through the penalty unit 215 and the knowledge injection unit 214. After the model converges according to the penalty threshold input by the user, the updated initial causal graph is output, and then the objects in the category group are updated using the updated initial causal graph. Similarly, the category groups are updated for multiple rounds until the objects in each category group no longer change, and each sub-model can output the causal graph corresponding to each category group.
[0127] Furthermore, the acquisition unit 211 can also be used to acquire data to be processed outside the data set. The data to be processed includes observation data of one or more objects to be processed. For details, please refer to the description of observation data and objects in the above content, which will not be repeated here.
[0128] The grouping prediction unit 217 can also determine the category group corresponding to each object to be processed in the data to be processed based on the above-mentioned multiple causal graphs, and then determine the causal graph corresponding to each object to be processed based on the category group corresponding to each object to be processed, thereby obtaining one or more causal graphs corresponding to the data to be processed.
[0129] Optionally, the observation data of each object to be processed can be substituted into multiple causal graphs respectively, and the category group corresponding to each object to be processed can be determined according to the loss value of each causal graph. In a specific implementation, the category group corresponding to the causal graph with the smallest loss value is the category group corresponding to the object to be processed.
[0130] The output unit 218 can output the above one or more causal graphs to the client 100. Or send one or more causal graphs to the storage system 300 for storage, and the storage system 300 can be connected with some application systems to complete causal inference based on the causal graph, or other further processing, which is not specifically limited in this application.
[0131] It should be understood that if the data to be processed deviates greatly from the data in the data set, for example, a new causal structure emerges, the number of groups can be modified at this time, and the multiple sub-models in the sub-model can be further trained using the data to be processed to obtain multiple updated category groups until the objects in the category group no longer change.
[0132] It should be understood that Figure 1 This is an exemplary division method. In some embodiments, the causal relationship discovery system 200 may also include more or fewer unit modules. The following examples are given as examples. It should be noted that the multiple implementation methods listed below are only some possible implementation methods provided by this application, but the scope of protection of this application is not limited to this. Any technician familiar with this technical field can easily think of various equivalent repairs or replacements within the technical scope disclosed in this application, and these repairs or replacements should be covered within the scope of protection of this application.
[0133] In a possible implementation, the causal relationship discovery system 200 may include a training unit 213, a knowledge injection unit 214, an acquisition unit 211, and an output unit 218. That is, during model training, each sub-model is trained in combination with a data set and a knowledge set. The sub-model combines prior knowledge with the data set through the knowledge set, which can improve the accuracy of causal discovery in a small data volume scenario. For details, please refer to the relevant description of the knowledge injection unit 214, which will not be repeated here.
[0134] In another possible implementation, the causal relationship discovery system may include a training unit 213, a knowledge injection unit 214, a penalty unit 215, an acquisition unit 211, and an output unit 218. That is, during model training, not only is the sub-model trained in conjunction with the knowledge set, but also the penalty unit 215 is used during the model training process to make the model parameters converge smoothly and achieve parameter correction. This sub-model not only combines prior knowledge with the data set, but also can achieve automatic parameter correction, further improving the accuracy of causal discovery in small data volume scenarios.
[0135] In another possible implementation, the causal relationship discovery system 200 may include a training unit 213, a grouping unit 212, a grouping update unit 216, an acquisition unit 211, a grouping prediction unit 217, and an output unit 218. That is, during model training, the data set is divided into multiple category groups, and the observation data of objects sharing the causal graph are divided into the same category group. Then, multiple sub-models are trained using multiple category groups to obtain multiple causal graphs corresponding to the multiple category groups. The system can identify multiple causal graphs in a data set, solving the problem that the current causal discovery algorithm can only identify a single causal graph, which is prone to causal graph omissions.
[0136] In another possible implementation, the causal relationship discovery system 200 may include a training unit 213, a grouping unit 212, a knowledge injection unit 214, a grouping update unit 216, an acquisition unit 211, a grouping prediction unit 217 and an output unit 218. That is, during model training, the data set is divided into multiple category groups by the grouping unit 212 and the grouping update unit 216, and multiple sub-models are trained using the multiple category groups. At the same time, each sub-model is additionally trained in combination with the knowledge set.
[0137] In another possible implementation, the causal relationship discovery system 200 is Figure 1 The structure shown, that is, during model training, the data set is divided into multiple category groups through the grouping unit 212 and the grouping update unit 216, and then the multiple category groups are used to train multiple sub-models, one category group corresponds to one sub-model, and each sub-model is not only trained in combination with the knowledge set during the training process, but also the model is adaptively punished through the penalty unit 215, so that the model parameters converge smoothly and parameter correction is achieved.
[0138] In summary, the causal relationship discovery system provided by the present application divides the data set into multiple initial category groups according to the number of groups input by the user, and then uses the multiple initial category groups to train multiple sub-models to obtain multiple initial causal graphs, and then substitutes each object in the data set into the multiple initial causal graphs to obtain multiple loss values, and then determines the causal graph that best fits each object according to the multiple loss values of each object, and then determines the category group to which each object belongs, thereby updating the objects in the initial category group, and then uses the updated multiple category groups to further train multiple sub-models to obtain multiple updated initial causal graphs, and then substitutes each object in the data set into the multiple updated initial causal graphs to obtain multiple loss values of each object, and determines the category group to which each object belongs based on the multiple loss values of each object, thereby updating the updated initial category group again, and so on, until the objects in the category group no longer change, the objects in the category group determined in this way are objects that share the causal graph, and the causal graph output by each sub-model is the causal graph corresponding to the category group, thereby obtaining multiple causal graphs corresponding to the data set, which can solve the problem that the current causal discovery algorithm can only identify a single causal structure and cannot mine multiple causal structures from the data.
[0139] At the same time, during the training process, each sub-model is trained in combination with a knowledge set, which includes known causal relationships determined by multiple causal directions. These known causal relationships can provide guidance for the training of sub-models. When the data set is small, the coverage and diversity of the data will be reduced, and only one-sided or even erroneous causal relationships can be discovered through the data set alone. This application combines prior knowledge with the data set through the knowledge set, which can improve the accuracy of causal discovery in small data volume scenarios.
[0140] Finally, during the training process, each sub-model uses the estimated value of this round as the penalty parameter for the next round of training, imposing lower penalties on larger parameter values and higher penalties on smaller parameter values. This allows the model to adjust the parameter update amplitude according to the estimated value output during the training process. The adjustment amplitude of the model is more stable during multiple rounds of training. Even if an erroneous estimated value appears, the parameter will not swing drastically due to this erroneous estimated value, thereby achieving the effect of correction.
[0141] Combination of the above Figure 1 and Figure 2 , describes in detail the causal relationship discovery system provided by this application, and will now be combined with Figures 3 to 5 , describing the causal relationship discovery method provided by this application.
[0142] Figure 3 This is a flowchart of the steps of a causal relationship discovery method provided by this application in the training phase, such as Figure 3As shown, the method comprises the following steps:
[0143] S310: The client 100 sends the knowledge set, data set, number of groups, and penalty threshold input by the user to the causal relationship discovery system 200. This step can be performed by Figure 2 The acquisition unit 211 in the embodiment is implemented.
[0144] In the specific implementation, the description of the data set, knowledge set, number of groups, and penalty threshold can be found in Figure 2 The relevant contents in the embodiments are not repeated here.
[0145] S320: The causal relationship discovery system 200 divides the data set into multiple category groups according to the number of groups. This step can be performed by Figure 2 The grouping unit 212 in the embodiment implements.
[0146] In a specific implementation, the causal relationship discovery system 200 can determine a corresponding number of multiple category groups according to the number of groupings, and then randomly assign multiple objects in the data set to multiple category groups, such as by sampling without replacement, and randomly assigning the observation data of multiple objects to multiple category groups. Of course, the causal relationship discovery system 200 can also use certain preset rules to assign each object so that objects sharing the causal graph are assigned to the same category group as much as possible. For example, the preset rule can be to group company objects of the same size and similar fields into one category group. The preset rule can be determined based on the actual application scenario, and this application does not limit this.
[0147] S330: Use multiple category groups and knowledge sets to perform adaptive penalty training on multiple sub-models to obtain multiple initial causal graphs. This step can be performed by Figure 2 The knowledge injection unit 214, the training unit 213 and the penalty unit 215 in the embodiment are implemented.
[0148] In the embodiment of the present application, a category group is used to train a sub-model to obtain the initial causal graph corresponding to the category group. That is to say, k category groups train k sub-models respectively. Among them, the possible implementation of the neural network can refer to Figure 2 The relevant contents in the embodiment are not repeated here. At the same time, when using k category groups to train k sub-models, some causal discovery algorithms can be selected according to the application scenario, and each sub-model uses the same algorithm, such as PC, FCI, Notears, Notears-MLP, etc., which is not specifically limited in this application.
[0149] In the embodiment of the present application, when training the corresponding sub-model, each category group can train the sub-model in combination with the knowledge set. In a specific implementation, the knowledge set may include known causal relationships determined by multiple causal directions, where the causal direction is used to describe that the change of one variable leads to the change of another variable, and the known causal relationship is determined based on prior knowledge, which includes but is not limited to the experience of domain experts, domain theories, research results, etc.
[0150] Optionally, the knowledge set may include a first causal relationship with a determined causal direction and a determined quantitative relationship value. The quantitative relationship value refers to a specific numerical expression of the causal relationship between two variables, which is used to measure the specific situation of the quantitative relationship. The quantitative relationship value determination means that this specific numerical expression is determined. For example, for every increase of one unit in X, Y increases by 10 units, or A has a 5% effect on B. The above examples are for illustration only and are not specifically limited in this application. Examples of the first causal relationship in various fields can be referred to. Figure 2 The relevant contents in the embodiments are not repeated here.
[0151] In a specific implementation, in the process of training each sub-model, for the first causal relationship with a determined causal direction and a determined quantitative relationship value, the model parameters that control the output of the first causal relationship can be frozen, and will not participate in the back propagation during the training process, to ensure that the causal graph output by the model includes the above-mentioned known first causal relationship. For example, the elements corresponding to the first causal relationship in the causal adjacency matrix are frozen so that they no longer change with the training of the model, wherein the causal adjacency matrix is usually used to represent the causal relationship between variables during the training process, the rows and columns of the matrix represent different variables, and the elements in the matrix represent the causal relationship between these variables, and in the causal adjacency matrix, the element value corresponding to the determined causal direction is represented as a non-zero positive number. Conversely, if there is a negative causal relationship, the element value is a negative number. The above examples are for illustration and are not specifically limited in this application.
[0152] Optionally, the knowledge set may include a second causal relationship with a determined causal direction and a quantitative relationship value that is a non-zero unknown value. The non-zero quantitative relationship value means that a certain numerical relationship is determined between the two variables, but the relationship cannot be described by a specific numerical value. Examples of the second causal relationship in various fields can be found in Figure 2 The relevant contents in the embodiments are not repeated here.
[0153] In a specific implementation, when the sub-model is trained using the second causal relationship with a determined causal direction and a non-zero unknown value of the quantitative relationship value, a constraint greater than 0 can be set for the element in the causal adjacency matrix corresponding to the determined direction, and a constraint equal to 0 can be set for the element in the opposite direction. It should be understood that since the quantitative relationship value of the second causal relationship is unknown, it is necessary to learn the quantitative relationship value by fitting the data in the data set during the model training process, so that the weight parameters of the model of the second causal relationship are continuously optimized with multiple rounds of training. However, in order to avoid the change in the direction of the second causal relationship during the training process, the constraint of the causal direction is set, so that the trained model can output the second causal relationship with the correct causal direction and the quantitative relationship value inferred by the model. Setting the constraint greater than 0 for the element corresponding to the causal relationship can ensure the existence of this causal relationship in the forward causal relationship, and setting the constraint equal to 0 for the opposite element corresponding to the causal relationship can ensure the non-existence of this causal relationship in the reverse direction. Such constraint setting can help the sub-model to keep the causal direction in the second causal relationship output by the model unchanged during the training process, even if the model parameters are continuously optimized.
[0154] Optionally, the knowledge set may include a third causal relationship with a determined causal direction and an unknown quantitative relationship value. The unknown quantitative relationship value means that it is difficult to determine whether there is a certain numerical relationship between the two variables. There may be a certain numerical relationship, but the value is unknown. There may also be no numerical relationship between the two variables. Examples of the third causal relationship in various fields can be found in Figure 2 The relevant contents in the embodiments are not repeated here.
[0155] In a specific implementation, when the sub-model is trained using a third causal relationship with a determined causal direction and an unknown quantitative relationship, a constraint equal to 0 can be set for the elements in the causal adjacency matrix that should be opposite to the determined direction. Referring to the foregoing content, it can be seen that in the causal adjacency matrix, the element value corresponding to the determined causal direction is represented as a non-zero positive number. On the contrary, if there is a negative causal relationship, the element value is a negative number. Therefore, without constraining the positive elements and only constraining the reverse elements to 0, it can be ensured that there will be no reverse causal relationship in the third causal relationship. At the same time, without constraining the forward causal relationship, the model can learn the quantitative relationship in the third causal relationship by fitting the data set. The positive direction may be 0 or a certain positive value. Such a constraint setting can help the sub-model in the training process. Even if the model parameters are continuously optimized, the causal direction in the third causal relationship output by the model will not change.
[0156] In an embodiment of the present application, each sub-model can also perform adaptive penalty training on the model in combination with the penalty threshold input by the user during the training process in combination with the knowledge set. Specifically, the loss function of the sub-model includes a penalty parameter, the value of which is the same as the estimated value of the causal relationship output by the model in the previous round. A larger estimated value can be punished less, and a smaller estimated value can be punished more, thereby realizing the function of parameter correction. Among them, the larger the estimated value of the causal relationship, the stronger the causal relationship, and vice versa.
[0157] It should be understood that if the output estimate is large, the large estimate means that the model has a good fit to certain features of the data. If the large estimate is punished too highly, it may hinder the model from learning these important features, thereby affecting the performance of the model. Therefore, a lower penalty is imposed on the larger estimate, which will not only not hinder the learning of the model, but also avoid underfitting of the model. On the contrary, if the output estimate is small, the smaller estimate means that the model cannot fit the complex relationship in the data. By imposing a higher penalty, the model is encouraged to pay more attention to the features of the training data, improve the model performance, and avoid the problem of overfitting of the model. Therefore, using the estimated value of this round as a penalty parameter to participate in the next round of training can achieve the goal of imposing a lower penalty on larger parameter values and a higher penalty on smaller parameter values. This design can adaptively adjust the training target according to the results of each round of training, automatically solve the problems of overfitting and underfitting, and thus achieve parameter correction.
[0158] In the specific implementation, when the difference between the estimated value output by the model and the estimated value output in the previous round is not less than the penalty threshold, the estimated value output in this round is used as the penalty parameter to carry out the next round of training. When the difference between the estimated value of the causal relationship output by the model and the estimated value of the causal relationship in the previous round is less than the penalty threshold, the model converges and the initial causal graph corresponding to the category group is obtained.
[0159] In order to make this application better understood, Figure 4 is a schematic diagram of the training process of each sub-model in the causal relationship discovery method provided in this application, such as Figure 4 As shown, when each sub-model undergoes multiple rounds of training, if the difference between the causal relationship estimation value output by each round of training and the causal relationship estimation value of the previous round is not less than the penalty threshold input by the user, then the sub-model continues to be trained. If it is less than the penalty threshold input by the user, then the training can be terminated to obtain the initial causal graph corresponding to the category group.
[0160] Among them, each round of training will use a penalty parameter to limit the adjustment range of the model parameters. The penalty parameter used in each round of training is the estimated value of this round of training. In this way, if the estimated value of this round of training is large, that is, the predicted causal relationship strength is high, then the adjustment range of the model parameters can be slightly constrained. If the estimated value of this round of training is small, that is, the predicted causal relationship strength is weak, then the adjustment range of the model parameters can be greatly constrained. In order to achieve the goal of applying lower penalties to larger parameter values and higher penalties to smaller parameter values, this design can adaptively adjust the training objectives according to the results of each round of training, automatically solve the problems of overfitting and underfitting, and thus achieve parameter correction.
[0161] Furthermore, the sub-models can be trained using knowledge sets and category groups, such as Figure 4 As shown, category group 1 and knowledge set train sub-model 1 to obtain causal Figure 1 , category group 2 and knowledge set train sub-model 2 to obtain causal Figure 2 , where sub-model 1 and sub-model 2 use the same causal discovery algorithm during training. However, since they use observation data from different categories for training, the causal relationships fitted by the sub-models obtained in the end are also different, and the causal graphs output by each sub-model are also different.
[0162] S340: Substitute the observation data of each object into multiple initial causal graphs to determine the category group to which each object belongs. This step can be done by Figure 2 The grouping update unit 216 in the embodiment is implemented.
[0163] In a specific implementation, the observation data of each object in the data set can be substituted into multiple initial causal graphs obtained in multiple steps S330, and each object can obtain multiple loss values. One loss value corresponds to one initial causal graph. The initial causal graph corresponding to the minimum loss value among the multiple loss values is the most suitable causal graph for the object, and the category group corresponding to the initial causal graph is the category group to which the object belongs. For example, the observation data of object A is substituted into k initial causal graphs to obtain k loss values. The minimum value among the k loss values is obtained by substituting into the initial causal graph of group 3, then object A will be divided into group 3. The above examples are for illustration only and are not specifically limited in this application.
[0164] S350: Update the objects in the category group. This step can be performed by Figure 2 The grouping update unit 216 in the embodiment is implemented.
[0165] In a specific implementation, after determining the category group corresponding to each object, the objects in the category group divided in step S320 may be updated to obtain a plurality of updated category groups.
[0166] S360: Determine whether the objects in the category group have not changed for multiple consecutive rounds. Specifically, if yes, execute step S370, if no, execute step S330. This step can be performed by Figure 2 The grouping update unit 216 in the embodiment is implemented.
[0167] In a specific implementation, the number of rounds in which no change occurs for consecutive rounds can be set by the user, for example, the number of rounds can be 2, that is, no change occurs for consecutive 2 rounds, or other values, which are not specifically limited in this application. It should be understood that the fact that no change occurs for consecutive rounds indicates that the objects in each category group are already objects of the shared causal graph, and therefore no longer need to be updated.
[0168] S370: According to the causal graph corresponding to each category group, multiple causal graphs corresponding to the data set are obtained. This step can be performed by Figure 2 The training unit 213 in the embodiment is implemented.
[0169] It should be understood that through multiple rounds of updates to the category group, objects with a common causal graph can be gradually divided into the same category group, and the sub-model trained for the category group is also obtained through multiple rounds of training using the observation data of the objects with a common causal graph, so that the sub-model corresponding to the category group gradually has the ability to predict the causal structure of the category group through multiple rounds of training, and a data set containing multiple causal structures can obtain the causal graph corresponding to each causal structure through multiple sub-models, thereby solving the problem that current causal discovery can only generate a single causal structure.
[0170] S380A: Return multiple causal graphs of the data set to the client. This step can be performed by Figure 2 The output unit 218 in the embodiment is implemented.
[0171] S380B: Send multiple causal graphs of the data set to the storage system. This step can be performed by Figure 2 The output unit 218 in the embodiment is implemented.
[0172] In a specific implementation, if the client is a client for obtaining causal graphs, such as a data analysis client, then the causal relationship discovery system can feed back multiple causal graphs to the client after obtaining multiple causal graphs of the data set. If the client is a client that uses causal graphs to complete certain reasoning, then the causal relationship discovery system can send the generated multiple causal graphs to the storage system, the storage system can store the causal graphs, the storage system can be connected to other causal reasoning systems, the causal reasoning system can obtain the causal graphs in the storage system, complete some causal reasoning, and then feed back the reasoning results to the client. For example, in the financial field, the client may be a client that recommends stock purchase strategies. The client may first analyze financial data through a causal relationship discovery system to determine a causal graph between some variables and stock market indices. The causal graph is stored in a storage system so that a causal inference system can predict risks in the financial market and generate a stock purchase strategy based on the causal graph. For example, in the field of autonomous driving, the client 100 may be a client on an autonomous driving vehicle. The client may analyze sensor data through a causal relationship discovery system to determine a causal graph between different sensor data and the vehicle's acceleration, steering, braking and other behaviors. The causal graph is stored in a storage system so that a causal inference system can output a vehicle control algorithm decision based on the causal graph, thereby improving the safety of the system and driving comfort. The above examples are for illustration only and are not specifically limited in this application.
[0173] In some embodiments, after step S380A or step S380B, when the user inputs new data to be processed, the client can determine the causal graph of the data to be processed based on the multiple causal graphs obtained in step S370. Figure 5 The steps for determining the causal graph of the data to be processed are described. In order to make this application better understood, Figure 3 The steps shown can be understood as the training phase of the sub-model. Figure 5 The step flow shown is the inference phase of the sub-model.
[0174] like Figure 5 As shown, Figure 5 This is a flowchart of the steps of a causal relationship discovery method provided by this application in the reasoning stage, such as Figure 5 As shown, the method may include the following steps:
[0175] S510: The client sends the data to be processed to the causal relationship discovery system. This step can be performed by Figure 2 The acquisition unit 211 in the embodiment is implemented.
[0176] In a specific implementation, the data to be processed may include observation data of one or more objects to be processed. The description of the observation data and the objects may refer to the above content, which will not be repeated here.
[0177] S520: Substitute the observation data of each object into the multiple causal graphs obtained in S370 to determine the category group to which each object belongs. This step can be performed by Figure 2 The group prediction unit 217 in the embodiment is implemented.
[0178] In the specific implementation, the observation data of each object can be input into multiple sub-models, and each sub-model can obtain a loss value for the object. The smaller the loss value, the more closely the observation data of the object fits the causal structure learned by the sub-model. Therefore, the sub-model with the smallest loss value is the most suitable sub-model for the object, and the category group corresponding to the sub-model is the category group to which the object belongs.
[0179] S530: Determine the cause-effect graph of each object according to the category group to which each object belongs, and obtain multiple cause-effect graphs of the data to be processed. This step can be performed by Figure 2 The output unit 218 in the embodiment is implemented.
[0180] Steps S310 to S370 obtain the causal graph corresponding to each category group. Therefore, after determining the category group corresponding to each object in the data to be processed, the causal graph corresponding to each object can be obtained, thereby obtaining multiple causal graphs of the data to be processed.
[0181] It is understood that if a new causal graph appears in the data to be processed input by the user, the number of groups can be increased, the data to be processed can be added to the data set, and multiple sub-models can be trained according to steps S310 to S370 to obtain multiple new causal graphs, thereby determining multiple causal graphs of the data to be processed.
[0182] S540A: Return multiple causal graphs of the data to be processed to the client. This step can be performed by Figure 2 The output unit 218 in the embodiment is implemented.
[0183] S540B: Send multiple causal graphs of data to be processed to the storage system. This step can be performed by Figure 2 The output unit 218 in the embodiment is implemented.
[0184] The description of step S540A and step S540B can be referred to Figure 3 The description of step S380A and step S380B in the embodiment will not be repeated here.
[0185] In order to make this application better understood, Figure 6 The causal relationship discovery method provided by this application is further described. Figure 6is a schematic diagram of an interface provided by the present application. The interface may be an exemplary display interface when the number of groups, penalty threshold, knowledge set and data set input by the user are obtained in step S310. It should be understood that Figure 6 This application is used for illustration and does not limit the interface.
[0186] like Figure 6 As shown in the figure, users can enter the required number of groups, penalty threshold, knowledge set and data set through the input boxes on the page. Of course, they can also set some other training parameters required for the training process, which are not given examples here. For the description of the number of groups, penalty threshold and knowledge set, please refer to Figure 2-Figure 5 The relevant content in will not be repeated here.
[0187] It should be understood that in the causal relationship discovery method provided by the present application, the user only needs to input the number of groups, the penalty threshold and the knowledge set to obtain a causal graph composed of a variety of different causal structures existing in the data set, thereby solving the problem that the current causal discovery algorithm can only identify a single causal structure and cannot mine multiple causal structures from the data, avoiding users from obtaining erroneous causal graphs and improving the user experience.
[0188] In summary, the causal relationship discovery method provided by the present application divides the data set into multiple initial category groups according to the number of groups input by the user, and then uses the multiple initial category groups to train multiple sub-models to obtain multiple initial causal graphs, and then substitutes each object in the data set into the multiple initial causal graphs to obtain multiple loss values, and then determines the causal graph that best fits each object according to the multiple loss values of each object, and then determines the category group to which each object belongs, thereby updating the objects in the initial category group, and then uses the updated multiple category groups to further train multiple sub-models to obtain multiple updated initial causal graphs, and then substitutes each object in the data set into the multiple updated initial causal graphs to obtain multiple loss values of each object, and determines the category group to which each object belongs based on the multiple loss values of each object, thereby updating the updated initial category group again, and so on, until the objects in the category group no longer change, the objects in the category group determined in this way are objects that share the causal graph, and the causal graph output by each sub-model is the causal graph corresponding to the category group, thereby obtaining multiple causal graphs corresponding to the data set, which can solve the problem that the current causal discovery algorithm can only identify a single causal structure and cannot mine multiple causal structures from the data.
[0189] At the same time, during the training process, each sub-model is trained in combination with a knowledge set, which includes known causal relationships determined by multiple causal directions. These known causal relationships can provide guidance for the training of sub-models. When the data set is small, the coverage and diversity of the data will be reduced, and only one-sided or even erroneous causal relationships can be discovered through the data set alone. This application combines prior knowledge with the data set through the knowledge set, which can improve the accuracy of causal discovery in small data volume scenarios.
[0190] Finally, during the training process, each sub-model uses the estimated value of this round as the penalty parameter for the next round of training, imposing lower penalties on larger parameter values and higher penalties on smaller parameter values. This allows the model to adjust the parameter update amplitude according to the estimated value output during the training process. The adjustment amplitude of the model is more stable during multiple rounds of training. Even if an erroneous estimated value appears, the parameter will not swing drastically due to this erroneous estimated value, thereby achieving the effect of correction.
[0191] Combined with the above Figures 2 to 5 , describes in detail the causal relationship discovery method provided by this application, and will be combined with Figure 7 , describing the computing device provided by this application. Figure 7 It is a structural diagram of a computing device provided in the present application. The computing device 700 may be the causal relationship discovery system 200 in the aforementioned content.
[0192] Furthermore, the computing device 700 includes a processor 701, a storage unit 702, a storage medium 703 and a communication interface 704, wherein the processor 701, the storage unit 702, the storage medium 703 and the communication interface 704 communicate through a bus 705, and also communicate through other means such as wireless transmission.
[0193] The processor 701 is composed of a plurality of general-purpose processors, such as a CPU, an NPU, or a combination of a CPU and a hardware chip. The hardware chip is an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The PLD is a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), a data processing unit (DPU), a system on chip (SoC), or any combination thereof. The processor 701 executes various types of digital storage instructions, such as software or firmware programs stored in the storage unit 702, which enables the computing device 700 to provide a wide variety of services.
[0194] In a specific implementation, as an embodiment, the processor 701 includes one or more CPUs, such as Figure 7 CPU0 and CPU1 are shown in the figure.
[0195] In a specific implementation, as an embodiment, the computing device 700 also includes multiple processors, such as Figure 7 1 and 10. Each of these processors may be a single-CPU or a multi-CPU. A processor herein refers to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).
[0196] The storage unit 702 is used to store program codes, and is controlled by the processor 701 to execute the above Figure 1-Figure 7 The processing steps of the causal relationship discovery method in any embodiment of the present invention. The program code includes one or more software units. The one or more software units are Figure 2 The acquisition unit, grouping unit, training unit, knowledge injection unit, penalty unit, group updating unit, group prediction unit and output unit in the embodiment, wherein the acquisition unit is used to acquire the data set, knowledge set, grouping number and penalty threshold input by the user, and the data to be processed input by the user, specifically for implementing the following Figure 3 S310 and its optional steps in the embodiment and Figure 5In step S510 and its optional steps in the embodiment, the grouping unit is used to divide the data set into multiple category groups according to the number of groups, specifically to implement the following Figure 3 In step S320 and its optional steps in the embodiment, the training unit, the knowledge injection unit and the penalty unit are used to perform adaptive penalty training on multiple neural networks using the knowledge set and multiple category groups to obtain multiple sub-models, which are specifically used to implement the following Figure 3 In the embodiment, S330 and its optional steps, the grouping updating unit is used to input the observation data of each object into multiple sub-models, determine the category group to which each object belongs according to the loss values output by the multiple models, and then update the objects in the category group, which is specifically used to achieve the following: Figure 3 In the embodiment, S340, S350 and optional steps thereof, the grouping prediction unit is used to input the observation data of each object into multiple sub-models, and determine the category group to which each object belongs according to the loss values output by the multiple models, which is specifically used to implement the following Figure 5 In S520 and its optional steps in the embodiment, the output unit is used to output multiple causal graphs of the data set or multiple causal graphs of the data to be processed, which is specifically used to implement the following Figure 3 S380A, S380B, Figure 5 S540A, S540B and optional steps thereof in the embodiment.
[0197] The storage unit 702 includes a read-only memory and a random access memory, and provides instructions and data to the processor 701. The storage unit 702 also includes a non-volatile random access memory. The storage unit 702 is a volatile memory or a non-volatile memory, or includes both volatile and non-volatile memories. Among them, the non-volatile memory is a read-only memory (ROM), a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory is a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are used, such as static RAM (SRAM), dynamic random access memory (DRAM), synchronous DRAM (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM) and direct rambus RAM (DR RAM). It can also be a hard disk, a universal serial bus (USB), a flash memory, a secure digital memory card (SD card), a memory stick, etc. The hard disk is a hard disk drive (HDD), a solid state disk (SSD), a mechanical hard disk (HDD), etc., and this application does not make specific limitations.
[0198] The storage medium 703 is a carrier for storing data, such as a hard disk, a USB flash drive (universal serialbus), a flash memory, a secure digital memory card (SD card), a memory stick, etc. The hard disk can be a hard disk drive (HDD), a solid state disk (SSD), a mechanical hard disk (HDD), etc., and this application does not make specific limitations.
[0199] The communication interface 704 is a wired interface (such as an Ethernet interface), an internal interface (such as a high-speed serial computer expansion bus (Peripheral Component Interconnect express, PCIe) bus interface), a wired interface (such as an Ethernet interface) or a wireless interface (such as a cellular network interface or a wireless local area network interface) for communicating with other servers or units.
[0200] The bus 705 is a Peripheral Component Interconnect Express (PCIe) bus, an extended industry standard architecture (EISA) bus, a unified bus (Ubus or UB), a compute express link (CXL), a cache coherent interconnect for accelerators (CCIX), etc. The bus 705 is divided into an address bus, a data bus, a control bus, etc.
[0201] The bus 705 includes not only a data bus but also a power bus, a control bus, and a status signal bus, etc. However, for the sake of clarity, various buses are labeled as bus 705 in the figure.
[0202] Need to explain, Figure 7 This is only a possible implementation of the embodiment of the present application. In practical applications, the computing device 700 may also include more or fewer components, which is not limited here. For the contents not shown or described in the embodiment of the present application, please refer to the aforementioned Figure 1-Figure 7 The relevant explanations in the embodiments will not be repeated here.
[0203] The embodiment of the present application further provides a computing device cluster, which includes at least one computing device 700. The storage unit 702 in one or more computing devices 700 in the computing device cluster may store the same or different instructions for executing the causal relationship discovery method.
[0204] The embodiment of the present application also provides a computer program product including instructions. The computer program product may be software or a program product including instructions that can be run on a computing device or stored in any available medium. When the computer program product is run on at least one computing device, the at least one computing device executes the causal relationship discovery method.
[0205] The embodiment of the present application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that can be stored by a computing device or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a high-density digital video disc (DVD)), or a semiconductor medium (e.g., a solid-state hard disk), etc. The computer-readable storage medium includes instructions that instruct the computing device to execute the causal relationship discovery method.
[0206] The above embodiments may be implemented in whole or in part by software, hardware, firmware or any other combination thereof. When implemented using software, the above embodiments may be implemented in whole or in part in the form of a computer program product. The computer program product includes a plurality of computer instructions. When the computer program instructions are loaded or executed on a computer, the process or function according to the embodiment of the present invention is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium.
[0207] The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent repairs or replacements within the technical scope disclosed by the present invention, and these repairs or replacements should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A causal relationship discovery method, characterized in that: The method is applied to a causal relationship discovery system, and the method comprises: Obtaining a data set and a number of groups input by a user, and dividing the data set into a plurality of category groups, wherein the data set includes observation data of a plurality of objects, each of the plurality of category groups includes at least one object, and the causal graphs of the objects in the same category group are the same; The multiple sub-models are trained using the multiple category groups to obtain a causal graph corresponding to each category group in the multiple category groups, wherein one category group is used to train one sub-model, and one sub-model is used to generate a causal graph corresponding to the category group.
2. The method according to claim 1, characterized in that: The using the multiple category groups to train multiple sub-models comprises: Acquire a knowledge set input by a user, wherein the observation data of the plurality of objects include a plurality of variables, and the knowledge set includes a known causal relationship between at least two variables of the plurality of variables; The plurality of sub-models are trained using the knowledge set and the plurality of category groups.
3. The method according to claim 2, characterized in that The known causal relationship is obtained based on prior knowledge, and the known causal relationship includes a first causal relationship determined by a causal direction and a quantitative relationship value.
4. The method according to claim 2 or 3, characterized in that: The known causal relationship includes a second causal relationship whose causal direction is determined and whose quantitative relationship value is a non-zero unknown value.
5. The method according to any one of claims 2 to 4, characterized in that: The known causal relationship includes a third causal relationship with a determined causal direction and an unknown quantitative relationship value.
6. The method according to any one of claims 1 to 5, characterized in that: The using the multiple category groups to train the multiple sub-models to obtain the causal graph corresponding to each category group in the multiple category groups comprises: Get the penalty threshold entered by the user; For any first model of the plurality of sub-models, execute: Performing multiple rounds of training on the first model using the category group corresponding to the first model, and when the difference between the current output result of the first model and the output result of the previous round of training is not less than the penalty threshold, performing the next round of training on the first model using the current output result as a penalty parameter, wherein the penalty parameter is used to constrain the range of variation of the model parameters of the first model in the next round of training, and the larger the penalty parameter, the smaller the constraint on the range of variation; When the difference between the output result of the first model and the output result of the previous round is smaller than the penalty threshold, a causal graph corresponding to each category group in the multiple category groups is obtained according to the output result of the first model.
7. The method according to any one of claims 1 to 5, characterized in that: The dividing the data set into a plurality of category groups comprises: Dividing the data set into a plurality of initial category groups according to the number of groupings input by a user; Using the multiple initial category groups to train multiple sub-models to obtain multiple initial causal graphs, wherein one initial category group is used to train one sub-model; Substituting the observation data of each object in the multiple objects into the multiple initial causal graphs to obtain multiple substitution results for each object; According to the multiple substitution results of each object, the category group to which each object belongs is determined, and multiple category groups of the data set are obtained.
8. The method according to any one of claims 1 to 7, characterized in that: The method further comprises: Acquire data to be processed input by a user, wherein the data to be processed includes observation data of multiple objects to be processed; Substituting the observation data of the multiple objects to be processed into the multiple cause-effect graphs to obtain multiple substitution results for each of the multiple objects to be processed; Determining, according to the multiple substitution results of each object to be processed, the category group to which each object to be processed belongs; According to the cause-effect graph corresponding to the category group to which each object to be processed belongs, one or more cause-effect graphs corresponding to the data to be processed are determined.
9. A causal relationship discovery system, characterized in that: The system comprises: an acquisition unit, configured to acquire a data set and a number of groups input by a user, and divide the data set into a plurality of category groups, wherein the data set includes observation data of a plurality of objects, each of the plurality of category groups includes at least one object, and the causal graphs of the objects in the same category group are the same; A training unit is used to train multiple sub-models using the multiple category groups to obtain a causal graph corresponding to each category group in the multiple category groups, wherein one category group is used to train one sub-model, and one sub-model is used to generate a causal graph corresponding to the category group.
10. The system according to claim 9, characterized in that The system further comprises a knowledge injection unit, The acquisition unit is used to acquire a knowledge set input by a user, wherein the observation data of the multiple objects include multiple variables, and the knowledge set includes a known causal relationship between at least two variables of the multiple variables; The knowledge injection unit is used to train the multiple sub-models using the knowledge set and the multiple category groups.
11. The system according to claim 9, characterized in that The known causal relationship is obtained based on prior knowledge, and the known causal relationship includes a first causal relationship determined by a causal direction and a quantitative relationship value.
12. The system according to claim 10 or 11, characterized in that The known causal relationship includes a second causal relationship whose causal direction is determined and whose quantitative relationship value is a non-zero unknown value.
13. The system according to any one of claims 10 to 12, characterized in that: The known causal relationship includes a third causal relationship with a determined causal direction and an unknown quantitative relationship value.
14. The system according to any one of claims 9 to 13, characterized in that: The system further comprises a penalty unit, The obtaining unit is used to obtain a penalty threshold value input by a user; The penalty unit is used to execute on any first model among the multiple sub-models: use the category group corresponding to the first model to perform multiple rounds of training on the first model, and when the gap between the current output result of the first model and the output result of the previous round of training is not less than the penalty threshold, use the current output result as a penalty parameter to perform the next round of training on the first model, and the penalty parameter is used to constrain the range of variation of the model parameters of the first model in the next round of training, and the larger the penalty parameter, the smaller the constraint on the range of variation; when the gap between the output result of the first model and the output result of the previous round is less than the penalty threshold, obtain the causal graph corresponding to each category group in the multiple category groups according to the output result of the first model.
15. The system according to any one of claims 9 to 14, characterized in that: The system further comprises a grouping unit and a grouping updating unit, The grouping unit is used to divide the data set into a plurality of initial category groups according to the number of groups input by the user; The training unit is used to train multiple sub-models using the multiple initial category groups to obtain multiple initial causal graphs, wherein one initial category group is used to train one sub-model; The grouping updating unit is used to substitute the observation data of each object in the multiple objects into the multiple initial causal graphs to obtain multiple substitution results for each object; The grouping updating unit is used to determine the category group to which each object belongs according to the multiple substitution results of each object, so as to obtain the multiple category groups of the data set.
16. The system according to any one of claims 9 to 15, characterized in that: The system also includes an output unit and a group prediction unit, The acquisition unit is further used to acquire the data to be processed input by the user, wherein the data to be processed includes observation data of multiple objects to be processed; The group prediction unit is used to substitute the observation data of the multiple objects to be processed into the multiple causal graphs to obtain multiple substitution results for each of the multiple objects to be processed; The group prediction unit is used to determine the category group to which each object to be processed belongs according to the multiple substitution results of each object to be processed; The output unit is used to determine one or more cause-effect graphs corresponding to the data to be processed according to the cause-effect graph corresponding to the category group to which each object to be processed belongs.
17. A computing device, characterized in that The computing device includes a processor and a memory, wherein the memory is used to store instructions, and the processor is used to execute the instructions, so that the computing device implements the system according to any one of claims 1 to 8.
18. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, and the instructions are executed by a computing device or a computing device cluster to implement the system according to any one of claims 1 to 8.