A causal mechanism discovery method and system based on temporal non-stationary state

By combining state space and Gaussian processes, a model is constructed to detect and learn changes in causal mechanisms, solving the problem of causal discovery in non-steady-state time series data with changes in causal direction and coefficients, and achieving accurate identification and learning of causal mechanisms.

CN114330724BActive Publication Date: 2025-10-28GUANGDONG UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111615970.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-27
Publication Date
2025-10-28
Estimated Expiration
2041-12-27

AI Technical Summary

Technical Problem

Existing causal discovery methods cannot effectively handle non-stationary time series data where both causal direction and causal coefficients change, leading to the discovery of incorrect causal edges or directions.

Method used

A model based on state space and Gaussian process is constructed to detect and learn changes in causal mechanisms. The hierarchical structure in time series data is identified through a state space detection layer, and the steady-state causal structure is learned using a Gaussian learning layer. The model parameters are optimized by combining Gaussian process and gradient backpropagation algorithm.

Benefits of technology

It enables the accurate discovery of non-steady-state causal relationships, identifies the location and direction of changes in causal mechanisms, and improves the accuracy and reliability of causal discovery.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114330724B_ABST
    Figure CN114330724B_ABST
Patent Text Reader

Abstract

This invention discloses a method for discovering causal mechanisms based on time-series non-stationary causal mechanisms, comprising the following steps: S1: acquiring a dataset with known time-series non-stationary causal mechanisms and processing the dataset; S2: constructing a model for discovering time-series non-stationary causal mechanisms; S3: training the model for discovering time-series non-stationary causal mechanisms using the dataset to obtain a trained model for discovering time-series non-stationary causal mechanisms; S4: using the trained model for discovering time-series non-stationary causal mechanisms to discover causal mechanisms in data with unknown time-series non-stationary causal mechanisms. This invention utilizes state space and Gaussian processes to detect and discover causal mechanisms from time-series data containing non-stationary causal mechanisms, thus realizing the discovery of non-stationary causal relationships.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of data mining and causal learning, and more specifically, to a method and system for discovering causal mechanisms based on time-series non-stationary states. Background Art

[0002] Discovering causal relationships from multiple time series has been a major focus for decades, with promising applications across various fields, such as stock price prediction, biological analysis, and social analysis. Most traditional methods are based on the assumption that the underlying causal mechanisms of time series are steady-state, including function-based, fractional, and constraint-based methods. However, in reality, the causal mechanisms behind time series data are often non-steady-state, as the underlying causal mechanisms change over time, such as the causal mechanisms in macroeconomics or the causal mechanisms behind neural connections in the brain. If we directly apply causal discovery methods designed for steady-state time series, we may obtain incorrect causal margins or incorrect causal directions.

[0003] Unlike methods based on steady-state assumptions, existing algorithms for non-stationary causal discovery can uncover the underlying causal mechanisms of data changes. However, these methods are limited to changes in causal coefficients and cannot be applied to non-stationary time-series data where the causal direction also changes. Although some smoothing methods attempt to estimate non-stationary causal models, they cannot explicitly locate the changing causal modules. Applying these methods directly to data with changing causal directions may return erroneous results. Therefore, causal discovery on non-stationary time-series data where both causal direction and causal coefficients change remains a challenging problem.

[0004] State-space models can decompose time series data. The purpose of time series decomposition is to estimate and extract deterministic components so that the residual is a stationary process. Gaussian processes are one of the main methods of Bayesian learning. Their nonparametric form, analytical properties, and ability to model uncertainty are highly desirable in machine learning. Considering the changes in the coefficients and directions of causal mechanisms, this method reduces the assumptions of steady state compared to existing methods and is more applicable to real-world scenarios, which is helpful for the implementation of causal discovery algorithms. Therefore, how to construct a model to detect the location of changes in causal mechanisms from time series data containing non-steady-state causal mechanisms, and then learn a causal structure model, is of significant research value.

[0005] Existing technology discloses a causal discovery method combining knowledge graphs and automatic variational coding, belonging to the field of causal discovery. This method transforms the causal structure learning problem into a continuous optimization problem in a vector space, overcoming the limitation of traditional causal discovery models that cannot be applied to large datasets. However, this approach cannot achieve the discovery of non-steady-state causal relationships. Summary of the Invention

[0006] The primary objective of this invention is to provide a method for discovering causal mechanisms based on time-series non-stationary states, which utilizes state space and Gaussian processes to detect and discover causal mechanisms from time-series data containing non-stationary causal mechanisms.

[0007] A further objective of this invention is to provide a causal mechanism discovery system based on time-series non-stationary states. To solve the above-mentioned technical problems, the technical solution of this invention is as follows:

[0008] A method for discovering causal mechanisms based on time-series nonstationary states includes the following steps:

[0009] S1: Obtain a dataset with known temporal non-stationary causal mechanisms and process the dataset;

[0010] S2: Construct a model for discovering temporally non-stationary causal mechanisms;

[0011] S3: Use the dataset to train the model for discovering time-series non-stationary causal mechanisms to obtain a trained model for discovering time-series non-stationary causal mechanisms;

[0012] S4: Use the trained model for discovering time-series non-stationary causal mechanisms to discover causal mechanisms in data with unknown time-series non-stationary causal mechanisms.

[0013] Preferably, the temporal non-stationary causal mechanism in step S1 includes changes in the causal coefficient and changes in the causal direction.

[0014] Preferably, the processing of the dataset in step S1 specifically includes:

[0015] The dataset is divided into two parts: 80% is used as the training set and the remaining portion is used as the test set.

[0016] Preferably, the model used in step S2 to discover the temporal non-stationary causal mechanism is specifically:

[0017] The model for discovering time-series non-stationary causal mechanisms includes a state-space detection layer and a Gaussian learning process. The input of the state-space detection layer is time-series data, and the state-space detection layer identifies the hierarchical structure in the time-series data. The Gaussian learning layer learns the stationary causal structure of the hierarchical time-series data.

[0018] Preferably, the state space detection layer is specifically represented as follows:

[0019] q(Z,S,M|X)=q(M|X)q(Z|M,X)q(S|Z,M,X)

[0020]

[0021] In the formula, X is the eigenvector, X = {x t}, Z and S are state variables, Z = {z t}, S={s t}, s <t z <t Let M represent all state variables up to t, and M be a binary random variable, M = {m t}, m <t Let represent all binary random variables before t. Let q(Z, S, M|X) represent the posterior joint probability distribution of detecting Z, S, and M under condition X; q(M|X) represent the posterior joint probability distribution of detecting M under condition X; q(Z|M, X) represent the posterior joint probability distribution of detecting Z under condition M and X; q(S|Z, M, X) represent the posterior joint probability distribution of detecting S under condition Z, M, and X; and p(X, Z, S, M) represent the prior joint probability distribution of X, Z, S, and M. t |s t ) indicates in s t Under the condition, x was detected t The prior conditional probability distribution, p(m) t |s t ) indicates in s t Under the condition, m was detected t The prior conditional probability distribution, p(s) t |s <t , z t m t-1 ) indicates in s <t , z t m t-1 Under the condition, s was detected t The prior conditional probability distribution, p(z) t |z <t m <t ) indicates that in z <t m <t Under the condition, z was detected t The prior conditional probability distribution;

[0022]

[0023]

[0024]

[0025]

[0026] In the formula, δ(z) t =z t-1 ) represents z t=z t-1 The prior probability distribution function, Indicates in d t Under the condition, z was detected t The prior conditional probability distribution Indicates in h t Under the condition, s was detected t The prior conditional probability distribution, f z-rnn (z t-1 |d t-1 ) indicates in d t-1 Under these conditions, learn z t-1 The rnn function, f s-rnn (s t-1 ||z t h t-1 )) indicates that s t-1 ,zt,h t-1 After connecting, learn s t-1 The rnn function, f z-mlp (z t ) represents z t The multilayer perceptron function;

[0027] To maximize the logarithmic probability of the observed data, that is:

[0028]

[0029] Approximation using the lower limit of evidence ELBO:

[0030]

[0031] In the formula, E q(Z,S,M|X) Let represent the mathematical expectation of q(Z, S, M|X), and KL() represent the KL divergence;

[0032] Using the sequential decomposition q(M|X), the boundary index M is first inferred:

[0033]

[0034] In the formula, Bernoulli distribution is represented by σ(), and activation function is represented by σ().

[0035] By reasoning from state q(Z|M,X) and q(S|Z,M,X), two abstract concepts are inferred upon the discovery of boundary structures. Where q(Z|M, X) is used to predict the state of a multivariate sub-time series. In order to use the same state within the multivariate sub-time series, the distribution q(z) is... t |M, X) is conditional on the boundary index M:

[0036]

[0037] In the formula, β(z) t =z t-1 ) for z t =z t-1 Posterior probability distribution function Extracted by a forward RNN, while Extracted by a backward RNN, the RNN depends on M to ensure β(z) t =z t-1 Independence between time series; the factor of S is and each s t From the distribution Sampling is performed to encode the observed sequence X, and updates are made at the start of a new multivariate sub-time series.

[0038] Preferably, the Gaussian learning process specifically includes:

[0039] Using linear and nonlinear functions to represent the causal relationships between observed variables in a multivariate sub-time series, these causal relationships can be formalized as follows:

[0040]

[0041] in Represents variable x i One set of reasons, u i It is a distractor, g i This represents the causal effects from unobserved confounding factors, which are considered to be time-smooth functions. Represents the k-th time series x i Steady-state causal function under the given conditions;

[0042] make Let N represent the finite dimension of the k-th multivariate sub-time series. For each sub-time series, considering time lag information, each variable x... i (t) are all generated by the following mechanisms:

[0043]

[0044] For each time-varying coefficient and confounding term, assume f j The prior is g i The prior is Where μ represents the corresponding mean in the Gaussian process, and V represents the covariance; assuming f j and g i If the prior values ​​are independent at different j and p, then w can be expressed as:

[0045] w k(t)~GP(μ(t),V(t,t))

[0046] Assume the noise is a Gaussian random variable, i.e., u i (t)~N(0,σ) 2 ), where σ 2 It is the variance of the noise; given the Gaussian process prior and Gaussian noise, the marginal likelihood of the observations can be expressed as a multivariate Gaussian distribution:

[0047]

[0048] y k =D x *{f j (t), g i (t)} T +u

[0049] Where the matrix symbol is:

[0050] u = [{u i (t)} i,t ] T

[0051]

[0052] Where I is the identity matrix, u = [{u i (t)} i,t ] T in Represents the Kronecker inner product;

[0053] The hyperparameters in the mean and covariance functions of a Gaussian process, as well as the variance σ of the noise, are learned by maximizing the marginal likelihood of the probability. 2 :

[0054]

[0055] The posterior mean Includes estimated lag coefficients and confusing items

[0056] Preferably, in step S3, training the model used to discover time-series non-stationary causal mechanisms specifically involves:

[0057] S31: Initialize model parameters;

[0058] S32: Calculate the prior and posterior probabilities of each variable and boundary, and obtain the total loss function based on the prior and posterior probabilities;

[0059] S33: Calculate the gradient and update the model parameters using the gradient backpropagation algorithm;

[0060] S34: Repeat steps S32 and S33 until the change in the total loss function is less than the threshold, obtain the final boundary M, compare it with the actual non-steady-state change position, and calculate the model's recall and accuracy indices.

[0061] S35: Divide the data into multiple steady-state sub-time series datasets according to M, and calculate the causal mechanism of each sub-time series dataset using a Gaussian process.

[0062] Preferably, the calculation of the prior and posterior probabilities of the boundary in step S32 is specifically as follows:

[0063] The prior probability distribution of boundary M is calculated as follows:

[0064]

[0065] In the formula, n(m) <t N represents the number of current multivariate sub-time series within time step t. max l(m) represents the maximum number of multivariate sub-time series. <t ) represents the length of the current multivariate sub-time series within time step t, l max Let f represent the longest length of a multivariate sub-time series, σ() be the activation function, and f m-mlp (s t ) represents s t The multilayer perceptron function;

[0066] The posterior probability distribution of the boundary M is calculated as follows:

[0067]

[0068] The loss at boundary M is calculated as follows:

[0069]

[0070] Prior and posterior of state variable Z:

[0071]

[0072]

[0073] The loss of state variable z is calculated as follows:

[0074]

[0075] Calculate the prior and posterior of the state variable S:

[0076]

[0077]

[0078] The loss function for state variable S is calculated as follows:

[0079]

[0080] The loss calculation method for reconstructed data is as follows:

[0081] loss obs =∑ t KL(q(X|Z,S,M)||p(X)).

[0082] Preferably, the total loss function in step S32 is as follows:

[0083] loss total =loss obs +(loss M +loss z +loss s ).

[0084] A causal mechanism discovery system based on time-series nonstationary states includes:

[0085] A data acquisition and processing module is used to acquire a dataset with a known time-series non-stationary causal mechanism and process the dataset.

[0086] A model building module, which is used to build a model for discovering time-series non-stationary causal mechanisms;

[0087] The training module uses the dataset to train the model for discovering time-series non-stationary causal mechanisms, thereby obtaining a trained model for discovering time-series non-stationary causal mechanisms.

[0088] The discovery module utilizes the trained model for discovering time-series non-stationary causal mechanisms to perform causal mechanism discovery on data with unknown time-series non-stationary causal mechanisms.

[0089] Compared with the prior art, the beneficial effects of the technical solution of the present invention are:

[0090] This invention utilizes state space and Gaussian processes to detect and discover causal mechanisms from time-series data containing non-steady-state causal mechanisms, thereby realizing the discovery of non-steady-state causal relationships. Attached Figure Description

[0091] Figure 1 This is a schematic diagram of the method flow of the present invention.

[0092] Figure 2 A schematic diagram of nonsteady-state causality provided for an embodiment.

[0093] Figure 3 This is a schematic diagram of a model for discovering time-series non-stationary causal mechanisms, provided as an example.

[0094] Figure 4 This is a schematic diagram of the system modules of the present invention. Detailed Implementation

[0095] The accompanying drawings are for illustrative purposes only and should not be construed as limiting the scope of this patent.

[0096] To better illustrate this embodiment, some parts in the accompanying drawings may be omitted, enlarged, or reduced, and do not represent the actual product dimensions;

[0097] It will be understood by those skilled in the art that certain well-known structures and their descriptions may be omitted in the accompanying drawings.

[0098] The technical solution of the present invention will be further described below with reference to the accompanying drawings and embodiments.

[0099] Example 1

[0100] This embodiment provides a method for discovering causal mechanisms based on time-series non-stationary states, such as... Figure 1 As shown, the following steps are included:

[0101] S1: Obtain a dataset with known temporal non-stationary causal mechanisms and process the dataset;

[0102] S2: Construct a model for discovering temporally non-stationary causal mechanisms;

[0103] S3: Use the dataset to train the model for discovering time-series non-stationary causal mechanisms to obtain a trained model for discovering time-series non-stationary causal mechanisms;

[0104] S4: Use the trained model for discovering time-series non-stationary causal mechanisms to discover causal mechanisms in data with unknown time-series non-stationary causal mechanisms.

[0105] The temporal non-stationary causal mechanism in step S1 includes changes in the causal coefficient and changes in the causal direction, such as... Figure 2 As shown in the figure, x1, x2, and x3 represent three variables, and the causal relationship between x1, x2, and x3 changes over time.

[0106] The processing of the dataset in step S1 specifically includes:

[0107] The dataset is divided into two parts: 80% is used as the training set and the remaining portion is used as the test set.

[0108] The model used in step S2 to discover the temporal non-stationary causal mechanism is specifically as follows:

[0109] The model used to discover the causal mechanism of time-series nonstationary states is as follows: Figure 3 As shown, the system includes a state-space detection layer and a Gaussian learning process. The Gaussian learning process is represented by a box in the figure, and the state-space detection layer is represented below the box. The input of the state-space detection layer is time-series data, and the state-space detection layer identifies the hierarchical structure in the time-series data. The Gaussian learning layer learns the steady-state causal structure of the hierarchical time-series data.

[0110] The state space detection layer is specifically represented as follows:

[0111] q(Z,S,M|X)=q(M|X)q(Z|M,X)q(S|Z,M,X)

[0112]

[0113] In the formula, X is the eigenvector, X = {x t}, Z and S are state variables, Z = {z t}, S={s t}, s <t z <t Let M represent all state variables up to t, and M be a binary random variable, M = {m t}, m <t Let represent all binary random variables before t. Let q(Z, S, M|X) represent the posterior joint probability distribution of detecting Z, S, and M under condition X; q(M|X) represent the posterior joint probability distribution of detecting M under condition X; q(Z|M, X) represent the posterior joint probability distribution of detecting Z under condition M and X; q(S|Z, M, X) represent the posterior joint probability distribution of detecting S under condition Z, M, and X; and p(X, Z, S, M) represent the prior joint probability distribution of X, Z, S, and M. t |s t ) indicates in s t Under the condition, x was detected t The prior conditional probability distribution, p(m) t |s t ) indicates in s t Under the condition, m was detected t The prior conditional probability distribution, p(s) t |s <t , z t m t-1 ) indicates in s <t , z t m t-1Under the condition, s was detected t The prior conditional probability distribution, p(z) t |z <t m <t ) indicates that in z <t m <t Under the condition, z was detected t The prior conditional probability distribution;

[0114]

[0115]

[0116]

[0117]

[0118] In the formula, δ(z) t =z t-1 ) represents z t =z t-1 The prior probability distribution function, Indicates in d t Under the condition, z was detected t The prior conditional probability distribution Indicates in h t Under the condition, s was detected t The prior conditional probability distribution, f z-rnn (z t-1 |d t-1 ) indicates in d t-1 Under these conditions, learn z t-1 The rnn function, f s-rnn (s t-1 ||z t h t-1 )) indicates that s t-1 ,zt,h t-1 After connecting, learn s t-1 The mn function, f z-mlp (z t ) represents z t The multilayer perceptron function;

[0119] To maximize the logarithmic probability of the observed data, that is:

[0120]

[0121] Approximation using the lower limit of evidence ELBO:

[0122]

[0123] In the formula, E q(z,S,M|X)Let represent the mathematical expectation of q(Z, S, M|X), and KL() represent the KL divergence;

[0124] Using the sequential decomposition q(M|X), the boundary index M is first inferred:

[0125]

[0126] In the formula, Bernoulli distribution is represented by σ(), and activation function is represented by σ().

[0127] By reasoning from state q(Z|M,X) and q(S|Z,M,X), two abstract concepts are inferred upon the discovery of boundary structures. Where q(Z|M, X) is used to predict the state of a multivariate sub-time series. In order to use the same state within the multivariate sub-time series, the distribution q(z) is... t |M, X) is conditional on the boundary index M:

[0128]

[0129] In the formula, β(z) t =z t-1 ) for z t =z t-1 Posterior probability distribution function Extracted by a forward RNN, while Extracted by a backward RNN, the RNN depends on M to ensure β(z) t =z t-1 Independence between time series; the factor of S is and each s t From the distribution Sampling is performed to encode the observed sequence X, and updates are made at the start of a new multivariate sub-time series.

[0130] The Gaussian learning process is as follows:

[0131] Using linear and nonlinear functions to represent the causal relationships between observed variables in a multivariate sub-time series, these causal relationships can be formalized as follows:

[0132]

[0133] in Represents variable x i One set of reasons, u i It is a distractor, g i f represents the causal effects from unobserved confounding factors, which are considered to be time-smooth functions. i k Represents the k-th time series x iSteady-state causal function under the given conditions;

[0134] make Let N represent the finite dimension of the k-th multivariate sub-time series. For each sub-time series, considering time lag information, each variable x... i (t) are all generated by the following mechanisms:

[0135]

[0136] For each time-varying coefficient and confounding term, assume f j The prior is g i The prior is Where μ represents the corresponding mean in the Gaussian process, and V represents the covariance; assuming f j and g i If the prior values ​​are independent at different j and p, then w can be expressed as:

[0137] w k (t)~GP(μ(t),V(t,t))

[0138] Assume the noise is a Gaussian random variable, i.e., u i (t)~N(0,σ) 2 ), where σ 2 It is the variance of the noise; given the Gaussian process prior and Gaussian noise, the marginal likelihood of the observations can be expressed as a multivariate Gaussian distribution:

[0139]

[0140] y k =D x *{f j (t), g i (t)} T +u

[0141] Where the matrix symbol is:

[0142] u = [{u i (t)} i,t ] T

[0143]

[0144] Where I is the identity matrix, u = [{u i (t)} i,t ] T in Represents the Kronecker inner product;

[0145] The hyperparameters in the mean and covariance functions of a Gaussian process, as well as the variance σ of the noise, are learned by maximizing the marginal likelihood of the probability. 2 :

[0146]

[0147] The posterior mean Includes estimated lag coefficients and confusing items

[0148] The pseudocode of the algorithm of this invention is shown in Table 1. Specifically, lines 2-8 of the algorithm illustrate a hierarchical recursive state-space model, which is trained to infer the underlying temporal structure, thereby performing hierarchical stochastic state transitions. The first line initializes the parameters; lines 2-8 form a loop; the third line calculates the prior boundary index M; the fourth line calculates the prior according to the formula... and formula The first line of code calculates the state variables Z and S; the fifth line calculates the KL divergence of the state variables S and Z, the boundary index M, and the data reconstruction error; the sixth line updates the parameters by minimizing the loss; the seventh line updates the boundary index M. Lines 10-18 of Algorithm 1 provide a general description of time-varying causal modeling of stochastic processes to identify time-dependent causal relationships from static data. In each steady-state dataset, a Gaussian process and formula are used... The parameters are continuously updated until the causal structure of all steady-state data is learned, and the final causal structure is returned.

[0149] Table 1

[0150]

[0151] In a concrete example, the causal mechanism discovery method mentioned in Example 1 was applied to real EEG data to validate the performance of our method. The EEG data is publicly available at https: / / archive.ics.uci.edu / ml / datasets / EEG+Eye+State. This dataset was collected from a 14-channel commercial EEG headset called "Emotiv EEG Neuroheadset". According to the international 10-20 system, the headset electrodes were located in brain regions AF3, AF4, F7, F8, F3, F4, FC5, FC6, T7, T8, P7, P8, O1, and O2. All values ​​in the EEG data are arranged chronologically, with the first measurement at the top of the data. The dataset consists of 14 EEG variables and one variable representing eye state.

[0152] By reviewing relevant literature, we know that alpha waves are suppressed when the eyes are open; this is known as alpha wave suppression. In the occipital region, alpha wave suppression is strongest in response to stimuli such as light, and suppression is generally observed in various parts of the entire conduction range. The model's predictions in this embodiment accurately reflect the changes in causal coefficients within a non-stationary causal structure. Furthermore, the changing causal structure and learned causal relationships show that all regions of the entire conduction range are more easily suppressed in the open state than in the closed state, particularly the O1 and O2 regions. These results are consistent with the effects of different eye states.

[0153] Example 2

[0154] Based on Example 1, this embodiment specifically discloses the training method for training the model used to discover the causal mechanism of time-series non-stationary states in step S3, which is as follows:

[0155] S31: Initialize model parameters;

[0156] S32: Calculate the prior and posterior probabilities of each variable and boundary, and obtain the total loss function based on the prior and posterior probabilities;

[0157] S33: Calculate the gradient and update the model parameters using the gradient backpropagation algorithm;

[0158] S34: Repeat steps S32 and S33 until the change in the total loss function is less than the threshold, obtain the final boundary M, compare it with the actual non-steady-state change position, and calculate the model's recall and accuracy indices.

[0159] S35: Divide the data into multiple steady-state sub-time series datasets according to M, and calculate the causal mechanism of each sub-time series dataset using a Gaussian process.

[0160] Step S32 calculates the prior and posterior probabilities of the boundary, specifically as follows:

[0161] The prior probability distribution of boundary M is calculated as follows:

[0162]

[0163] In the formula, n(m) <t N represents the number of current multivariate sub-time series within time step t. max l(m) represents the maximum number of multivariate sub-time series. <t ) represents the length of the current multivariate sub-time series within time step t, l max Let f represent the longest length of a multivariate sub-time series, σ() be the activation function, and f m-mlp (s t ) represents st The multilayer perceptron function; in this embodiment l max =200, N max =5, μ~N(0, σ 2 ).

[0164] The posterior probability distribution of the boundary M is calculated as follows:

[0165]

[0166] The loss at boundary M is calculated as follows:

[0167]

[0168] Prior and posterior of state variable Z:

[0169]

[0170]

[0171] The loss of state variable z is calculated as follows:

[0172]

[0173] Calculate the prior and posterior of the state variable S:

[0174]

[0175]

[0176] The loss function for state variable S is calculated as follows:

[0177]

[0178] The loss calculation method for reconstructed data is as follows:

[0179] loss obs =∑ t KL(q(X|Z,S,M)||p(X)).

[0180] The total loss function in step S32 is as follows:

[0181] loss total =loss obs +(loss M +loss z +loss s ).

[0182] The causal structure output by the converged prediction model is visualized and compared with the true causal structure. The results show that our model's results are very similar to the true causal structure.

[0183] Example 3

[0184] This embodiment provides a causal mechanism discovery system based on time-series non-stationary states, such as... Figure 4 As shown, it includes:

[0185] A data acquisition and processing module is used to acquire a dataset with a known time-series non-stationary causal mechanism and process the dataset.

[0186] A model building module, which is used to build a model for discovering time-series non-stationary causal mechanisms;

[0187] The training module uses the dataset to train the model for discovering time-series non-stationary causal mechanisms, thereby obtaining a trained model for discovering time-series non-stationary causal mechanisms.

[0188] The discovery module utilizes the trained model for discovering time-series non-stationary causal mechanisms to perform causal mechanism discovery on data with unknown time-series non-stationary causal mechanisms.

[0189] The same or similar labels correspond to the same or similar parts;

[0190] The terms used to describe positional relationships in the accompanying drawings are for illustrative purposes only and should not be construed as limiting this patent.

[0191] Obviously, the above embodiments of the present invention are merely examples for clearly illustrating the present invention, and are not intended to limit the implementation of the present invention. Those skilled in the art can make other variations or modifications based on the above description. It is neither necessary nor possible to exhaustively describe all embodiments here. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the claims of the present invention.

Claims

1. A method for discovering causal mechanisms based on time-series non-stationary states, characterized in that, Includes the following steps: S1: Obtain a dataset with known temporal non-stationary causal mechanisms and process the dataset, which consists of 14 EEG variables and one variable representing eye state; S2: Construct a model for discovering temporally non-stationary causal mechanisms; S3: Use the dataset to train the model for discovering time-series non-stationary causal mechanisms to obtain a trained model for discovering time-series non-stationary causal mechanisms; S4: Use the trained model for discovering time-series non-stationary causal mechanisms to discover causal mechanisms in data with unknown time-series non-stationary causal mechanisms; The model used in step S2 to discover the temporal non-stationary causal mechanism is specifically as follows: The model for discovering time-series non-stationary causal mechanisms includes a state-space detection layer and a Gaussian learning process, wherein the input of the state-space detection layer is time-series data, and the state-space detection layer identifies the hierarchical structure in the time-series data; the Gaussian learning layer learns the stationary causal structure of the hierarchical time-series data. The state space detection layer is specifically represented as follows: q(Z,S,M|X)=q(M|X)q(Z|M,X)q(S|Z,M,X) In the formula, X is the eigenvector, X = {x t }, Z and S are the state variables, Z = {z t }, S={s t }, s <t z <t Let M represent all state variables up to t, and M be a binary random variable, M = {m t }, m <t Let represent all binary random variables before t. Let q(Z,S,M|X) represent the posterior joint probability distribution of detecting Z, S, and M under condition X; q(M|X) represent the posterior joint probability distribution of detecting M under condition X; q(Z|M,X) represent the posterior joint probability distribution of detecting Z under conditions M and X; q(S|Z,M,X) represent the posterior joint probability distribution of detecting S under conditions Z, M, and X; and p(X,Z,S,M) represent the prior joint probability distribution of X, Z, S, and M. t |s t ) indicates in s t Under the condition, x was detected t The prior conditional probability distribution, p(m) t |s t ) indicates in s t Under the condition, m was detected t The prior conditional probability distribution, p(s) t |s <t ,z t ,m t-1 ) indicates in s <t ,z t ,m t-1 Under the condition, s was detected t The prior conditional probability distribution, p(z) t |z <t ,m <t ) indicates that in z <t ,m <t Under the condition, z was detected t The prior conditional probability distribution; In the formula, δ(z) t =z t-1 ) represents z t =z t-1 The prior probability distribution function, Indicates in d t Under the condition, z was detected t The prior conditional probability distribution Indicates in h t Under the condition, s was detected t The prior conditional probability distribution, f z-rnn (z t-1 |d t-1 ) indicates in d t-1 Under these conditions, learn z t-1 The rnn function, f s-rnn (s t-1 ||z t ,h t-1 )) indicates that s t-1 ,z t ,h t-1 After connecting, learn s t-1 The rnn function, f z-mlp (z t ) represents z t The multilayer perceptron function; To maximize the logarithmic probability of the observed data, that is: Approximation using the lower limit of evidence ELBO: In the formula, E q (Z,S,M|X) represents the mathematical expectation of q(Z,S,M|X), and KL() represents the KL divergence. Using the sequential decomposition q(M|X), the boundary index M is first inferred: In the formula, Bernoulli distribution is represented by σ(), and activation function is represented by σ(). By reasoning through states q(Z|M,X) and q(S|Z,M,X), two abstract concepts are inferred upon the discovery of boundary structures. Where q(Z|M,X) is used to predict the state of a multivariate sub-time series. In order to use the same state within the multivariate sub-time series, the distribution q(z) is... t |M,X) is conditional on the boundary index M: In the formula, β(z) t =z t-1 ) for z t =z t-1 Posterior probability distribution function Extracted by a forward RNN, while Extracted by a backward RNN, the RNN depends on M to ensure β(z) t =z t-1 Independence between time series; the factor of S is and each s t From the distribution Sampling, encoding the observed sequence X, and updating it at the start of a new multivariate sub-time series; The Gaussian learning process is as follows: Using linear and nonlinear functions to represent the causal relationships between observed variables in a multivariate sub-time series, these causal relationships can be formalized as follows: in Represents variable x i One set of reasons, u i It is a distractor, g i This represents the causal effects from unobserved confounding factors, which are considered to be time-smooth functions. Represents the k-th time series x i Steady-state causal function under the given conditions; make Let N represent the finite dimension of the k-th multivariate sub-time series. For each sub-time series, considering time lag information, each variable x i (t) are all generated by the following mechanisms: For each time-varying coefficient and confounding term, assume f j The prior is g i The prior is Where μ represents the corresponding mean in the Gaussian process, and V represents the covariance; assuming f j and g i If the prior values ​​are independent at different j and p, then w can be expressed as: w k (t)~GP(μ(t),V(t,t)) Assume the noise is a Gaussian random variable, i.e., u i (t)~N(0,σ 2 ), where σ 2 It is the variance of the noise; given the Gaussian process prior and Gaussian noise, the marginal likelihood of the observations can be expressed as a multivariate Gaussian distribution: y k =D x *{f j (t),g i (t)} T +u Where the matrix symbol is: u=[{u i (t)} i,t ] T Where I is the identity matrix, u = [{u i (t)} i,t ] T in Represents the Kronecker inner product; The hyperparameters in the mean and covariance functions of a Gaussian process, as well as the variance σ of the noise, are learned by maximizing the marginal likelihood of the probability. 2 : The posterior mean Includes estimated lag coefficients and confusing items 2. The causal mechanism discovery method based on time-series non-stationary states according to claim 1, characterized in that, The temporal non-stationary causal mechanism in step S1 includes changes in the causal coefficient and changes in the causal direction.

3. The causal mechanism discovery method based on time-series non-stationary states according to claim 1, characterized in that, The processing of the dataset in step S1 specifically includes: The dataset is divided into two parts: 80% is used as the training set and the remaining portion is used as the test set.

4. The causal mechanism discovery method based on time-series non-stationary states according to claim 1, characterized in that, Step S3 involves training the model used to discover time-series non-stationary causal mechanisms, specifically as follows: S31: Initialize model parameters; S32: Calculate the prior and posterior probabilities of each variable and boundary, and obtain the total loss function based on the prior and posterior probabilities; S33: Calculate the gradient and update the model parameters using the gradient backpropagation algorithm; S34: Repeat steps S32 and S33 until the change in the total loss function is less than the threshold, obtain the final boundary M, compare it with the actual non-steady-state change position, and calculate the model's recall and accuracy indices. S35: Divide the data into multiple steady-state sub-time series datasets according to M, and calculate the causal mechanism of each sub-time series dataset using a Gaussian process.

5. The causal mechanism discovery method based on time-series non-stationary states according to claim 4, characterized in that, Step S32 calculates the prior and posterior probabilities of the boundary, specifically as follows: The prior probability distribution of boundary M is calculated as follows: In the formula, n(m) <t N represents the number of current multivariate sub-time series within time step t. max l(m) represents the maximum number of multivariate sub-time series. <t ) represents the length of the current multivariate sub-time series within time step t, l max Let f represent the longest length of a multivariate sub-time series, σ() be the activation function, and f m-mlp (s t ) represents s t The multilayer perceptron function; The posterior probability distribution of the boundary M is calculated as follows: The loss at boundary M is calculated as follows: Prior and posterior of state variable Z: The loss of state variable z is calculated as follows: Calculate the prior and posterior of the state variable S: The loss function for state variable S is calculated as follows: The loss calculation method for reconstructed data is as follows: loss obs =∑ t KL(q(X|Z,S,M)||p(X))。 6. The causal mechanism discovery method based on time-series non-stationary states according to claim 5, characterized in that, The total loss function in step S32 is as follows: loss total =loss obs +(loss M +loss z +loss s )。 7. A causal mechanism discovery system based on any one of claims 1 to 6, characterized in that, include: A data acquisition and processing module is used to acquire a dataset with a known time-series non-stationary causal mechanism and process the dataset. A model building module, which is used to build a model for discovering time-series non-stationary causal mechanisms; The training module uses the dataset to train the model for discovering time-series non-stationary causal mechanisms, thereby obtaining a trained model for discovering time-series non-stationary causal mechanisms. The discovery module utilizes the trained model for discovering time-series non-stationary causal mechanisms to perform causal mechanism discovery on data with unknown time-series non-stationary causal mechanisms.

Citation Information

Patent Citations

  • Unsteady-state Granger causality mining method for discrete time series data

    CN110633396A

  • Method and system for predicting and identifying non-stationary time series in complex network

    CN113688994A