A method and apparatus for causal structure discovery based on expert knowledge correction
By using an expert knowledge-based correction method, an autoencoder is used to train the performance factor dataset and adjacency matrix of the QUIC protocol to generate a more accurate causal structure. This solves the problem of insufficient accuracy of causal relationships in the performance analysis of the QUIC protocol and improves the accuracy and speed of causal structure discovery.
Patent Information
- Application Number
- CN202411713130.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-27
- Publication Date
- 2026-01-30
- Estimated Expiration
- 2044-11-27
AI Technical Summary
Existing technologies for QUIC protocol performance analysis rely on experience-driven approaches and traditional machine learning models, which suffer from incomplete expert knowledge and insufficient interpretability, resulting in low accuracy in causal relationship analysis.
By using an expert knowledge-based correction method, the target causal graph is determined by utilizing a pre-set autoencoder training target protocol performance factor dataset and adjacency matrix. The model parameters are then updated by combining soft expert knowledge optimization algorithms to generate a more accurate causal structure.
It improves the accuracy of causal graph generation, makes full use of expert knowledge, enhances the accuracy and speed of causal structure discovery, and provides theoretical guidance for QUIC protocol performance optimization.
Smart Images

Figure CN119808935B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of next-generation Internet and artificial intelligence, in particular to a method and device for discovering causal structure based on expert knowledge correction. BACKGROUND
[0002] Network protocol is an interactive language for Internet to carry out data transmission. Taking QUIC protocol as an example, QUIC protocol is a transport layer protocol based on user datagram protocol implemented in user space, aiming to improve the speed and reliability of network connection. Among them, the performance of QUIC protocol needs to be analyzed to ensure the speed and reliability of network connection. And the performance of QUIC protocol is affected by many interdependent factors such as network bandwidth, packet loss rate, congestion window size.
[0003] At present, the performance analysis of QUIC protocol mainly depends on experience-driven and manual analysis, or uses traditional machine learning model. Among them, when relying on experience-driven and manual analysis, it may need to completely rely on expert knowledge, but the incompleteness of expert knowledge limits the depth and breadth of analysis; when using traditional machine learning model for analysis, it lacks interpretability and precision is limited. Therefore, the causal relationship between the performance influencing factors in the above QUIC protocol can be determined, thereby providing theoretical guidance for improving the performance of QUIC protocol.
[0004] Among them, causal structure discovery refers to establishing a directed acyclic graph between observed variables to represent the causal relationship between variables through analysis of observation data, so that causal reasoning can be carried out based on causal structure discovery, and the generalization and interpretability of intelligent algorithm can be improved. Specifically, causal relationship is a relationship between variables. For two given variables, if changing one variable will change the other variable while keeping other mechanisms unchanged, the former is called cause and the latter is called effect, and there may be complex causal relationships among multiple variables, forming a causal relationship network, which can be described by a directed acyclic graph, called causal graph.
[0005] In addition, automatic causal structure discovery is an effective method for building causal graph, which can automatically discover the causal relationship between variables based on the analysis of observation data when the causal relationship and related relationship between variables are not clear. In the prior art, the causal structure discovery can be converted into an optimization problem with the directed acyclicity of the generated graph as a constraint based on the gradient method, and the directed acyclicity constraint is converted into a continuous and differentiable constraint function, and then a mainstream optimization solver can be used for solving. However, the above prior art does not consider expert knowledge, so that the accuracy is low and the anti-causal relationship may be obtained. SUMMARY
[0006] The present application aims to at least solve one of the technical problems in the related art to some extent.
[0007] To this end, one object of the present application is to provide a causal structure discovery method based on expert knowledge correction, which can train a preset autoencoder based on an adjacency matrix and a performance factor dataset of a target protocol obtained based on expert knowledge, and determine a target causal graph based on model parameters in the training process to obtain the causal structure of the target protocol on performance influencing factors, thereby fully utilizing expert knowledge and improving the accuracy of generated causal graphs.
[0008] Another object of the present application is to provide a causal structure discovery device based on expert knowledge correction.
[0009] To achieve the above object, in one aspect, an embodiment of the present application provides a causal structure discovery method based on expert knowledge correction, comprising:
[0010] determining a performance factor dataset of a target protocol;
[0011] obtaining an adjacency matrix of the target protocol based on expert knowledge;
[0012] training a preset autoencoder based on the performance factor dataset and the adjacency matrix, and determining a target causal graph based on model parameters in the training process.
[0013] The causal structure discovery method based on expert knowledge correction of the present application can further have the following additional technical features:
[0014] Further, the performance factor dataset of the target protocol is determined, comprising:
[0015] obtaining source code of the target protocol after modification;
[0016] running an application based on the target protocol based on the source code of the target protocol after modification to obtain a corresponding protocol log;
[0017] determining the performance factor dataset of the target protocol based on the protocol log.
[0018] Further, the performance factor dataset of the target protocol is determined based on the protocol log, comprising:
[0019] determining an initial array, wherein each row in the initial array represents the values of all performance-related variables at a corresponding time, and each performance-related variable is provided with a corresponding update time variable and an update value;
[0020] reading the target protocol log row by row, extracting a target row starting with a preset string, and extracting a timestamp, a target variable, and a variable value from the target row;
[0021] If the timestamp is greater than the global variable, update the global variable, and add a row in the initial array to add the update value corresponding to the performance-related variable of the target variable, and loop until the timestamp is less than or equal to the global variable, update the update time variable and the update value of the target variable.
[0022] Further, the preset autoencoder is trained based on the performance factor data set and the adjacency matrix, and a target causal graph is determined based on model parameters in a training process, including:
[0023] An initial causal graph of the preset autoencoder is determined.
[0024] A loss function of the preset autoencoder is determined based on the initial causal graph.
[0025] Data in the performance factor data set is input into the preset autoencoder in batches to obtain an output result of each batch of data.
[0026] A loss function value corresponding to each batch of data is determined based on the output result of each batch of data and the loss function.
[0027] Parameters and hyperparameters in the preset autoencoder are updated by using an optimization algorithm corrected by soft expert knowledge based on the loss function value and the adjacency matrix, and the above training process is repeated until the iteration number of the parameters reaches a preset number, and a causal graph corresponding to a hyperparameter with the maximum loss function value is determined as the target causal graph.
[0028] Further, the loss function of the preset autoencoder is determined based on the initial causal graph, including:
[0029] A first target function is determined based on the initial causal graph.
[0030] The first target function is converted into a second target function, and the second target function is determined as the loss function of the preset autoencoder.
[0031] Further, the preset autoencoder includes a fully connected layer, and the parameters and hyperparameters in the preset autoencoder are updated by using the optimization algorithm corrected by soft expert knowledge based on the loss function value, including:
[0032] Parameter change values and adjacency matrix values of any two variables in the fully connected layer are determined based on the loss function value and the adjacency matrix.
[0033] The parameters in the preset autoencoder are updated by using the optimization algorithm corrected by soft expert knowledge based on the parameter change values and the adjacency matrix values.
[0034] Further, the optimization algorithm is used to update the parameters and hyperparameters in the preset autoencoder by using soft expert knowledge correction based on the parameter change value and the adjacency matrix value, and the optimization algorithm includes:
[0035] If the parameter change value is less than or equal to a first threshold value, and the adjacency matrix value is less than or equal to a second threshold value, the parameters in the full connection layer are updated according to a first rule;
[0036] If the parameter change value is greater than the first threshold value, and the adjacency matrix value is greater than the second threshold value, the parameters in the full connection layer are updated according to a second rule;
[0037] If the parameter change value is greater than the first threshold value, and the adjacency matrix value is less than or equal to the second threshold value, the parameters in the full connection layer are updated according to a third rule;
[0038] If the parameter change value is less than or equal to the first threshold value, and the adjacency matrix value is greater than the second threshold value, the parameters in the full connection layer are updated according to a fourth rule;
[0039] The parameters in the remaining network layers in the preset autoencoder are updated according to a fifth rule;
[0040] The hyperparameters in the preset autoencoder are updated according to a sixth rule.
[0041] To achieve the above object, another aspect of the present application provides a device for discovering a causal structure based on expert knowledge correction, which comprises:
[0042] A determination module is configured to determine a performance factor data set of a target protocol;
[0043] An acquisition module is configured to acquire an adjacency matrix of the target protocol based on expert knowledge;
[0044] A training module is configured to train a preset autoencoder based on the performance factor data set and the adjacency matrix, and determine a target causal graph based on model parameters in a training process.
[0045] Additional aspects and advantages of the present application will be given in part in the following description, become apparent from the following description, or be understood through practice of the present application. BRIEF DESCRIPTION OF DRAWINGS
[0046] The above and / or additional aspects and advantages of the present application will become apparent and be readily understood from the following description, taken in conjunction with the accompanying drawings, in which:
[0047] Figure 1 A flowchart of a method for discovering a causal structure based on expert knowledge correction according to an embodiment of the present application;
[0048] Figure 2 A structural schematic diagram of a correction-based causal structure discovery device according to an embodiment of the present application. DETAILED DESCRIPTION
[0049] Embodiments of the present application are described below in detail with reference to examples shown in the accompanying drawings, in which the same or similar components are denoted by the same or similar reference numerals throughout. The embodiments described below by reference to the accompanying drawings are exemplary and are intended to explain the present application, and should not be understood as limiting the present application.
[0050] A correction-based causal structure discovery method and device according to an embodiment of the present application are described below with reference to the accompanying drawings.
[0051] First, a correction-based causal structure discovery method according to an embodiment of the present application is described with reference to the accompanying drawings.
[0052] Figure 1 A flowchart of a correction-based causal structure discovery method according to an embodiment of the present application.
[0053] As shown in Figure 1 the correction-based causal structure discovery method includes the following steps:
[0054] Step S1, determining a performance factor data set of a target protocol;
[0055] It should be noted that in an embodiment of the present application, the target protocol can be any protocol in a network protocol, and the embodiments of the present application do not limit this. For example, the target protocol can be a QUIC protocol.
[0056] In an embodiment of the present application, the source code of the target protocol can be modified, and then the performance factor data set of the target protocol is determined based on the modified source code.
[0057] Specifically, in an embodiment of the present application, the method of determining the performance factor data set of the target protocol can include the following steps:
[0058] Step S11, obtaining the modified source code of the target protocol;
[0059] Step S12, based on the modified source code of the target protocol, running an application based on the QUIC protocol to obtain a corresponding protocol log;
[0060] Step S13, determining the performance factor data set of the target protocol based on the protocol log.
[0061] In an embodiment of the present application, a print log code is added after the code line changing the value of the performance-related variable in the source code of the target protocol, so that the performance-related variable x is recorded in the log in the format of i at time t and each record occupies a line.
[0062] In an embodiment of the present application, the method for determining the performance factor data set of the target protocol based on the protocol log can include the following steps:
[0063] Step S131, determining an initial array, wherein each line in the initial array represents the value of all performance-related variables at the corresponding time, and each performance-related variable is provided with a corresponding update time variable and an update value;
[0064] Step S132, reading the target protocol log line by line, extracting the target line starting with a preset string, and extracting the timestamp, target variable and variable value from the target line;
[0065] Step S133, if the timestamp is greater than the global variable, updating the global variable, and adding the update value of the performance-related variable corresponding to the target variable in the initial array, and performing the loop until the timestamp is less than or equal to the global variable, updating the update time variable and the update value of the target variable.
[0066] In an embodiment of the present application, a variable-length initial array can be used to record the performance impact factor data with a specified time granularity g, and each line in the initial array represents the value of all performance-related variables at the corresponding time, for example the s-th line records the values of all performance variables at s·g time.
[0067] In an embodiment of the present application, the target protocol log is read line by line, the target line starting with a preset string is extracted, and the timestamp t, the target variable x i and the variable value wherein the preset string can be "CHANGE" in the modified source code, a global variable record_time is set, initialized to 0, a temporary variable update time variable last_update_time and an update value last_value are set for each performance-related variable, last_update_time is initialized to 0, and last_value is initialized to the default value of each variable in the initial state, which can be determined by checking the protocol source code and the configuration file.
[0068] Further, in one embodiment of the present application, if the timestamp t > record_time, the global variable record_time is updated as record_time <- record_time + g, and a new row is added to the initial array , where the value of the jth item is the last_value of the variable x j , and the loop is executed until the timestamp t ≤ record_time, the update time variable last_update_time of the target variable x i is updated as t, and the update value last_value is
[0069] Step S2, obtaining an adjacency matrix of the target protocol based on expert knowledge;
[0070] In one embodiment of the present application, the adjacency matrix can quantify the confidence of the expert knowledge on the existence of the causal relationship. Specifically, in one embodiment of the present application, for an object with d observation variables, the expert knowledge can be represented as a d × d adjacency matrix K, where K ij (i,j ≤ d) represents the confidence of the expert knowledge on the existence of a direct causal relationship between the ith variable and the jth variable, K ij = 1 represents that the expert believes that there is a direct causal relationship between the ith variable and the jth variable; K ij = 0 represents that the expert believes that there is no causal relationship between the ith variable and the jth variable, and the above two are "hard expert knowledge", that is, the expert knowledge definitely believes that there is or is not a causal relationship between two variables; K ij ∈ (0, 1) represents that the expert knowledge believes that the degree of certainty of the existence of a causal relationship between the ith variable and the jth variable is K ij , which is "soft expert knowledge". And if K ij = 0.5 represents that the expert knowledge cannot determine whether there is a causal relationship between the ith variable and the jth variable. It should be noted that in one embodiment of the present application, the expression "there is a causal relationship between the ith variable and the jth variable" has a directional nature, the ith variable is the "cause" and the jth variable is the "effect".
[0071] Step S3, training a preset autoencoder based on the performance factor dataset and the adjacency matrix, and determining the target causal graph based on the model parameters in the training process.
[0072] In one embodiment of the present application, after obtaining the performance factor dataset and the adjacency matrix through the above steps, the preset autoencoder can be trained based on the performance factor dataset and the adjacency matrix, and the target causal graph can be determined based on the model parameters in the training process.
[0073] Specifically, in one embodiment of the present application, the method for training the preset autoencoder based on the performance factor dataset and the adjacency matrix and determining the target causal graph based on the model parameters in the training process can include the following steps:
[0074] Step S31, determining an initial causal graph of the preset autoencoder;
[0075] Step S32, determining a loss function of the preset autoencoder based on the initial causal graph;
[0076] Step S33, inputting the data in the performance factor dataset into the preset autoencoder in batches to obtain the output result of each batch of data;
[0077] Step S34, determining the loss function value corresponding to each batch of data based on the output result of each batch of data and the loss function;
[0078] Step S35, updating the parameters and hyperparameters in the preset autoencoder based on the loss function value and the adjacency matrix using the soft expert knowledge correction optimization algorithm, repeating the above training process, and when the iteration number of the parameters reaches a preset number, determining the causal graph corresponding to the hyperparameters with the maximum loss function value as the target causal graph.
[0079] In one embodiment of the present application, the input of the preset autoencoder can be multi-dimensional data in the performance factor dataset, and the output data has the same dimension as the input data. For example, assuming that the input dimension of the preset autoencoder is d and the output dimension is d, the first layer of the preset autoencoder can be a fully connected layer, and other layers can use any type of neural network. An activation function can be used between layers to increase the nonlinearity of the model. The specific network and activation function type depend on the specific application scenario and data type. The input dimension and output dimension of the fully connected layer can be the same or different. For example, assuming that the input dimension of the fully connected layer is d and the output dimension is d x m, where m is a positive integer, the parameters of the preset autoencoder can be represented as a matrix A of (d m) x d (1) .
[0080] In one embodiment of the present application, the preset autoencoder can use a random initialization method for parameter initialization. For the lth layer parameter matrix A (l) (l > 1), the elements thereof follow a Gaussian distribution with a mean of 0 and a variance of , where n l-1 is the number of parameters of the (l-1)th layer; the first layer of parameters is initialized as a random real number matrix following a standard normal distribution.
[0081] Further, in an embodiment of the present application, the initial causal graph of the preset autoencoder can be determined by artificial experience, wherein the initial causal graph contained in the preset autoencoder can be W, and the element in the ith row and jth column of W is defined as:
[0082]
[0083] wherein σ is an edge activation threshold, W ij ′ is expressed as:
[0084]
[0085] wherein A (1) (d·j+t)i represents the matrix A (1) the element in the d·j+t row and ith column.
[0086] Further, in an embodiment of the present application, the method for determining the loss function of the preset autoencoder based on the initial causal graph can include the following steps:
[0087] Step S321, determining a first objective function based on the initial causal graph;
[0088] Step S322, converting the first objective function into a second objective function, and determining the second objective function as the loss function of the preset autoencoder.
[0089] wherein, in an embodiment of the present application, based on the initial causal graph, the first objective function with a nonlinear equality constraint can be determined as:
[0090]
[0091] subject to h(W)=0
[0092] wherein h(W) is a constraint function representing a directed acyclic graph:
[0093]
[0094] wherein the operator ° is the Hadamard multiplication of the matrix, and tr(·) is the rank of the matrix.
[0095] and, in an embodiment of the present application, the expansion of the first objective function F(W) can be:
[0096] F(W)=SSE+λ‖W‖1+p(θ)
[0097] wherein SS is the error sum of squares of the decoding result and the original data:
[0098]
[0099] wherein ||W||1 is the l1 norm of W, θ represents the autoencoder model parameters, λ is a regularization coefficient, and f denotes a mapping represented by the autoencoder model. p(θ) is a penalty term for violating the hard expert knowledge constraint:
[0100]
[0101] wherein γ is a sufficiently large penalty coefficient.
[0102] In an embodiment of the present application, if the optimization problem with constraints cannot be solved by using a neural network, the first objective function can be converted into a second objective function by using the augmented Lagrangian method:
[0103]
[0104] wherein the loss function of the neural network can be set based on the second objective function obtained by the above steps
[0105]
[0106] wherein ρ is a penalty coefficient of the constraint function, and α is a hyperparameter of the loss function.
[0107] Further, in an embodiment of the present application, after obtaining the loss function by the above steps, the data in the performance factor dataset can be input into the preset autoencoder in batches to obtain the output results of each batch of data. Specifically, assuming that the training round is n_epoch, the data in the performance factor dataset is input into the preset autoencoder in multiple batches in each round of training, and the size of each batch of data is batch_size. Furthermore, for each batch of data, the self-encoding output of the batch of data is obtained by the preset autoencoder, and the loss function value corresponding to the batch of data is calculated by using the above loss function.
[0108] Further, in an embodiment of the present application, after obtaining the loss function value corresponding to each batch of data by the above steps, the parameters and hyperparameters in the preset autoencoder can be updated by using the soft expert knowledge correction optimization algorithm based on the loss function value and the adjacency matrix, and the above training process is repeated until the iteration number of the parameters reaches a preset number, so as to determine the causal diagram corresponding to the hyperparameters with the maximum loss function value as the target causal diagram.
[0109] In an embodiment of the present application, the optimization algorithm for soft expert knowledge correction can be that if the current gradient descent direction makes the trend of the causal relationship between variables in the causal graph contained in the neural network opposite to the causal relationship that the expert knowledge tends to believe, the step size of this update should be reduced, otherwise the step size of this update should be increased; and the more confident the expert knowledge is in the causal relationship it tends to believe, the larger the update step size in that direction should be and the smaller the update step size in the opposite direction should be; and the farther the causal relationship between variables in the current causal graph deviates from the causal relationship that the expert knowledge tends to believe, the larger the step size should be when updating in the direction suggested by the expert knowledge and the smaller the step size should be when updating in the opposite direction.
[0110] Specifically, in an embodiment of the present application, the method for updating the parameters and hyperparameters in the preset autoencoder using the optimization algorithm for soft expert knowledge correction based on the loss function value can include the following steps:
[0111] Step 1, determining the parameter change value and the adjacency matrix value of any two variables in the fully connected layer based on the loss function value and the adjacency matrix;
[0112] Step 2, updating the parameters in the preset autoencoder using the optimization algorithm for soft expert knowledge correction based on the parameter change value and the adjacency matrix value.
[0113] In an embodiment of the present application, the parameters of the first fully connected layer in the preset autoencoder are A (1) (m·j+t)i , then the parameter change value of variable i and variable j in any two variables is
[0114] In an embodiment of the present application, the method for updating the parameters in the preset autoencoder using the optimization algorithm for soft expert knowledge correction based on the parameter change value and the adjacency matrix value can include the following steps:
[0115] Step a, if the parameter change value is less than or equal to a first threshold value and the adjacency matrix value is less than or equal to a second threshold value, updating the parameters in the fully connected layer according to a first rule;
[0116] Step b, if the parameter change value is greater than the first threshold value and the adjacency matrix value is greater than the second threshold value, updating the parameters in the fully connected layer according to a second rule;
[0117] Step c, if the parameter change value is greater than the first threshold value and the adjacency matrix value is less than or equal to the second threshold value, updating the parameters in the fully connected layer according to a third rule;
[0118] Step d, if the parameter change value is less than or equal to the first threshold value, and the adjacency matrix value is greater than the second threshold value, then the parameters in the full connection layer are updated according to a fourth rule;
[0119] Step e, the parameters in the remaining network layers in the preset autoencoder are updated according to a fifth rule;
[0120] Step f, the hyperparameters in the preset autoencoder are updated according to a sixth rule.
[0121] In an embodiment of the present application, the first threshold value and the second threshold value can be set as needed, for example, the first threshold value is 0, and the second threshold value is 0.5.
[0122] In an embodiment of the present application, if the parameter change value Δ ij ≤0, and the adjacency matrix value K ij ≤0.5, it means that the expert knowledge tends to believe that there is no causal relationship between the variable i and the variable j, the update direction is consistent with the direction recommended by the expert knowledge, and W ij reflects the degree of deviation of the current causal graph from the causal relationship that the expert knowledge tends to believe, K ij reflects the support degree of the expert knowledge on the update in the direction of reducing the causal relationship between the variable i and the variable j, then the parameters in the full connection layer are updated according to a first rule, wherein the first rule is:
[0123]
[0124] wherein lr is a set learning rate, represents the partial derivative of A (1) (m·j+t)i is taken.
[0125] In an embodiment of the present application, if the parameter change value Δ ij >0, and the adjacency matrix value K ij >0.5, it means that the expert knowledge tends to believe that there is a causal relationship between the variable i and the variable j, the update direction is opposite to the direction recommended by the expert knowledge, and 1-W ij reflects the degree of deviation of the current causal graph from the causal relationship that the expert knowledge tends to believe, 1-K ij reflects the support degree of the expert knowledge on the update in the direction of reducing the causal relationship between the variable i and the variable j, then the parameters in the full connection layer are updated according to a second rule, wherein the second rule is:
[0126]
[0127] In an embodiment of the present application, if the parameter change value Δ ij >0, and the adjacency matrix value K ij≤ 0.5, the parameters in the fully connected layer are updated according to a third rule, wherein the third rule is:
[0128]
[0129] In an embodiment of the present application, if the parameter variation value Δ ij ≤ 0, and the adjacency matrix value K ij > 0.5, the parameters in the fully connected layer are updated according to a fourth rule, wherein the fourth rule is:
[0130]
[0131] In an embodiment of the present application, the parameters in the remaining network layers of the preset autoencoder are updated according to a fifth rule, wherein the fifth rule is:
[0132]
[0133] In an embodiment of the present application, the hyperparameters in the preset autoencoder are updated according to a sixth rule, wherein the sixth rule is:
[0134]
[0135] Further, in an embodiment of the present application, the soft expert knowledge is used in the above optimization algorithm to adjust the step of iteration, which can guide the optimization process to proceed in the direction suggested by the soft expert knowledge as much as possible, thereby improving the rate of discovering the causal graph. Moreover, in the case where the objective function has multiple local optimal solutions, the above process can also guide the optimization process to find the optimal solution that conforms to the law of the real world, thereby improving the accuracy of discovering the causal graph.
[0136] In an embodiment of the present application, the above training steps S33-S35 can be repeated until the number of iterations of the parameters reaches a preset number, and the causal graph corresponding to the hyperparameters with the maximum loss function value is determined as the target causal graph.
[0137] In an embodiment of the present application, the above-mentioned causal structure discovery method based on expert knowledge correction records runtime data of performance-related factors with small overhead and constructs a causal reasoning data set that retains data distribution information, and ingeniously introduces hard expert knowledge and soft expert knowledge into the loss function and the optimization algorithm respectively, thereby improving the accuracy and execution speed of automatic causal structure discovery, efficiently realizing causal structure discovery of performance influence factors of the target protocol, and providing theoretical guidance for further improving the performance of the target protocol. By recording data only when the variable value changes, the data distribution information can be retained with high precision while minimizing the data recording overhead. By introducing hard expert knowledge into the loss function, the generated causal graph is effectively constrained not to violate existing knowledge, and the information contained in the expert knowledge is learned during the training process of the autoencoder. By introducing soft expert knowledge into the optimization algorithm, the loss function is effectively guided to decrease in the direction suggested by the expert knowledge, increasing the possibility of obtaining the optimal solution in the area recognized by the expert knowledge, thereby improving the accuracy of the generated causal graph and speeding up the convergence of the algorithm to the optimal solution in the area.
[0138] The causal structure discovery method based on expert knowledge correction according to the embodiment of the present application can train a preset autoencoder based on the adjacency matrix and the performance factor data set of the target protocol obtained based on expert knowledge, determine a target causal graph based on model parameters in the training process, obtain the causal structure of the target protocol on performance influence factors, and fully utilize expert knowledge to improve the accuracy of the generated causal graph.
[0139] Next, the causal structure discovery device based on expert knowledge correction according to the embodiment of the present application is described with reference to the accompanying drawings.
[0140] Figure 2 The causal structure discovery device based on expert knowledge correction according to the embodiment of the present application is a structural schematic diagram.
[0141] As Figure 2 shown, the causal structure discovery device 10 based on expert knowledge correction includes a determination module 201, an acquisition module 202, and a training module 203, wherein
[0142] The determination module 201 is configured to determine a performance factor data set of a target protocol.
[0143] The acquisition module 202 is configured to acquire an adjacency matrix of the target protocol based on expert knowledge.
[0144] The training module 203 is configured to train a preset autoencoder based on the performance factor data set and the adjacency matrix, and determine a target causal graph based on model parameters in the training process.
[0145] Further, the determination module 201 is specifically configured to:
[0146] obtain the source code modified according to the target protocol;
[0147] running the application based on the target protocol based on the source code modified according to the target protocol, to obtain a protocol log corresponding to the target protocol;
[0148] determining a performance factor data set of the target protocol based on the protocol log.
[0149] Further, the determination module 201 is further configured to:
[0150] determining an initial array, wherein each row in the initial array represents the values of all performance-related variables at a corresponding time, and each performance-related variable is set with a corresponding update time variable and an update value;
[0151] reading the target protocol log row by row, extracting a target row starting with a preset string, and extracting a timestamp, a target variable and a variable value from the target row;
[0152] If the timestamp is greater than the global variable, the global variable is updated, and a new row is added to the initial array to add the update value of the performance-related variable corresponding to the target variable, and the loop is executed until the timestamp is less than or equal to the global variable, and the update time variable and the update value of the target variable are updated.
[0153] Further, the training module 203 is specifically configured to:
[0154] determining an initial causal diagram of the preset autoencoder;
[0155] determining a loss function of the preset autoencoder based on the initial causal diagram;
[0156] inputting the data in the performance factor data set into the preset autoencoder in batches to obtain an output result of each batch of data;
[0157] determining a loss function value corresponding to each batch of data based on the output result of each batch of data and the loss function;
[0158] updating the parameters and hyperparameters in the preset autoencoder using a soft expert knowledge correction optimization algorithm based on the loss function value and the adjacency matrix, repeating the above training process until the iteration number of the parameters reaches a preset number, and determining the causal diagram corresponding to the hyperparameters with the maximum loss function value as the target causal diagram.
[0159] Further, the training module 203 is specifically configured to:
[0160] determining a first target function based on the initial causal diagram;
[0161] converting the first target function into a second target function, and determining the second target function as the loss function of the preset autoencoder.
[0162] Further, the training module 203 is further configured to:
[0163] determine a parameter change value and an adjacency matrix value of any two variables in the full connection layer based on the loss function value and the adjacency matrix;
[0164] update the parameters in the preset auto-encoder by using a soft expert knowledge corrected optimization algorithm based on the parameter change value and the adjacency matrix value.
[0165] Further, the training module 203 is further configured to:
[0166] if the parameter change value is less than or equal to a first threshold value and the adjacency matrix value is less than or equal to a second threshold value, update the parameters in the full connection layer according to a first rule;
[0167] if the parameter change value is greater than the first threshold value and the adjacency matrix value is greater than the second threshold value, update the parameters in the full connection layer according to a second rule;
[0168] if the parameter change value is greater than the first threshold value and the adjacency matrix value is less than or equal to the second threshold value, update the parameters in the full connection layer according to a third rule;
[0169] if the parameter change value is less than or equal to the first threshold value and the adjacency matrix value is greater than the second threshold value, update the parameters in the full connection layer according to a fourth rule;
[0170] update the parameters in the remaining network layers in the preset auto-encoder according to a fifth rule;
[0171] update the hyperparameters in the preset auto-encoder according to a sixth rule.
[0172] The expert knowledge corrected causal structure discovery device provided by the embodiment of the present application can train the preset auto-encoder based on the adjacency matrix and the performance factor data set of the target protocol obtained based on the expert knowledge, and determine the target causal graph based on the model parameters in the training process, so as to obtain the causal structure of the target protocol on the performance influencing factors, fully utilize the expert knowledge, and improve the accuracy of the generated causal graph.
[0173] In addition, the terms "first", "second", "third", etc. are used only for the purpose of description, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the technical features indicated. Therefore, the features defined with "first", "second", etc. can explicitly or implicitly include at least one of the features. In the description of the present application, the meaning of "a plurality of" is at least two, for example, two, three, etc., unless otherwise specifically limited.
[0174] In the description of the specification, the description of the terms "one embodiment", "some embodiments", "an example", "a specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in connection with the embodiment or example are contained in at least one embodiment or example of the present application. In the specification, the illustrative description of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any suitable manner in any one or more embodiments or examples. In addition, the person skilled in the art can combine and combine the different embodiments or examples described in the specification and the features of the different embodiments or examples without contradiction.
[0175] Although the embodiments of the present application have been shown and described above, it is understood that the above-described embodiments are exemplary and are not to be construed as limiting the present application, and those skilled in the art can make changes, modifications, replacements and variations to the above-described embodiments within the scope of the present application.
Claims
1. A method for discovering a causal structure based on expert knowledge correction, characterized by, The method comprises: determining a performance factor data set of a target protocol; obtaining an adjacency matrix of the target protocol based on expert knowledge; training a preset autoencoder based on the performance factor data set and the adjacency matrix, and determining a target causal graph based on model parameters in the training process, wherein an initial causal graph of the preset autoencoder is determined, a loss function of the preset autoencoder is determined based on the initial causal graph, data in the performance factor data set is input into the preset autoencoder in batches, an output result of each batch of data is obtained, a loss function value corresponding to each batch of data is determined based on the output result of each batch of data and the loss function, parameters and hyperparameters in the preset autoencoder are updated by using an optimization algorithm corrected by soft expert knowledge based on the loss function value and the adjacency matrix, and the above training process is repeated until the iteration number of the parameters reaches a preset number, and a causal graph corresponding to the hyperparameters with the maximum loss function value is determined as the target causal graph; Among them, for those with An object of observed variables, representing expert knowledge as a... adjacency matrix ,in, Indicates expert knowledge on the first The variable and the first The confidence level of a direct causal relationship between the variables is high. Indicates expert knowledge on the first The variable and the first The degree of certainty that a causal relationship exists between the variables is: This type of situation falls under the category of soft expert knowledge.
2. The method of claim 1, wherein, The method comprises: obtaining source code of the target protocol after modification; running an application based on the target protocol based on the source code of the target protocol after modification to obtain a corresponding protocol log; determining a performance factor data set of the target protocol based on the protocol log.
3. The method of claim 2, wherein, The method comprises: determining an initial array, wherein each row in the initial array represents the value of all performance-related variables at a corresponding time, and each performance-related variable is provided with a corresponding update time variable and an update value; reading the target protocol log row by row, extracting a target row starting with a preset string, and extracting a timestamp, a target variable, and a variable value from the target row; if the timestamp is greater than a global variable, updating the global variable, and adding an update value of a performance-related variable corresponding to the target variable in a newly added row in the initial array, and cyclically executing until the timestamp is less than or equal to the global variable, and updating the update time variable and the update value of the target variable.
4. The method of claim 1, wherein, The method comprises: determining a first target function based on the initial causal graph; converting the first target function into a second target function, and determining the loss function of the preset autoencoder based on the second target function.
5. The method of claim 1, wherein, The preset autoencoder comprises a fully connected layer; and the method comprises: determining a parameter change value and an adjacency matrix value of any two variables in the fully connected layer based on the loss function value and the adjacency matrix; updating the parameters in the preset autoencoder by using the optimization algorithm corrected by soft expert knowledge based on the parameter change value and the adjacency matrix value.
6. The method of claim 5, wherein, The method comprises: if the parameter change value is less than or equal to a first threshold value and the adjacency matrix value is less than or equal to a second threshold value, updating the parameters in the fully connected layer according to a first rule; if the parameter change value is greater than the first threshold value and the adjacency matrix value is greater than the second threshold value, updating the parameters in the fully connected layer according to a second rule; if the parameter change value is greater than the first threshold value and the adjacency matrix value is less than or equal to the second threshold value, updating the parameters in the fully connected layer according to a third rule; if the parameter change value is less than or equal to the first threshold value and the adjacency matrix value is greater than the second threshold value, updating the parameters in the fully connected layer according to a fourth rule; updating the parameters in the remaining network layers in the preset autoencoder according to a fifth rule; updating the hyperparameters in the preset autoencoder according to a sixth rule.
7. A causal structure discovery device based on expert knowledge correction, characterized in that, The apparatus comprises: a determination module configured to determine a performance factor dataset of a target protocol; an acquisition module configured to acquire an adjacency matrix of the target protocol based on expert knowledge; a training module configured to train a preset autoencoder based on the performance factor dataset and the adjacency matrix, and determine a target causal diagram based on model parameters in a training process, wherein an initial causal diagram of the preset autoencoder is determined, the loss function of the preset autoencoder is determined based on the initial causal diagram, data in the performance factor dataset is input into the preset autoencoder in batches, an output result of each batch of data is obtained, a loss function value corresponding to each batch of data is determined based on the output result of each batch of data and the loss function, parameters and hyperparameters in the preset autoencoder are updated by using a soft expert knowledge correction optimization algorithm based on the loss function value and the adjacency matrix, and the above training process is repeated until the iteration number of the parameters reaches a preset number, and a causal diagram corresponding to a hyperparameter with the maximum loss function value is determined as the target causal diagram; Among them, for those with An object of observed variables, representing expert knowledge as a... adjacency matrix ,in, Indicates expert knowledge on the first The variable and the first The confidence level of a direct causal relationship between the variables is high. Indicates expert knowledge on the first The variable and the first The degree of certainty that a causal relationship exists between the variables is: This type of situation falls under the category of soft expert knowledge. 8.An electronic device comprising: at least one processor; and a memory connected to the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-6.
9. A non-transitory computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the method of any one of claims 1-6. The computer program is executed by the processor to implement the method of any one of claims 1-6.
Citation Information
Patent Citations
Causal analysis method, device and equipment combining expert knowledge and differentiable structure
CN118917421A