Node probability acquisition method and device in Bayesian network, computer equipment and readable storage medium

By dividing the Bayesian network into subnetworks and executing subtasks in parallel, the low efficiency of single-machine online inference schemes under large-scale data and high-concurrency requests is solved, achieving high inference efficiency and online response capability.

CN121936583APending Publication Date: 2026-04-28GUANGZHOU SHIYUAN ELECTRONICS CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
GUANGZHOU SHIYUAN ELECTRONICS CO LTD
Filing Date
2024-10-28
Publication Date
2026-04-28

AI Technical Summary

Technical Problem

Existing single-machine online inference solutions suffer from low inference efficiency and are unable to respond quickly to user requests in scenarios with large-scale data and high concurrency requests.

Method used

The Bayesian network is divided into multiple sub-networks, and the target task is decomposed into multiple sub-tasks. Prior data is stored using distributed storage units, and inference efficiency is improved by executing sub-tasks in parallel.

Benefits of technology

In scenarios with large-scale data and high concurrency requests, it improves inference efficiency, enabling Bayesian networks to respond to inference needs online, reducing the number of variables and simplifying the inference process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121936583A_ABST
    Figure CN121936583A_ABST
Patent Text Reader

Abstract

The invention relates to a node probability obtaining method and device in a Bayesian network, computer equipment and a computer readable storage medium. The method comprises the following steps: dividing the Bayesian network into a plurality of sub-networks based on a dependency relationship among different nodes in the Bayesian network by taking an aggregation node and a branch node as references; obtaining a target task for the Bayesian network, and decomposing the target task into a plurality of sub-tasks; in the process of executing the target task, aiming at a target sub-task of which the corresponding sub-network comprises an aggregation node and a father node of the aggregation node, determining a sub-task of which the sub-network is located at the upstream of the corresponding sub-network of the target sub-task from a plurality of sub-tasks, and executing the target sub-task under the condition that all the determined sub-tasks are executed; and obtaining the probability that the target node is in the target state based on the initial state of the condition node and the execution result of the target subtask. According to the method provided by the invention, the reasoning efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of node prediction technology, and in particular to a method, apparatus, computer device, and computer-readable storage medium for obtaining node probabilities in a Bayesian network. Background Technology

[0002] Currently, the mainstream inference solution for Bayesian networks is a single-machine online inference solution, such as an inference solution based on pgmpy (Probabilistic Graphical Models in Python, an open-source Python library). Single-machine online inference solutions have the advantages of simple deployment and high inference efficiency when dealing with small datasets. However, because single-machine online inference solutions perform inference sequentially, processing only one observation or piece of evidence at a time, they cannot quickly respond to user requests in scenarios with large-scale data and high concurrency, resulting in very low inference efficiency. Summary of the Invention

[0003] Therefore, it is necessary to provide a method, apparatus, computer device, and computer-readable storage medium for obtaining node probabilities in Bayesian networks that can improve inference efficiency, in order to address the aforementioned technical problems.

[0004] In a first aspect, this application provides a method for obtaining node probabilities in a Bayesian network, the method comprising:

[0005] Based on the dependencies between different nodes in a Bayesian network, the Bayesian network is divided into multiple sub-networks with the convergence node and branch node as the basis. The convergence node is a node with multiple parent nodes, and the branch node is a node with multiple child nodes. Different parent nodes of the same convergence node are independent of each other.

[0006] Obtain the target task for the Bayesian network, and decompose the target task into multiple subtasks. The target task is used to obtain the probability that the target node is in the target state when the condition node is in the initial state. Each subtask corresponds to at least one sub-network, and the condition node is located upstream of the target node.

[0007] During the execution of the target task, for the target sub-task of the corresponding sub-network including the aggregation node and the parent node of the aggregation node, the sub-task of the sub-network located upstream of the target sub-task is determined from the multiple sub-tasks. After all the determined sub-tasks have been executed, the target sub-task is executed.

[0008] Based on the initial state of the condition node and the execution result of the target subtask, the probability that the target node is in the target state is obtained.

[0009] In one embodiment, after dividing the Bayesian network into multiple subnetworks, the method further includes:

[0010] For the edge nodes in the Bayesian network, the prior data of the edge nodes are input into a preset hash model, and a hash value is output. The prior data includes at least one of edge probability or conditional probability table. The edge node is a root node or a terminal node. The conditional probability table of the edge node is used to characterize the probability that the edge node is in different states when the parent node of the edge node is in different states.

[0011] Obtain at least one distributed storage unit and the remainder obtained by dividing the hash value by the number of distributed storage units, and determine the corresponding distributed storage unit of the edge node based on the remainder;

[0012] The prior data of the edge node is stored in the corresponding distributed storage unit of the edge node, and based on the storage result of the prior data of the edge node, the prior data of the remaining nodes in the Bayesian network other than the edge node is stored in the corresponding distributed storage unit of the edge node.

[0013] In one embodiment, the step of storing the prior data of the remaining nodes in the Bayesian network (excluding the edge nodes) into the corresponding distributed storage unit of the edge nodes based on the storage results of the edge nodes includes:

[0014] For a sub-network that includes edge nodes, the prior data of the remaining nodes in the sub-network other than the edge nodes are stored in the corresponding distributed storage unit of the edge nodes;

[0015] For the remaining subnetworks other than the subnetwork that includes the edge node, based on the dependencies between the nodes in the remaining subnetworks and the nodes in the subnetwork that includes the edge node, the prior data of the nodes in the remaining subnetworks is stored in the corresponding distributed storage unit of the edge node.

[0016] In one embodiment, after storing the prior data of the remaining nodes in the Bayesian network other than the edge node into the corresponding distributed storage unit of the edge node based on the storage result of the edge node, the method further includes:

[0017] Obtain the amount of prior data stored in the distributed storage unit;

[0018] The distributed storage unit with the largest corresponding data volume is determined as the first storage unit, and the distributed storage unit with the smallest corresponding data volume is determined as the second storage unit. The data volume difference between the first storage unit and the second storage unit is obtained.

[0019] If the difference in data volume is greater than a preset difference, the prior data in the first storage unit is transferred to the second storage unit in a preset order until the difference in data volume between the first storage unit and the second storage unit is not greater than the preset difference.

[0020] Return to the step of determining the distributed storage unit with the largest corresponding data volume as the first storage unit and the distributed storage unit with the smallest corresponding data volume as the second storage unit, and continue to execute until the difference in data volume between any two distributed storage units is no greater than the preset difference.

[0021] In one embodiment, the step of sequentially transferring the prior data in the first storage unit to the second storage unit in a preset order includes:

[0022] Determine the node corresponding to the prior data in the first storage unit, and the sub-network corresponding to the prior data in the first storage unit;

[0023] For the sub-networks corresponding to the first storage unit, the sub-networks are sorted in ascending order of the number of nodes included in the sub-networks;

[0024] The prior data of the nodes included in the first preset number of sub-networks in the sorting result are transferred to the second storage unit, and the first preset number of sub-networks are deleted from the sorting result;

[0025] If the difference in data volume between the first storage unit and the second storage unit is greater than the preset difference, return to the step of transferring the prior data of the nodes included in the first preset number of sub-networks in the sorting result to the second storage unit and continue execution until the difference in data volume between the first storage unit and the second storage unit is not greater than the preset difference.

[0026] In one embodiment, the method further includes:

[0027] Obtain multiple historical tasks for the Bayesian network;

[0028] Obtain the number of times the distributed storage unit was requested during the execution of the multiple historical tasks;

[0029] For a distributed storage unit whose number of requests exceeds a first preset number, obtain prior data in the distributed storage unit whose number of requests exceeds a second preset number.

[0030] Identify the nodes corresponding to the prior data whose requested number is greater than a second preset number, and obtain the sub-network corresponding to the nodes;

[0031] The prior data of the nodes included in the sub-network are transferred to the corresponding distributed storage unit whose requested number is less than the first preset number.

[0032] In one embodiment, obtaining the probability that the target node is in the target state based on the initial state of the condition node and the execution result of the target subtask includes:

[0033] For the Bayesian network, obtain historical tasks that have the same condition nodes as the target task and are in the initial state;

[0034] If there are identical subtasks between the target task and the historical task, the execution result of the identical subtask during the execution of the historical task shall be determined as the execution result of the identical subtask during the execution of the target task.

[0035] Based on the execution results of the same subtask and the execution results of the target subtask, the probability that the target node is in the target state is obtained.

[0036] Secondly, this application also provides a device for obtaining node probabilities in a Bayesian network, the device comprising:

[0037] The partitioning module is used to divide the Bayesian network into multiple sub-networks based on the dependency relationships between different nodes in the Bayesian network, with the convergence node and branch node as the benchmark. The convergence node is a node with multiple parent nodes, and the branch node is a node with multiple child nodes. Different parent nodes of the same convergence node are independent of each other.

[0038] The first acquisition module is used to acquire the target task for the Bayesian network, decompose the target task into multiple sub-tasks, the target task is used to acquire the probability that the target node is in the target state when the condition node is in the initial state, each sub-task corresponds to at least one sub-network, and the condition node is located upstream of the target node.

[0039] The first determining module is used, during the execution of the target task, for the target sub-task of the corresponding sub-network including the aggregation node and the parent node of the aggregation node, to determine from the multiple sub-tasks the sub-network of the target sub-task that is located upstream of the corresponding sub-network of the target sub-task, and to execute the target sub-task when all the determined sub-tasks have been executed.

[0040] The second acquisition module is used to acquire the probability that the target node is in the target state based on the initial state of the condition node and the execution result of the target subtask.

[0041] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps of the methods in any of the above embodiments.

[0042] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements the steps of the methods in any of the above embodiments.

[0043] The aforementioned method, apparatus, computer device, and computer-readable storage medium for obtaining node probabilities in a Bayesian network divide the Bayesian network into multiple sub-networks based on the dependencies between different nodes. The target task is then decomposed into multiple sub-tasks based on these sub-networks. During inference, only the corresponding sub-tasks need to be executed sequentially according to the inference logic, effectively reducing the number of variables to consider, simplifying the inference process, and improving inference efficiency. During the execution of the target task, for the target sub-task in the corresponding sub-network, including the pool node and its parent node, the target sub-task is only executed after all the sub-tasks upstream of the target sub-network in the sub-network have been executed. This means that multiple sub-tasks can be executed simultaneously during inference, resulting in high inference efficiency even under scenarios with large-scale data and high concurrency requests. Furthermore, the structure of the Bayesian network in this application does not require a distributed computing framework; therefore, the Bayesian network in this application can respond to inference requests online. Attached Figure Description

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

[0045] Figure 1This is a flowchart illustrating a method for obtaining node probabilities in a Bayesian network in one embodiment.

[0046] Figure 2 This is a schematic diagram of the partitioning of a Bayesian network in one embodiment;

[0047] Figure 3 Here is a structural diagram of a Bayesian network in one embodiment;

[0048] Figure 4 This is a schematic diagram illustrating the parallelized execution of a Bayesian network in one embodiment;

[0049] Figure 5 This is a flowchart illustrating a priori data storage method in one embodiment;

[0050] Figure 6 This is a schematic diagram of a distributed storage unit and metadata management in one embodiment;

[0051] Figure 7 This is a schematic diagram illustrating the storage of result data during the inference process in one embodiment;

[0052] Figure 8 A comparison chart of inference efficiency between the conventional scheme and the present scheme in one embodiment;

[0053] Figure 9 This is a structural block diagram of a node probability acquisition device in a Bayesian network in one embodiment.

[0054] Figure 10 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0055] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0056] Besides standalone online inference solutions, commonly used Bayesian network inference solutions also include those based on third-party distributed computing frameworks, such as those based on Spark and MapReduce. While these solutions can be applied to large-scale data scenarios, they are limited by the distributed framework itself and can only be used for offline inference, unable to respond to inference needs online.

[0057] To address the aforementioned technical problems, in one embodiment, such as Figure 1As shown, a method for obtaining node probabilities in a Bayesian network is provided. This embodiment illustrates the application of this method to a terminal. It is understood that this method can also be applied to a server, and further to a system including both a terminal and a server, and implemented through interaction between the terminal and the server. In this embodiment, the method includes the following steps:

[0058] S102. Based on the dependency relationship between different nodes in the Bayesian network, the Bayesian network is divided into multiple sub-networks with the pool node and branch node as the benchmark. The pool node is a node with multiple parent nodes, and the branch node is a node with multiple child nodes. Different parent nodes of the same pool node are independent of each other.

[0059] Bayesian networks are graphical models based on probabilistic reasoning used to represent dependencies and uncertainties between nodes. A Bayesian network is a directed acyclic graph structure. Dependencies between different nodes refer to the mutual influence of the probability distributions of different nodes. For example, for a node in a Bayesian network, the probability distribution of that node is affected by the probability distributions of all the nodes upstream of it. The node probability in a Bayesian network refers to the probability that each node in the Bayesian network is in a different state.

[0060] In the process of dividing a Bayesian network into multiple subnetworks, the number of parent and child nodes for each sink node or branch node is used to assign it to different subnetworks. For example, in Figure 2 In the Bayesian network shown, nodes B and C are the convergence nodes, and node D is the branch node. The parent nodes of node B include nodes A and B1. The child node of node B is node C. The parent nodes of node C include nodes B and C1. The child node of node C is node D. The parent node of node D is node C. The child nodes of node D include nodes D1 and E. In the process of dividing the Bayesian network into multiple subnetworks, firstly, node B and its parent node A are divided into subnetwork A->B, node B and its parent node B1 are divided into subnetwork B1->B, node B and node C are divided into subnetwork B->C, node C and its parent node C1 are divided into subnetwork C1->C, node C and node D are divided into subnetwork C->D, node D and its child node D1 are divided into subnetwork D->D1, and node D and its child node E are divided into subnetwork D->E. After all the subnetworks corresponding to the convergence nodes and branch nodes have been divided, the subnetworks corresponding to the remaining nodes are divided, specifically, node B2 and node B1 are divided into subnetwork B2->B1, node C3, node C2 and node C1 are divided into subnetwork C3 -> C2 -> C1, and node D1 and node D2 are divided into subnetwork D1->D2.

[0061] Conditional independence is the foundation of parallel execution. Therefore, in the Bayesian network of this embodiment, different parent nodes of the same sink node need to be independent of each other, that is, there should be no connection path between different parent nodes of the same sink node. Figure 2 The shown nodes are B and C. The two parent nodes A and B1 of node B are independent of each other, and the two parent nodes B and C1 of node C are also independent of each other.

[0062] S104. Obtain the target task for the Bayesian network and decompose the target task into multiple subtasks. The target task is used to obtain the probability that the target node is in the target state when the condition node is in the initial state. Each subtask corresponds to at least one sub-network, and the condition node is located upstream of the target node.

[0063] The initial state and the target state can be the same state or different states. This application does not specifically limit this. In a Bayesian network, the state of a node refers to all the possible values ​​that the node can take. For example, the state of a node can include two state values: False and True.

[0064] like Figure 2 As shown, in a target task, the condition node is node A, and the target node is node E. Both the initial state and the target state are True, meaning the target task is the probability of obtaining the state of node E as True given that the state of node A is True. According to the chain rule of Bayesian networks, the reasoning process for this target task is independent of nodes D1 and D2. Therefore, nodes D1 and D2 can be pruned to obtain the Bayesian network corresponding to the target task. The pruned Bayesian network is shown below. Figure 3 As shown. According to Figure 3 The Bayesian network in the model can decompose the target task into multiple subtasks. Specifically, it first decomposes the target task into subtasks B1+A->B consisting of the sink node B and its two parent nodes, and subtasks B+C1->C consisting of the sink node C and its two parent nodes. Subtask B1+A->B corresponds to subnetworks B1->B and A->B, and subtask B+C1->C corresponds to subnetworks C1->C and B->C. After obtaining the subtasks corresponding to the sink node, the remaining subtasks B2->B1, C3->C2->C1, and C->D->E are obtained.

[0065] S106. During the execution of the target task, for the target sub-task of the corresponding sub-network including the aggregation node and the parent node of the aggregation node, determine the sub-task of the sub-network that is upstream of the target sub-task from multiple sub-tasks. After all the determined sub-tasks have been executed, execute the target sub-task.

[0066] In this context, subtasks located upstream of the corresponding sub-network of the same target subtask are executed in parallel. For multiple subtasks executing in parallel, due to differences in complexity and the number of nodes in their respective sub-networks, the execution time of each subtask will vary. After a shorter subtask completes, the target subtask will not be executed immediately; it must wait. Only after all subtasks have been completed will the target subtask be executed based on the results of all subtasks. For example, Figure 3 The target subtask B+C1->C corresponds to both subnetworks B->C and C1->C. Subnetworks upstream of B->C include B2->B1, B1->B, and A->B. Subnetworks upstream of C1->C include C3->C2->C1. Subnetworks B1->B and A->B both correspond to subtask B1+A->B, B2->B1 corresponds to subtask B2->B1, and C3->C2->C1 corresponds to subtask C3->C2->C1. Before executing the target subtask B+C1->C, subtasks C3->C2->C1, B2->B1, and B1+A->B are executed first. Subtask B1+A->B is executed only after subtask B2->B1 has been completed. The target subtask B+C1->C will only be executed after subtasks C3 -> C2 -> C1 and B1+A->B have both been completed.

[0067] S108. Based on the initial state of the condition node and the execution result of the target subtask, obtain the probability that the target node is in the target state.

[0068] The decomposed target task can be represented as: Figure 4 The form shown, Figure 4In this context, subtasks B1+A->B and B+C1->C are both target subtasks. During the execution of the target task, subtasks P1(A), P2(B2 -> B1), and P3(C3 -> C2 -> C1) need to be executed in parallel. Since the state value of node A is True, the execution result of subtask P1 is known. After subtask P2 is completed, the target subtask B1+A->B is executed based on the execution results of subtasks P1 and P2. After the target subtask B1+A->B is completed, the target subtask B+C1->C is executed based on the execution results of subtasks B1+A->B and P3. After the target subtask B+C1->C is completed, subtask C->D->E is executed based on the execution result of target subtask B+C1->C, thus obtaining the probability that target node E is in the target state.

[0069] The target task can be represented by the conditional probability P(E=True|A=True). Since A=True is a given condition, P(A=True) = 1. The formula for calculating P(E=True|A=True) is as follows:

[0070]

[0071] Based on the chain rule, the conditional probability of the target node E can be decomposed into probabilities involving node D, that is:

[0072]

[0073] In the formula, This represents the probability that the state of the target node E is True, given that node D is in different states. It can be obtained directly from the conditional probability table of the target node E; This represents the probability that node D is in different states given that the state of condition node A is True.

[0074] Since node D depends on node C, according to the law of total probability, we know... The calculation formula is as follows:

[0075]

[0076] In the formula, This represents the probability that node D is in different states given that node C is in different states. It can be obtained directly from the conditional probability table of node D; This represents the probability that node C is in different states given that the state of condition node A is True.

[0077] Similarly, node C depends on node B and node C1, node C1 depends on node C2, node C2 depends on node C3, node B depends on node A and node B1, and node B1 depends on node B2. Following the same calculation logic, the corresponding calculation formula for each dependency relationship can be determined, thereby calculating the probability that the target node E is in the target state.

[0078] The formula for calculating the conditional probability of node B is:

[0079]

[0080] In the formula, conditional probability and conditional probability The marginal probabilities can be obtained directly from the conditional probability table of node B. and marginal probability The value of is known.

[0081] Similarly, the formula for calculating the conditional probability of node C is:

[0082]

[0083] In the formula, Marginal probability represents the probability that node C is in a different state given that node B and node C1 are in different states. The value of is known.

[0084] In the aforementioned method for obtaining node probabilities in a Bayesian network, the Bayesian network is divided into multiple sub-networks based on the dependencies between different nodes. The target task is then decomposed into multiple sub-tasks based on these sub-networks. During inference, only the corresponding sub-tasks need to be executed sequentially according to the inference logic, effectively reducing the number of variables to consider, simplifying the inference process, and improving inference efficiency. During the execution of the target task, for the target sub-task in the corresponding sub-network, including the pool node and its parent node, the target sub-task is only executed after all the sub-tasks upstream of the target sub-network in the sub-network have been executed. This means that multiple sub-tasks can be executed simultaneously during inference, ensuring high inference efficiency even with large-scale data and high-concurrency requests. Furthermore, the structure of the Bayesian network in this application does not require a distributed computing framework; therefore, the Bayesian network in this application can respond to inference requests online.

[0085] In some embodiments, such as Figure 5 As shown, after dividing the Bayesian network into multiple subnetworks, it also includes:

[0086] S502. For edge nodes in a Bayesian network, the prior data of the edge nodes are input into a preset hash model, and the hash value is output. The prior data includes at least one of the edge probability or conditional probability table. The edge node is either a root node or a terminal node. The conditional probability table of the edge node is used to characterize the probability that the edge node is in different states when the parent node of the edge node is in different states.

[0087] S504. Obtain at least one distributed storage unit and the remainder obtained by dividing the hash value by the number of distributed storage units, and determine the corresponding distributed storage unit of the edge node based on the remainder.

[0088] S506. Store the prior data of the edge nodes into the corresponding distributed storage units of the edge nodes, and based on the storage results of the prior data of the edge nodes, store the prior data of the remaining nodes in the Bayesian network other than the edge nodes into the corresponding distributed storage units of the edge nodes.

[0089] In this context, a hash model is an algorithm or function that transforms input data of arbitrary length into output data of fixed length. The hash value is the fixed-length output data generated by the hash model after processing the input data. The root node is a node without a parent node, and the terminal node is a node without child nodes. During the execution of each subtask in the target task, the prior data of each node involved in the execution of the subtask is obtained from the distributed storage unit that stores the prior data of that node, thereby completing the subtask.

[0090] Based on the correspondence between remainders and distributed storage units, the distributed storage unit corresponding to the remainder can be determined as the storage unit for storing the prior data of the corresponding edge node. For example, in Figure 2 In the diagram, the root nodes include nodes C3, A, and B2, and the terminal nodes include nodes E and D2, as shown below. Figure 6 As shown, there are three distributed storage units: N1, N2, and N3. These three storage units are sorted in the order of N1, N2, and N3. The form of a distributed storage unit can be a distributed storage node. Taking the root node B2 as an example, the marginal probability of the root node B2 is input into the preset hash model, and the corresponding hash value of node B2 is 11. The hash value 11 is divided by the number of distributed storage units 3, and the remainder is 2. The second storage unit in the sorting result is then determined as the storage unit corresponding to node B2, that is, the prior data of node B2 is stored in storage unit N2.

[0091] Figure 6 The metadata management section includes Figure 2 The complete topology of the Bayesian network and the mapping relationship between nodes and distributed storage units are defined. During inference, the inference link is first determined based on the chain rules and the complete topology of the Bayesian network. Then, the storage location of each node in each sub-network is determined through the mapping relationship between nodes and distributed storage units. Finally, the inference task is distributed based on the inference link and storage location.

[0092] In this embodiment, the storage unit corresponding to the edge node is obtained based on the hash value of the edge node, and the prior data of the edge node is stored in the storage unit. This can maximize the average storage of the prior data of different edge nodes in different storage units, so that the load of each storage unit is as consistent as possible during the execution of the target task.

[0093] In some embodiments, based on the storage results of edge nodes, storing the prior data of the remaining nodes in the Bayesian network other than the edge nodes into the corresponding distributed storage unit of the edge nodes includes: for a sub-network including edge nodes, storing the prior data of the remaining nodes in the sub-network other than the edge nodes into the corresponding distributed storage unit of the edge nodes; for the remaining sub-network other than the sub-network including edge nodes, storing the prior data of the nodes in the remaining sub-network into the corresponding distributed storage unit of the edge nodes based on the dependencies between the nodes in the remaining sub-network and the nodes in the sub-network including edge nodes.

[0094] Specifically, for nodes that are simultaneously located in different sub-networks, their prior data can be stored concurrently in the corresponding storage units of each sub-network. For example, ... Figure 6 As shown, node B is simultaneously located in subnetwork A->B and subnetwork B1->B. Since subnetwork A->B corresponds to storage unit N1 and subnetwork B1->B corresponds to storage unit N2, the prior data of node B can be stored in both storage unit N1 and storage unit N2 at the same time.

[0095] Subnetwork B2->B1 includes node B2. Since the prior data of node B2 is stored in storage unit N2, the prior data of node B1 can also be stored in storage unit N2.

[0096] exist Figure 2In the example, the subnetworks including edge nodes are subnetwork C3 -> C2 -> C1, subnetwork B2 -> B1, subnetwork A -> B, subnetwork D -> E, and subnetwork D1 -> D2. For subnetwork B1 -> B, the subnetworks including edge nodes that have dependencies on nodes in subnetwork B1 -> B are subnetwork B2 -> B1 and subnetwork A -> B. The prior knowledge data of nodes in subnetwork B2 -> B1 is stored in storage unit N2, and the prior knowledge data of nodes in subnetwork A -> B is stored in storage unit N1. Therefore, the prior knowledge data of nodes in subnetwork B1 -> B can be stored in either storage unit N2 or storage unit N1.

[0097] In this embodiment, based on the dependencies between different nodes, the prior data of nodes in sub-networks with related relationships are stored in the same storage unit as much as possible. This can minimize cross-storage unit communication during the inference process, thereby improving inference efficiency.

[0098] In some embodiments, after storing the prior data of the remaining nodes in the Bayesian network (excluding the edge nodes) into the corresponding distributed storage units of the edge nodes based on the storage results of the edge nodes, the method further includes: obtaining the amount of prior data stored in the distributed storage units; determining the distributed storage unit with the largest corresponding data amount as the first storage unit and the distributed storage unit with the smallest corresponding data amount as the second storage unit, and obtaining the difference in data amount between the first storage unit and the second storage unit; if the difference in data amount is greater than a preset difference, transferring the prior data in the first storage unit to the second storage unit in a preset order until the difference in data amount between the first storage unit and the second storage unit is not greater than the preset difference; returning to the step of determining the distributed storage unit with the largest corresponding data amount as the first storage unit and the distributed storage unit with the smallest corresponding data amount as the second storage unit and continuing to execute until the difference in data amount between any two distributed storage units is not greater than the preset difference.

[0099] If the difference in data volume between the first storage unit and the second storage unit is too large, it indicates that the amount of data stored in the two storage units is extremely uneven, and the first storage unit stores too much data. This may lead to a significant reduction in the efficiency of retrieving data from the first storage unit during the execution of the Bayesian inference task, thereby reducing the inference efficiency. Therefore, it is necessary to transfer a portion of the data in the first storage unit to the second storage unit to reduce the storage pressure on the first storage unit.

[0100] In this embodiment, when the difference in data volume between the first storage unit and the second storage unit is greater than a preset difference, the prior data in the first storage unit is sequentially transferred to the second storage unit in a preset order, which can improve the inference efficiency of the Bayesian network.

[0101] In some embodiments, transferring prior data in the first storage unit to the second storage unit in a preset order includes: determining the nodes corresponding to the prior data in the first storage unit and the sub-networks corresponding to the prior data in the first storage unit; sorting the sub-networks corresponding to the first storage unit in ascending order of the number of nodes included in the sub-networks; transferring the prior data of the nodes included in the first preset number of sub-networks in the sorting result to the second storage unit, and deleting the first preset number of sub-networks in the sorting result; if the difference in data volume between the first storage unit and the second storage unit is greater than a preset difference, returning to the step of transferring the prior data of the nodes included in the first preset number of sub-networks in the sorting result to the second storage unit and continuing to execute until the difference in data volume between the first storage unit and the second storage unit is not greater than the preset difference.

[0102] The subnetwork with fewer nodes has less prior data than the subnetwork with more nodes.

[0103] In this embodiment, sub-networks are used as the basic unit for data transfer. This balances the amount of data stored between different storage units and ensures that the prior data of the same sub-network is still stored in the same storage unit after transfer. This can minimize cross-storage unit communication during the inference process, thereby improving inference efficiency. Transferring the prior data of the sub-network with a smaller number of nodes first can prevent the amount of data stored in the second storage unit from exceeding the amount of data stored in the first storage unit during the transfer process.

[0104] In some embodiments, the method further includes: acquiring multiple historical tasks for the Bayesian network; acquiring the number of times the distributed storage unit was requested during the execution of the multiple historical tasks; for the distributed storage unit whose number of requests is greater than a first preset number, acquiring prior data in the distributed storage unit whose number of requests is greater than a second preset number; determining the node corresponding to the prior data whose number of requests is greater than the second preset number, and acquiring the sub-network corresponding to the node; and transferring the prior data of the nodes included in the sub-network to the distributed storage unit whose number of requests is less than the first preset number.

[0105] In the process of performing inference tasks, the server load may be too high for frequently requested distributed storage units, which may slow down the return of the requested data and reduce inference efficiency. Therefore, it is necessary to transfer some prior data in frequently requested distributed storage units to other distributed storage units to reduce the load and improve inference efficiency.

[0106] In this embodiment, transferring a portion of the prior data from a distributed storage unit with a requested number greater than a first preset number to a distributed storage unit with a requested number less than a first preset number can effectively improve inference efficiency.

[0107] In some embodiments, obtaining the probability that the target node is in the target state based on the initial state of the condition node and the execution result of the target subtask includes: for the Bayesian network, obtaining historical tasks that have the same condition nodes as the target task and whose condition nodes are in the initial state; in the case that there are the same subtasks between the target task and the historical task, determining the execution result of the same subtask during the execution of the historical task as the execution result of the same subtask during the execution of the target task; and obtaining the probability that the target node is in the target state based on the execution result of the same subtask and the execution result of the target subtask.

[0108] Within the same Bayesian network, data is stored during each inference task. This data can be the probability value of a single node, the probability value of a subtask, or the probability values ​​of an inference process involving multiple subtasks. When other inference tasks require this data, it is retrieved from the corresponding storage location. For example, ... Figure 7 As shown, during the execution of the target task, the probability value P(B1) is stored in node B1, the probability value P(C1) is stored in node C1, the probability value P(C|A=True) is stored on the corresponding intermediate probability edge from node A to node C, and the probability value P(D|A=True) is stored on the corresponding intermediate probability edge from node A to node D. The intermediate probability edge is a data structure.

[0109] In this embodiment, when there are identical subtasks between the target task and the historical task, the execution result of the identical subtask during the execution of the historical task is determined as the execution result of the identical subtask during the execution of the target task. In this way, the target task does not need to repeatedly reason about the execution result of the identical subtask, which can reduce reasoning time and improve reasoning efficiency.

[0110] In one embodiment, another method for obtaining node probabilities in a Bayesian network is provided. This method includes the following steps: First, based on the dependencies between different nodes in the Bayesian network, the network is divided into multiple sub-networks, with the convergence node and branch node as the benchmark. The prior data of each sub-network is stored in a distributed storage unit as evenly as possible. Then, the prior data stored in the distributed storage unit is adjusted based on the amount of data stored in each distributed storage unit and the frequency of requests to each distributed storage unit during historical task execution. Next, the target task is executed based on the prior data stored in the distributed storage unit. During the execution of the target task, the target task is decomposed into multiple sub-tasks based on the sub-network partitioning results. Different sub-tasks undergo parallel inference and historical tasks with the same execution conditions as the target task are obtained. Data that can be used for the target task from the execution results of historical tasks is obtained to avoid redundant calculations.

[0111] Performance tests were conducted on a fault node inference request dataset containing 1000 data points, comparing the inference scheme presented in this embodiment with the pgmpy-based inference scheme. The average execution time of the two inference schemes is as follows: Figure 8 As shown, the horizontal axis represents the number of nodes in the reasoning, and the vertical axis represents the reasoning time. From Figure 8 As can be seen, the inference scheme in this embodiment is always more efficient than the pgmpy-based inference scheme, and the advantage of this scheme is more obvious in scenarios with higher inference complexity (more inference nodes).

[0112] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0113] Based on the same inventive concept, this application also provides a device for obtaining the node probability in a Bayesian network to implement the above-described method for obtaining the node probability in a Bayesian network. The solution provided by this device is similar to the solution described in the above method. Therefore, the specific limitations in one or more embodiments of the device for obtaining the node probability in a Bayesian network provided below can be found in the limitations of the method for obtaining the node probability in a Bayesian network described above, and will not be repeated here.

[0114] In one exemplary embodiment, such as Figure 9 As shown, a device 900 for obtaining node probabilities in a Bayesian network is provided, comprising: a partitioning module 901, a first acquisition module 902, a determination module 903, and a second acquisition module 904, wherein:

[0115] The partitioning module 901 is used to divide the Bayesian network into multiple sub-networks based on the dependency relationships between different nodes in the Bayesian network, with the convergence node and branch node as the benchmark. The convergence node is a node with multiple parent nodes, and the branch node is a node with multiple child nodes. Different parent nodes of the same convergence node are independent of each other.

[0116] The first acquisition module 902 is used to acquire the target task for the Bayesian network, and decompose the target task into multiple sub-tasks. The target task is used to acquire the probability that the target node is in the target state when the condition node is in the initial state. Each sub-task corresponds to at least one sub-network, and the condition node is located upstream of the target node.

[0117] The first determining module 903 is used to, during the execution of the target task, for the target sub-task of the corresponding sub-network including the aggregation node and the parent node of the aggregation node, determine from the multiple sub-tasks the sub-network of the target sub-task that is located upstream of the corresponding sub-network of the target sub-task, and execute the target sub-task after all the determined sub-tasks have been executed.

[0118] The second acquisition module 904 is used to acquire the probability that the target node is in the target state based on the initial state of the condition node and the execution result of the target subtask.

[0119] In some embodiments, the node probability acquisition device 900 in the Bayesian network further includes:

[0120] The input module is used to input the prior data of the edge nodes in the Bayesian network into a preset hash model and output a hash value. The prior data includes at least one of an edge probability table or a conditional probability table. The edge node is a root node or a terminal node. The conditional probability table of the edge node is used to characterize the probability that the edge node is in different states when its parent node is in different states.

[0121] The third acquisition module is used to acquire at least one distributed storage unit and the remainder obtained by dividing the hash value by the number of distributed storage units, and to determine the corresponding distributed storage unit of the edge node based on the remainder.

[0122] The storage module is used to store the prior data of the edge node into the corresponding distributed storage unit of the edge node, and based on the storage result of the prior data of the edge node, store the prior data of the remaining nodes in the Bayesian network other than the edge node into the corresponding distributed storage unit of the edge node.

[0123] In some embodiments, the storage module is further configured to, for a sub-network including an edge node, store the prior data of the remaining nodes in the sub-network other than the edge node into the corresponding distributed storage unit of the edge node; and for the remaining sub-network other than the sub-network including the edge node, store the prior data of the nodes in the remaining sub-network into the corresponding distributed storage unit of the edge node based on the dependency relationship between the nodes in the remaining sub-network and the nodes in the sub-network including the edge node.

[0124] In some embodiments, the node probability acquisition device 900 in the Bayesian network further includes:

[0125] The fourth acquisition module is used to acquire the amount of prior data stored in the distributed storage unit.

[0126] The fifth acquisition module is used to determine the distributed storage unit with the largest corresponding data volume as the first storage unit, and the distributed storage unit with the smallest corresponding data volume as the second storage unit, and to obtain the data volume difference between the first storage unit and the second storage unit.

[0127] The transfer module is used to transfer the prior data in the first storage unit to the second storage unit in a preset order when the difference in data volume is greater than a preset difference, until the difference in data volume between the first storage unit and the second storage unit is not greater than the preset difference.

[0128] The execution module is used to return to the steps of determining the distributed storage unit with the largest corresponding data volume as the first storage unit and the distributed storage unit with the smallest corresponding data volume as the second storage unit, and continue to execute until the difference in data volume between any two distributed storage units is no greater than the preset difference.

[0129] In some embodiments, the transfer module is further configured to: determine the nodes corresponding to the prior data in the first storage unit and the sub-networks corresponding to the prior data in the first storage unit; sort the sub-networks corresponding to the first storage unit in ascending order of the number of nodes included in the sub-networks; transfer the prior data of the nodes included in the first preset number of sub-networks in the sorting result to the second storage unit, and delete the first preset number of sub-networks in the sorting result; if the difference in data volume between the first storage unit and the second storage unit is greater than the preset difference, return to the step of transferring the prior data of the nodes included in the first preset number of sub-networks in the sorting result to the second storage unit and continue execution until the difference in data volume between the first storage unit and the second storage unit is not greater than the preset difference.

[0130] In some embodiments, the node probability acquisition device 900 in a Bayesian network is specifically used to acquire multiple historical tasks for the Bayesian network; acquire the number of times the distributed storage unit is requested during the execution of the multiple historical tasks; for distributed storage units whose number of requests is greater than a first preset number, acquire prior data in the distributed storage unit whose number of requests is greater than a second preset number; determine the node corresponding to the prior data whose number of requests is greater than the second preset number, and acquire the sub-network corresponding to the node; and transfer the prior data of the nodes included in the sub-network to the distributed storage unit whose number of requests is less than the first preset number.

[0131] In some embodiments, the second acquisition module 904 is further configured to, for the Bayesian network, acquire historical tasks that have the same condition nodes as the target task and the condition nodes are in the initial state; in the case that there are the same sub-tasks between the target task and the historical tasks, determine the execution result of the same sub-tasks during the execution of the historical tasks as the execution result of the same sub-tasks during the execution of the target task; and based on the execution result of the same sub-tasks and the execution result of the target sub-tasks, acquire the probability that the target node is in the target state.

[0132] The modules in the node probability acquisition device of the aforementioned Bayesian network can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0133] In one exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 10 As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, Near Field Communication (NFC), or other technologies. When executed by the processor, the computer program implements a method for obtaining node probabilities in a Bayesian network.

[0134] Those skilled in the art will understand that Figure 10 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0135] In an exemplary embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to perform the following steps: based on the dependencies between different nodes in a Bayesian network, and using a convergence node and branch nodes as a reference, dividing the Bayesian network into multiple sub-networks, wherein the convergence node is a node with multiple parent nodes, the branch node is a node with multiple child nodes, and different parent nodes of the same convergence node are independent of each other; obtaining a target task for the Bayesian network, and decomposing the target task into multiple sub-tasks, wherein the target task is used at conditional nodes. Given an initial state, the probability that the target node is in the target state is obtained. Each subtask corresponds to at least one subnetwork, and the condition node is located upstream of the target node. During the execution of the target task, for the target subtask in the corresponding subnetwork including the aggregation node and the parent node of the aggregation node, the subtask whose subnetwork is upstream of the corresponding subnetwork of the target subtask is determined from the multiple subtasks. If all determined subtasks have been executed, the target subtask is executed. Based on the initial state of the condition node and the execution result of the target subtask, the probability that the target node is in the target state is obtained.

[0136] In one embodiment, after the processor executes the computer program to divide the Bayesian network into multiple sub-networks, the process further includes: for the edge nodes in the Bayesian network, inputting the prior data of the edge nodes into a preset hash model and outputting a hash value, wherein the prior data includes at least one of an edge probability table or a conditional probability table, and the edge node is a root node or a terminal node; wherein the conditional probability table of the edge nodes is used to characterize the probability that the edge node is in different states when its parent node is in different states; obtaining at least one distributed storage unit and the remainder obtained by dividing the hash value by the number of distributed storage units, and determining the corresponding distributed storage unit for the edge node based on the remainder; storing the prior data of the edge nodes in the corresponding distributed storage unit for the edge nodes, and based on the storage result of the prior data of the edge nodes, storing the prior data of the remaining nodes in the Bayesian network other than the edge nodes in the corresponding distributed storage unit for the edge nodes.

[0137] In one embodiment, the storage result based on the edge node implemented by the processor when executing the computer program, storing the prior data of the remaining nodes in the Bayesian network other than the edge node into the corresponding distributed storage unit of the edge node, includes: for a sub-network including the edge node, storing the prior data of the remaining nodes in the sub-network other than the edge node into the corresponding distributed storage unit of the edge node; for the remaining sub-network other than the sub-network including the edge node, storing the prior data of the nodes in the remaining sub-network into the corresponding distributed storage unit of the edge node based on the dependency relationship between the nodes in the remaining sub-network and the nodes in the sub-network including the edge node.

[0138] In one embodiment, after the processor executes the computer program to implement the storage result based on the edge node, storing the prior data of the remaining nodes in the Bayesian network other than the edge node into the corresponding distributed storage unit of the edge node, the method further includes: obtaining the amount of prior data stored in the distributed storage unit; determining the distributed storage unit with the largest corresponding data amount as the first storage unit and the distributed storage unit with the smallest corresponding data amount as the second storage unit, and obtaining the data amount difference between the first storage unit and the second storage unit; if the data amount difference is greater than a preset difference, sequentially transferring the prior data in the first storage unit to the second storage unit in a preset order until the data amount difference between the first storage unit and the second storage unit is not greater than the preset difference; returning to the step of determining the distributed storage unit with the largest corresponding data amount as the first storage unit and the distributed storage unit with the smallest corresponding data amount as the second storage unit and continuing to execute until the data amount difference between any two distributed storage units is not greater than the preset difference.

[0139] In one embodiment, the process of transferring prior data in the first storage unit to the second storage unit in a preset order when the processor executes a computer program includes: determining the nodes corresponding to the prior data in the first storage unit and the sub-networks corresponding to the prior data in the first storage unit; sorting the sub-networks corresponding to the first storage unit in ascending order of the number of nodes included in the sub-networks; transferring the prior data of the nodes included in the first preset number of sub-networks in the sorting result to the second storage unit, and deleting the first preset number of sub-networks in the sorting result; if the difference in the amount of data between the first storage unit and the second storage unit is greater than the preset difference, returning to the step of transferring the prior data of the nodes included in the first preset number of sub-networks in the sorting result to the second storage unit and continuing execution until the difference in the amount of data between the first storage unit and the second storage unit is not greater than the preset difference.

[0140] In one embodiment, the method implemented by the processor when executing a computer program further includes: acquiring multiple historical tasks for the Bayesian network; acquiring the number of times the distributed storage unit was requested during the execution of the multiple historical tasks; for distributed storage units whose number of requests is greater than a first preset number, acquiring prior data in the distributed storage unit whose number of requests is greater than a second preset number; determining the node corresponding to the prior data whose number of requests is greater than the second preset number, and acquiring the sub-network corresponding to the node; and transferring the prior data of the nodes included in the sub-network to the distributed storage unit whose number of requests is less than the first preset number.

[0141] In one embodiment, the probability of a target node being in the target state, obtained by the processor executing a computer program based on the initial state of the condition node and the execution result of the target subtask, includes: for the Bayesian network, obtaining historical tasks that have the same condition node as the target task and whose condition node is in the initial state; in the case that there is an identical subtask between the target task and the historical task, determining the execution result of the identical subtask during the execution of the historical task as the execution result of the identical subtask during the execution of the target task; and obtaining the probability of the target node being in the target state based on the execution result of the identical subtask and the execution result of the target subtask.

[0142] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When executed by a processor, the computer program performs the following steps: based on the dependencies between different nodes in a Bayesian network, the Bayesian network is divided into multiple sub-networks, with a convergence node and branch nodes as the basis. The convergence node is a node with multiple parent nodes, and the branch nodes are nodes with multiple child nodes. Different parent nodes of the same convergence node are independent of each other. A target task for the Bayesian network is obtained, and the target task is decomposed into multiple sub-tasks. The target task is used to obtain the probability that the target node is in a target state given that a condition node is in an initial state. Each sub-task corresponds to at least one sub-network, and the condition node is located upstream of the target node. During the execution of the target task, for the target sub-task in the corresponding sub-network including the convergence node and the parent node of the convergence node, from the multiple sub-tasks, a sub-task whose sub-network is upstream of the corresponding sub-network of the target sub-task is determined. When all determined sub-tasks have been executed, the target sub-task is executed. Based on the initial state of the condition node and the execution result of the target sub-task, the probability that the target node is in the target state is obtained.

[0143] In one embodiment, after the computer program is executed by the processor to divide the Bayesian network into multiple sub-networks, the method further includes: for the edge nodes in the Bayesian network, inputting the prior data of the edge nodes into a preset hash model and outputting a hash value, wherein the prior data includes at least one of an edge probability table or a conditional probability table, and the edge node is a root node or a terminal node; wherein the conditional probability table of the edge nodes is used to characterize the probability that the edge node is in different states when its parent node is in different states; obtaining at least one distributed storage unit and the remainder obtained by dividing the hash value by the number of distributed storage units, and determining the corresponding distributed storage unit of the edge node based on the remainder; storing the prior data of the edge nodes in the corresponding distributed storage unit of the edge nodes, and based on the storage result of the prior data of the edge nodes, storing the prior data of the remaining nodes in the Bayesian network other than the edge nodes in the corresponding distributed storage unit of the edge nodes.

[0144] In one embodiment, the storage result based on the edge node, implemented when the computer program is executed by the processor, stores the prior data of the remaining nodes in the Bayesian network other than the edge node into the corresponding distributed storage unit of the edge node, including: for a sub-network including the edge node, storing the prior data of the remaining nodes in the sub-network other than the edge node into the corresponding distributed storage unit of the edge node; for the remaining sub-network other than the sub-network including the edge node, storing the prior data of the nodes in the remaining sub-network into the corresponding distributed storage unit of the edge node based on the dependency relationship between the nodes in the remaining sub-network and the nodes in the sub-network including the edge node.

[0145] In one embodiment, the storage result based on the edge node, implemented when the computer program is executed by the processor, after storing the prior data of the remaining nodes in the Bayesian network other than the edge node into the corresponding distributed storage unit of the edge node, further includes: obtaining the amount of prior data stored in the distributed storage unit; determining the distributed storage unit with the largest corresponding data amount as the first storage unit, determining the distributed storage unit with the smallest corresponding data amount as the second storage unit, and obtaining the data amount difference between the first storage unit and the second storage unit; if the data amount difference is greater than a preset difference, sequentially transferring the prior data in the first storage unit to the second storage unit in a preset order until the data amount difference between the first storage unit and the second storage unit is not greater than the preset difference; returning to the step of determining the distributed storage unit with the largest corresponding data amount as the first storage unit and the distributed storage unit with the smallest corresponding data amount as the second storage unit and continuing to execute, until the data amount difference between any two distributed storage units is not greater than the preset difference.

[0146] In one embodiment, the process of transferring prior data from the first storage unit to the second storage unit in a preset order when executed by a computer program includes: determining the nodes corresponding to the prior data in the first storage unit and the sub-networks corresponding to the prior data in the first storage unit; sorting the sub-networks corresponding to the first storage unit in ascending order of the number of nodes included in the sub-networks; transferring the prior data of the nodes included in the first preset number of sub-networks in the sorting result to the second storage unit, and deleting the first preset number of sub-networks from the sorting result; if the difference in data volume between the first storage unit and the second storage unit is greater than the preset difference, returning to the step of transferring the prior data of the nodes included in the first preset number of sub-networks in the sorting result to the second storage unit and continuing execution until the difference in data volume between the first storage unit and the second storage unit is not greater than the preset difference.

[0147] In one embodiment, the method implemented by the computer program when executed by a processor further includes: acquiring multiple historical tasks for the Bayesian network; acquiring the number of times the distributed storage unit was requested during the execution of the multiple historical tasks; for distributed storage units with a number of requests greater than a first preset number, acquiring prior data in the distributed storage unit with a number of requests greater than a second preset number; determining the node corresponding to the prior data with a number of requests greater than the second preset number, and acquiring the sub-network corresponding to the node; and transferring the prior data of the nodes included in the sub-network to the distributed storage unit with a number of requests less than the first preset number.

[0148] In one embodiment, when a computer program is executed by a processor, the probability of a target node being in the target state is obtained based on the initial state of the condition node and the execution result of the target subtask. This includes: for the Bayesian network, obtaining historical tasks that have the same condition node as the target task and whose condition node is in the initial state; if there is an identical subtask between the target task and the historical task, determining the execution result of the identical subtask during the execution of the historical task as the execution result of the identical subtask during the execution of the target task; and obtaining the probability of the target node being in the target state based on the execution result of the identical subtask and the execution result of the target subtask.

[0149] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.

[0150] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.

[0151] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0152] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A method for obtaining node probabilities in a Bayesian network, characterized in that, The method includes: Based on the dependencies between different nodes in a Bayesian network, the Bayesian network is divided into multiple sub-networks with the convergence node and branch node as the basis. The convergence node is a node with multiple parent nodes, and the branch node is a node with multiple child nodes. Different parent nodes of the same convergence node are independent of each other. Obtain the target task for the Bayesian network, and decompose the target task into multiple subtasks. The target task is used to obtain the probability that the target node is in the target state when the condition node is in the initial state. Each subtask corresponds to at least one sub-network, and the condition node is located upstream of the target node. During the execution of the target task, for the target sub-task of the corresponding sub-network including the aggregation node and the parent node of the aggregation node, the sub-task of the sub-network located upstream of the target sub-task is determined from the multiple sub-tasks. After all the determined sub-tasks have been executed, the target sub-task is executed. Based on the initial state of the condition node and the execution result of the target subtask, the probability that the target node is in the target state is obtained.

2. The method according to claim 1, characterized in that, After dividing the Bayesian network into multiple sub-networks, the method further includes: For the edge nodes in the Bayesian network, the prior data of the edge nodes are input into a preset hash model, and a hash value is output. The prior data includes at least one of edge probability or conditional probability table. The edge node is a root node or a terminal node. The conditional probability table of the edge node is used to characterize the probability that the edge node is in different states when the parent node of the edge node is in different states. Obtain at least one distributed storage unit and the remainder obtained by dividing the hash value by the number of distributed storage units, and determine the corresponding distributed storage unit of the edge node based on the remainder; The prior data of the edge node is stored in the corresponding distributed storage unit of the edge node, and based on the storage result of the prior data of the edge node, the prior data of the remaining nodes in the Bayesian network other than the edge node is stored in the corresponding distributed storage unit of the edge node.

3. The method according to claim 2, characterized in that, The storage result based on the edge node, storing the prior data of the remaining nodes in the Bayesian network (excluding the edge node) into the corresponding distributed storage unit of the edge node, includes: For a sub-network that includes edge nodes, the prior data of the remaining nodes in the sub-network other than the edge nodes are stored in the corresponding distributed storage unit of the edge nodes; For the remaining subnetworks other than the subnetwork that includes the edge node, based on the dependencies between the nodes in the remaining subnetworks and the nodes in the subnetwork that includes the edge node, the prior data of the nodes in the remaining subnetworks is stored in the corresponding distributed storage unit of the edge node.

4. The method according to claim 2, characterized in that, After storing the prior data of the remaining nodes in the Bayesian network (excluding the edge nodes) into the corresponding distributed storage units of the edge nodes based on the storage results of the edge nodes, the method further includes: Obtain the amount of prior data stored in the distributed storage unit; The distributed storage unit with the largest corresponding data volume is determined as the first storage unit, and the distributed storage unit with the smallest corresponding data volume is determined as the second storage unit. The data volume difference between the first storage unit and the second storage unit is obtained. If the difference in data volume is greater than a preset difference, the prior data in the first storage unit is transferred to the second storage unit in a preset order until the difference in data volume between the first storage unit and the second storage unit is not greater than the preset difference. Return to the step of determining the distributed storage unit with the largest corresponding data volume as the first storage unit and the distributed storage unit with the smallest corresponding data volume as the second storage unit, and continue to execute until the difference in data volume between any two distributed storage units is no greater than the preset difference.

5. The method according to claim 4, characterized in that, The step of sequentially transferring the prior data in the first storage unit to the second storage unit in a preset order includes: Determine the node corresponding to the prior data in the first storage unit, and the sub-network corresponding to the prior data in the first storage unit; For the sub-networks corresponding to the first storage unit, the sub-networks are sorted in ascending order of the number of nodes included in the sub-networks; The prior data of the nodes included in the first preset number of sub-networks in the sorting result are transferred to the second storage unit, and the first preset number of sub-networks are deleted from the sorting result; If the difference in data volume between the first storage unit and the second storage unit is greater than the preset difference, return to the step of transferring the prior data of the nodes included in the first preset number of sub-networks in the sorting result to the second storage unit and continue execution until the difference in data volume between the first storage unit and the second storage unit is not greater than the preset difference.

6. The method according to claim 2, characterized in that, The method further includes: Obtain multiple historical tasks for the Bayesian network; Obtain the number of times the distributed storage unit was requested during the execution of the multiple historical tasks; For a distributed storage unit whose number of requests exceeds a first preset number, obtain prior data in the distributed storage unit whose number of requests exceeds a second preset number. Identify the nodes corresponding to the prior data whose requested number is greater than a second preset number, and obtain the sub-network corresponding to the nodes; The prior data of the nodes included in the sub-network are transferred to the corresponding distributed storage unit whose requested number is less than the first preset number.

7. The method according to claim 1, characterized in that, The step of obtaining the probability that the target node is in the target state based on the initial state of the condition node and the execution result of the target subtask includes: For the Bayesian network, obtain historical tasks that have the same condition nodes as the target task and are in the initial state; If there are identical subtasks between the target task and the historical task, the execution result of the identical subtask during the execution of the historical task shall be determined as the execution result of the identical subtask during the execution of the target task. Based on the execution results of the same subtask and the execution results of the target subtask, the probability that the target node is in the target state is obtained.

8. A device for obtaining node probabilities in a Bayesian network, characterized in that, The device includes: The partitioning module is used to divide the Bayesian network into multiple sub-networks based on the dependency relationships between different nodes in the Bayesian network, with the convergence node and branch node as the benchmark. The convergence node is a node with multiple parent nodes, and the branch node is a node with multiple child nodes. Different parent nodes of the same convergence node are independent of each other. The first acquisition module is used to acquire the target task for the Bayesian network, decompose the target task into multiple sub-tasks, the target task is used to acquire the probability that the target node is in the target state when the condition node is in the initial state, each sub-task corresponds to at least one sub-network, and the condition node is located upstream of the target node. The first determining module is used, during the execution of the target task, for the target sub-task of the corresponding sub-network including the aggregation node and the parent node of the aggregation node, to determine from the multiple sub-tasks the sub-network of the target sub-task that is located upstream of the corresponding sub-network of the target sub-task, and to execute the target sub-task when all the determined sub-tasks have been executed. The second acquisition module is used to acquire the probability that the target node is in the target state based on the initial state of the condition node and the execution result of the target subtask.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.