An action-conditioned state space modeling and counterfactual reasoning method

By employing action-conditional state-space modeling and counterfactual reasoning methods, the problems of high computational complexity and insufficient causal relationship modeling in existing technologies are solved. This enables real-time processing of high-frequency physiological signals and precise evaluation of intervention effects, improving the accuracy of physiological state prediction and the practicality of clinical applications.

CN122392965APending Publication Date: 2026-07-14NANJING QICHENG MEDICAL TECHNOLOGY CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
NANJING QICHENG MEDICAL TECHNOLOGY CO LTD
Filing Date
2026-04-30
Publication Date
2026-07-14

AI Technical Summary

Technical Problem

Existing physiological signal modeling techniques have high computational complexity, which cannot meet the real-time needs of clinical practice, and cannot model the causal relationship between intervention actions and physiological states, resulting in insufficient model prediction accuracy and counterfactual reasoning ability.

Method used

We employ action-conditional state-space modeling and counterfactual inference methods, using a one-dimensional convolutional neural network and a multilayer perceptron to process multi-channel physiological waveforms and static context data. We then combine these with a selective state-space model for deep fusion to generate predictions of future physiological waveforms and clinical events, thereby quantifying the intervention effect.

Benefits of technology

It enables real-time processing of high-frequency physiological signals, preserves key pathological features, improves the model's accuracy in representing physiological states and the accuracy of counterfactual inference, meets the real-time needs of clinical practice, and provides quantitative basis for intervention decisions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122392965A_ABST
    Figure CN122392965A_ABST
Patent Text Reader

Abstract

This invention proposes a method for action-conditional state-space modeling and counterfactual inference, executed by a computer device, comprising the following steps: S1.1 Data encoding step: The computer device acquires multi-channel high-frequency physiological waveform data and patient static context data through a data acquisition interface. After standardization preprocessing, the multi-channel high-frequency physiological waveform data is sliced ​​according to a fixed time window. The sliced ​​data is mapped to a fixed-dimensional waveform feature vector through a one-dimensional convolutional neural network. After normalization preprocessing, the patient static context data is mapped to a fixed-dimensional static context vector through a multilayer perceptron. This invention uses a Mamba / SSM architecture as the backbone network, reducing the computational complexity from O(L²) of existing technologies to linear complexity O(L), enabling real-time processing of 100Hz, 8-hour single-channel high-frequency waveforms with an inference time ≤50ms, meeting clinical real-time requirements.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the interdisciplinary field of artificial intelligence and biomedical engineering, and in particular to a method for action-conditional state space modeling and counterfactual inference. Background Technology

[0002] In core clinical scenarios such as perioperative monitoring and intensive care, high-frequency physiological monitoring waveforms (such as electrocardiogram (ECG), arterial blood pressure (ABP), and photoplethysmography (PPG)) are crucial data for real-time assessment of patients' physiological status and early warning of deterioration. This data is typically acquired at frequencies of 100Hz to 250Hz, and surgeries or intensive care can last 4 to 12 hours, resulting in raw waveform sequences of 144,000 to 216,000 data points per patient per channel. Existing physiological signal prediction and modeling technologies have significant shortcomings, and the clinical risks arising from these shortcomings are clearly defined, as follows: Mainstream physiological signal modeling architectures (such as Transformer and Recurrent Neural Networks, RNNs) all suffer from a mismatch between computational complexity and sequence length. The Transformer architecture, based on a self-attention mechanism, exhibits computational complexity that increases quadratically with sequence length L (O(L²)). When processing hour-level 100Hz high-frequency raw waveforms, the single-channel sequence length L can reach 10^6 ... 5 The computational load would increase exponentially, and existing routine clinical computer equipment (such as an Intel Core i7-12700H CPU and 16GB of memory) could not complete a single inference within 100ms, failing to meet the real-time requirements of clinical practice. To circumvent the computational bottleneck, existing technologies generally employ downsampling, downsampling the original 100Hz waveform to low-frequency trend data of 1Hz to 10Hz. This process loses key microscopic pathological features such as ST segment shift in ECG, pulse pressure fluctuations in ABP, and waveform peak details in PPG, causing the model to be unable to capture early signs of disease deterioration (such as postoperative latent hypotension and arrhythmia precursors).

[0003] Existing physiological signal prediction models are mostly discriminative models (such as logistic regression and CNN-LSTM hybrid models). Their core logic is "fitting future trends based on historical physiological data," which can only predict "what is happening" and cannot model the causal relationship between clinical interventions (such as drug injection, mechanical ventilation parameter adjustment, and fluid resuscitation) and changes in physiological state. Specifically, existing models cannot answer counterfactual questions such as "If 5mg of ephedrine is injected at this time, how much will the patient's blood pressure rise after 5 minutes?" or "If mechanical ventilation is not adjusted, how much will the patient's blood oxygen saturation drop after 10 minutes?" They cannot provide clinicians with quantitative assessments of intervention effects, leading to intervention decisions relying on physician experience and posing a risk of misjudgment.

[0004] Physiological data in clinical settings exhibit typical multimodal heterogeneity, which can be categorized into four types: ① High-frequency continuous waveform data (ECG, ABP, PPG, sampling rate 100Hz–250Hz, continuous acquisition); ② Low-frequency discrete measurement data (body temperature, blood glucose, complete blood count, sampling rate 0.01Hz–0.1Hz, timed measurement); ③ Sparse intervention event data (drug administration time, dosage, ventilation adjustment parameters, non-continuous, triggered by clinical decisions); ④ Static baseline data (patient age, gender, height, weight, comorbidities, surgical type, fixed and unchanging). Existing technologies often process this type of data by simply stitching together multi-branch independent modeling, failing to achieve deep fusion of heterogeneous data within a unified latent space. This results in incomplete model representation of physiological states, significantly reducing prediction accuracy and inference reliability. Summary of the Invention

[0005] The technical problem to be solved by this invention is to overcome the defects of the existing technology. This invention proposes a method for action-conditional state space modeling and counterfactual deduction.

[0006] To solve the aforementioned technical problems, the technical solution adopted by the present invention is as follows: A method for action-conditional state-space modeling and counterfactual inference, the method being executed by a computer device, includes the following steps: S1.1 The computer device acquires multi-channel high-frequency physiological waveform data and patient static context data through a data acquisition interface. After standardizing and preprocessing the multi-channel high-frequency physiological waveform data, it performs slice processing according to a fixed time window. The slice data is mapped into a fixed-dimensional waveform feature vector through a one-dimensional convolutional neural network. After normalizing and preprocessing the patient static context data, it is mapped into a fixed-dimensional static context vector through a multilayer perceptron. The static context vector is concatenated to the head of the waveform feature vector sequence to obtain the initial encoding sequence. S1.2 The computer device acquires clinical intervention action data, constructs a pre-trained drug attribute matrix, and maps the clinical intervention action data into action feature vectors containing pharmacological features; based on the timestamp of the clinical intervention action, the action feature vectors are deeply fused with the waveform feature vectors at the corresponding time positions in the initial encoding sequence to generate a mixed input sequence containing action information; S1.3 The computer device inputs the mixed input sequence into the stacked selective state space model layer, and performs iterative updates of the hidden states based on the discrete state space equation to obtain the evolved hidden state sequence; the number of stacked selective state space model layers is 2 to 8, and the hidden state dimension of each layer is 512 to 2048. The S1.4 computer device performs multi-head decoding on the evolved hidden state sequence, outputs the predicted future physiological waveform data through the waveform reconstruction head, and outputs the prediction results of possible discrete clinical events through the clinical event prediction head. The S1.5 computer device extrapolates path bifurcation based on the hidden state at the current moment, inputs empty action sequence and target intervention action sequence into the selective state space model layer respectively, generates baseline physiological sequence without intervention and physiological sequence under intervention, calculates the difference between the two sets of sequences, and completes the quantitative evaluation of the intervention effect.

[0007] Preferably, in step S1.1, the multi-channel high-frequency physiological waveform data is at least one of ECG, ABP, and PPG, with a sampling rate of 100Hz to 250Hz; the standardization preprocessing specifically involves: using the Z-score standardization method to map the waveform data to the [0,1] interval to eliminate the influence of dimensions; fixing the time window to 80ms to 120ms, preferably 100ms, and the overlap rate of adjacent slices during slice processing to 20% to 30%; the structure of the one-dimensional convolutional neural network is as follows: the number of input channels is consistent with the number of physiological waveform channels, the kernel size is 3 to 7, the stride is 1, the number of kernels is 64 to 256, the activation function is ReLU, and the dimension of the output waveform feature vector is 256 to 1024.

[0008] Preferably, in step S1.1, the patient static context data includes the patient's age, gender, height, weight, comorbidities, and surgical type; the normalization preprocessing specifically involves mapping numerical data to the [0,1] interval using the Min-Max normalization method, and processing categorical data using the one-hot encoding method; the structure of the multilayer perceptron is as follows: the input layer dimension is consistent with the number of features in the static context data, the hidden layers are 2 to 3 layers, the number of neurons in each layer is 64 to 256, the activation function is ReLU, and the output static context vector dimension is consistent with the waveform feature vector dimension.

[0009] Preferably, in step S1.2, the clinical intervention action data includes at least one of drug injection, mechanical ventilation parameter adjustment, and fluid resuscitation, specifically including action type, action occurrence timestamp, and action parameters; the pre-trained drug attribute matrix has a dimension of N×M, where N is the total number of commonly used clinical intervention drugs / operations, and M is the pharmacological feature dimension, M=8~16, and the pharmacological features include receptor affinity, onset time, half-life, target of action, and dose-response relationship; the dimension of the action feature vector is consistent with the dimension of the waveform feature vector, and the fusion method is splicing or cross-attention fusion, with the number of attention heads in cross-attention fusion being 4~8 heads.

[0010] Preferably, in step S1.3, the discrete state-space equation is: in, The hidden state at time t has dimensions of 512 to 2048, representing the patient's complete physiological state at time t; The hidden state at time t-1; , , The learnable parameter matrix for the selective SSM layer. It is the hidden state transition matrix with dimension D×D (D is the hidden state dimension). C is the input projection matrix with dimensions D×K (K is the dimension of the mixed input sequence), and C is the output projection matrix with dimensions E×D (E is the output feature dimension). The mixed input sequence data at time t has a dimension of K; Let E be the output feature at time t; the selectivity mechanism of the selective SSM layer is implemented through a gating unit, and the calculation formula for the gating unit is: ,in It is the Sigmoid activation function. For the gated weight matrix, For gating bias terms, is the gating coefficient, used to regulate the absorption intensity of intervention information, and its value ranges from [0,1].

[0011] Preferably, in step S1.3, the selective state-space model layer is any one of the Mamba architecture, S4 architecture, LinearTransformer, or RWKV, with the Mamba architecture being preferred. The expansion factor of the Mamba architecture is 2 to 4, and the temporal mixing window size is 64 to 128.

[0012] Preferably, in step S1.4, the waveform reconstruction head is composed of a 1D transposed convolutional layer and a linear layer. The kernel size of the 1D transposed convolutional layer is 3 to 7, the stride is 1, and the number of output channels is consistent with the number of physiological waveform channels. The output dimension of the linear layer is consistent with the length of the waveform slice, and it is used to map the hidden state sequence into continuous physiological waveform data. The clinical event prediction head is composed of a fully connected layer and a Softmax classifier. The number of neurons in the fully connected layer is 128 to 256, the activation function is ReLU, and the Softmax classifier is used to output the prediction probability of discrete clinical events such as hypotension and arrhythmia, with a prediction probability threshold of 0.5 to 0.7.

[0013] Preferably, in step S1.5, the specific process of the deduced path bifurcation is as follows: S8.1 Input the patient's historical physiological data for past time intervals (T = 30 min to 60 min) into the computer device. Through the processing steps 1.1 to 1.3, calculate the latent state at the current moment. ; S8.2 Input an empty action sequence into the selective state-space model layer. The length of the empty action sequence is consistent with the prediction duration, which is 5 min to 30 min. Through state-space evolution and multi-head decoding, generate an uninterrupted natural evolutionary physiological sequence. ; S8.3 Input the target intervention action sequence into the selective state-space model layer. The target intervention action sequence includes action type, action occurrence time, and action parameters. Through state-space evolution and multi-head decoding, generate the physiological evolution sequence affected by the intervention. ; S8.4 Calculation and The difference between The mean and variance of the difference are used as quantitative indicators of the intervention effect. A positive mean indicates that the intervention has a positive effect, a negative mean indicates that the intervention has a negative effect, and the variance indicates the stability of the intervention effect.

[0014] Preferably, the method further includes a model system training step: a computer device acquires a training set consisting of clinical physiological data and intervention action data, the training set containing clinical data of at least 1000 patients, with each patient's data duration ≥ 4 hours; mean squared error is used as the loss function for waveform generation, cross-entropy loss function is used as the loss function for clinical event prediction, the Adam optimizer is used for model system training, the learning rate is 1e-4 to 1e-3, the number of iterations is 100 to 300 rounds, the batch size is 32 to 64, and an early stopping strategy is adopted during training, stopping training when the validation set loss does not decrease for 10 consecutive rounds.

[0015] Compared with the prior art, the beneficial effects of the present invention are: This invention employs the Mamba / SSM architecture as the backbone network, reducing the computational complexity from O(L²) in existing technologies to linear complexity O(L). With the aforementioned computer equipment configuration, it can achieve real-time processing of a single-channel high-frequency waveform (approximately 288,000 data points) at 100Hz for 8 hours, with an inference time ≤50ms, meeting clinical real-time requirements. Simultaneously, it eliminates the need for downsampling of the original waveform, fully preserving microscopic pathological features such as ST segment shift in ECG and pulse pressure fluctuations in ABP. The model's accuracy in representing physiological states is improved by more than 30% (using MAE as the evaluation index, it is reduced from 0.85 in existing technologies to below 0.59).

[0016] This invention, through a specially designed action fusion module, transforms clinical intervention actions into control vectors that can be integrated into the state transition process, establishing a clear causal mapping from intervention actions to physiological responses. It can accurately simulate the impact of different intervention actions on physiological states, overcoming the limitation of existing models that cannot perform counterfactual inference. The quantitative error of counterfactual inference is ≤5% (calculated as the ratio of the predicted difference to the actual difference of core physiological indicators such as blood pressure and heart rate), which can effectively provide quantitative basis for clinical intervention decisions.

[0017] This invention achieves deep fusion of high-frequency waveforms, low-frequency discrete data, sparse intervention actions, and static baseline data within a single latent space through a unified encoding and fusion mechanism, avoiding the representation fragmentation problem caused by multi-branch splicing in existing technologies. After multimodal data fusion, the model's prediction accuracy for clinical events (such as hypotension and arrhythmia) is improved to over 92%, which is more than 15% higher than existing technologies.

[0018] The method of this invention can be directly deployed on existing clinical monitoring equipment, medical edge computing servers, or cloud platforms without requiring large-scale modifications to existing hardware; only the appropriate software environment needs to be adapted. It also provides clear parameter ranges, formula details, and implementation steps, allowing those skilled in the art to quickly reproduce the method based on the description, facilitating its clinical application. Attached Figure Description

[0019] The disclosure of this invention is illustrated with reference to the accompanying drawings. It should be understood that the drawings are for illustrative purposes only and are not intended to limit the scope of protection of this invention. In the drawings, the same reference numerals are used to refer to the same parts. Wherein: Figure 1 The overall flowchart for training the model system of this invention is as follows: (from sensor data acquisition -> encoding -> SSM processing -> waveform generation).

[0020] Figure 2 This is a schematic diagram of the internal structure of the Mamba block of the present invention; (in particular, it shows how the "action vector" is injected into the SSM state transition process).

[0021] Figure 3 This is a counterfactual deduction diagram of the present invention; (showing two tracks that branch out at a point in time, one solid line (no intervention) and one dashed line (with intervention)).

[0022] Figure 4 The flowchart illustrates the steps of the action-conditional state space modeling and counterfactual deduction method of the present invention. Detailed Implementation

[0023] The present invention will be further described in detail below with reference to specific embodiments and accompanying drawings. In this embodiment, a computer device is used as the execution subject, and the Mamba architecture is used as the selective SSM layer to adapt to the perioperative monitoring scenario. It processes high-frequency physiological waveforms of ECG and ABP dual channels to realize the counterfactual inference of ephedrine injection. Those skilled in the art can replace the backbone network and adjust the parameters according to the description of this embodiment to realize the application in other scenarios, all of which are within the protection scope of the present invention.

[0024] Please see Figures 1-4 I. Computer Equipment Configuration In this embodiment, the computer device for executing the method of the present invention is specifically configured as follows: Hardware configuration: Intel Core i7-12700H processor (14 cores, 20 threads, base frequency 2.7GHz, turbo frequency 4.7GHz), 32GB memory (DDR5 4800MHz), 1TB SSD storage, NVIDIA RTX 3060 graphics card (6GB GDDR6), supporting CUDA 11.6; data acquisition interfaces include USB 3.0 interface, Ethernet interface and HL7 protocol medical-grade interface, which can be connected to Philips IntelliVue MX800 monitor to obtain ECG and ABP dual-channel waveform data, and connected to the hospital's electronic medical record system to obtain patient static context data and clinical intervention action data.

[0025] Software configuration: Operating system is Windows 11 Professional Edition, Python version 3.9, PyTorch version 1.12.1, numpy version 1.24.3, pandas version 1.5.3, matplotlib version 3.7.1, and mamba-ssm version 0.4.0 for Mamba model deployment.

[0026] II. Model System Training Steps The computer equipment first completes the training of the model system, and then performs physiological signal generation and counterfactual inference. The specific training steps are as follows: Training set preparation: Clinical data from 1200 perioperative patients were acquired, with each patient's data duration ≥6 hours, including: ① ECG (100Hz sampling rate) and ABP (100Hz sampling rate) dual-channel high-frequency waveform data; ② Patient static context data (age, gender, height, weight, history of hypertension, history of diabetes, type of surgery); ③ Clinical intervention data (mainly injection time and dosage of vasoactive drugs such as ephedrine and norepinephrine). All data were cleaned, and outliers (such as waveform missing rate ≥10% or incomplete intervention record data) were removed, resulting in 1000 valid training data points, which were divided into a training set (800 cases) and a validation set (200 cases) in an 8:2 ratio.

[0027] Data preprocessing: (1) High-frequency waveform data preprocessing: The ECG and ABP waveform data are standardized using the Z-score standardization method, and the formula is as follows: ,in The mean of the waveform data. The standard deviation of the waveform data is used to map the standardized waveform data to the [0,1] interval; (2) Static context data preprocessing: For numerical data such as age, height, and weight, the Min-Max normalization method is used, and the formula is as follows: Mapped to the [0,1] interval; for categorical data such as gender, surgical type, and comorbidities, one-hot encoding is used to process them to obtain binary feature vectors; (3) Intervention action data preprocessing: Construct a pre-trained drug attribute matrix with a dimension of 50×12 (50 is the total number of commonly used vasoactive drugs in clinical practice, and 12 is the pharmacological feature dimension). The pharmacological features include receptor affinity, onset time, half-life, target of action, dose-response relationship, etc. Each type of intervention action (such as injection of 5mg ephedrine) is mapped to a 1024-dimensional action feature vector.

[0028] Model building: (1) Data encoding module: The 1D-CNN structure is: number of input channels = 2 (ECG and ABP dual channels), kernel size = 5, stride = 1, number of kernels = 128, activation function = ReLU, output waveform feature vector dimension = 1024; The MLP structure is: input layer dimension = 15 (number of features after preprocessing of static context data), 2 hidden layers (256 neurons and 128 neurons), activation function = ReLU, output static context vector dimension = 1024; (2) Action fusion module: The cross-attention fusion method is adopted, with 6 attention heads. The 1024-dimensional action feature vector is fused with the 1024-dimensional waveform feature vector at the corresponding time position to obtain a 2048-dimensional mixed input. ; (3) State space evolution module: A stacked Mamba layer is used, with 4 stacked layers, 1024 hidden state dimensions per layer, 3 expansion factor, and 64 time mixing window size; Discrete state space equation parameter initialization: Matrix A is initialized with a random normal distribution (mean = 0, variance = 0.01), and matrices B and C are initialized with a Xavier uniform distribution; gated unit parameters... , Use zero initialization; (4) Multi-head decoding module: The waveform reconstruction head consists of two 1D transposed convolutional layers (convolutional kernel size = 5, stride = 1, number of output channels = 2) and one linear layer, which outputs a predicted waveform with the same length as the original waveform slice; the clinical event prediction head consists of one 256-neuron fully connected layer (activation function = ReLU) and a Softmax classifier, which outputs the predicted probabilities of two clinical events, hypotension and arrhythmia, with a prediction probability threshold of 0.6.

[0029] Model training: A joint loss function is used, and the loss function is... ,in The mean square error loss for waveform generation. Cross-entropy loss for predicting clinical events. , The Adam optimizer was used with a learning rate of 5e-4, 200 iterations, and a batch size of 64. An early stopping strategy was adopted during training, and training was stopped when the validation set loss did not decrease for 10 consecutive iterations. The final trained model was obtained with a waveform generation MAE of 0.52 on the validation set and a clinical event prediction accuracy of 93.5%.

[0030] III. Specific Implementation Steps for Physiological Signal Generation and Counterfactual Inference After training, the computer equipment performs the following steps to realize a counterfactual deduction of the generation of physiological signals in perioperative patients and the effect of ephedrine intervention: Step 1: Data Encoding Processing 1.1 The computer device is connected to the Philips IntelliVue MX800 monitor via the HL7 protocol interface to collect real-time ECG and ABP dual-channel high-frequency waveform data (sampling rate 100Hz) of a perioperative patient. At the same time, the static context data of the patient is obtained through the electronic medical record system: age 58 years, gender male, height 175cm, weight 75kg, history of hypertension, and undergoing laparoscopic cholecystectomy. 1.2 The computer equipment performs Z-score normalization on the ECG and ABP waveform data, slices them into fixed time windows of 100ms, with an overlap rate of 25% between adjacent slices, and each slice contains 10 data points (100Hz × 0.1s = 10 points); the sliced ​​waveform data is then input into a 1D-CNN, which outputs a 1024-dimensional waveform feature vector. This forms a waveform feature sequence; 1.3 The computer equipment preprocesses the patient's static context data: age, height, and weight are mapped to the [0,1] interval using Min-Max normalization, while gender, history of hypertension, and surgical type are processed using one-hot encoding, resulting in 15-dimensional preprocessed data; this data is input into the MLP, which outputs a 1024-dimensional static context vector. ; 1.4 Computer equipment will spliced ​​to The initial encoded sequence is obtained from the head of the sequence. The sequence length is (acquisition duration × 100Hz) ÷ (100ms × (1-25%)) + 1. If the acquisition duration is 30min (1800s), then the sequence length is (1800 × 100) ÷ (0.1 × 0.75) + 1 = 240000 + 1 = 240001.

[0031] Step 2: Motion fusion processing 2.1 The computer device obtains the patient's clinical intervention requirements: It is proposed to inject 5mg of ephedrine at the current time (30 minutes after data collection), and the timestamp of the action is 1800s; 2.2 The computer device calls the pre-trained drug attribute matrix to map the intervention action of "injecting 5mg of ephedrine" into a 1024-dimensional action feature vector. The vector contains pharmacological characteristics of ephedrine, including receptor affinity (0.85), onset time (1 min), and half-life (30 min). 2.3 The computer device locates the waveform feature vector at the corresponding time position in the initial encoded sequence based on the action timestamp (1800s) (the waveform slice corresponding to 1800s is the 240,000th vector), and uses a cross-attention fusion method to... By fusing with the waveform feature vector, a 2048-dimensional hybrid input is obtained. No intervention was performed at other times and locations; mixed input. The corresponding waveform feature vector and zero vector are concatenated to form a complete mixed input sequence.

[0032] Step 3: State-space evolution processing 3.1 The computer device inputs a mixed input sequence into a stacked 4-layer Mamba layer and performs iterative updates of the hidden state based on the discrete state-space equations, as follows: in, Let t be the hidden state (1024-dimensional). This is the hidden state at time t-1. The hidden state transition matrix is ​​1024×1024. The input projection matrix is ​​1024×2048. The output projection matrix is ​​1024×1024. The input is a mixed input (2048 dimensions) at time t. Output the features (1024 dimensions) at time t. The gating coefficient (range [0,1]) is used to regulate the absorption intensity of ephedrine intervention information. In this embodiment, the intervention action corresponds to... No intervention action corresponding to ; 3.2 The computer device completes the linear complexity evolution of the mixed input sequence through iterative processing of 4 Mamba layers, obtaining the global hidden state sequence. The inference time of the evolution process is 42ms, meeting the real-time requirements of clinical practice. The hidden state at the current time (1800s) is... This indicates the patient's current complete physiological state (e.g., heart rate 82 beats / min, systolic blood pressure 115 mmHg, diastolic blood pressure 75 mmHg).

[0033] Step 4: Multi-head decoding processing 4.1 The computer device inputs the evolved hidden state sequence into the waveform reconstruction head, upsamples the hidden state sequence through a 1D transposed convolutional layer, restores it to the predicted waveform data with the same sampling rate as the original waveform, and outputs the ECG and ABP dual-channel predicted waveforms for the next 30 minutes (1800s). 4.2 The computer device inputs the evolved hidden state sequence into the clinical event prediction head, and outputs the prediction probability of hypotension (systolic blood pressure <90 mmHg) and arrhythmia within the next 30 minutes through a fully connected layer and a Softmax classifier. In this embodiment, the prediction probability of hypotension without intervention is 0.32 and the prediction probability of arrhythmia is 0.15.

[0034] Step 5: Counterfactual reasoning 5.1 State Initialization: The computer device is initialized with the hidden state at the current time (1800s). As the initial state for the simulation, the simulation duration is set at 30 minutes. 5.2 Baseline Path Generation: The computer device inputs an empty action sequence (length = 30 min × 100 Hz ÷ 10 = 30000, each action vector is a zero vector) into the Mamba layer. Through state-space evolution and multi-head decoding, a natural evolutionary physiological sequence under no-intervention conditions is generated. The sequence contains ECG and ABP waveforms and clinical event predictions for the next 30 minutes. The probability of hypotension is 0.32. The predicted systolic blood pressure is 112 mmHg at 10 minutes, 108 mmHg at 20 minutes, and 105 mmHg at 30 minutes. 5.3 Intervention Path Generation: The computer device inputs the target intervention action sequence (action type: "inject 5mg ephedrine", action timestamp: 1800s, action vector: ...) into the Mamba layer. (The remaining time is a zero vector), through state-space evolution and multi-head decoding, a physiological evolution sequence affected by the intervention is generated. Among them, the predicted probability of low blood pressure was 0.08, the predicted systolic blood pressure was 125 mmHg at 10 min, 120 mmHg at 20 min, and 118 mmHg at 30 min. 5.4 Quantitative Assessment: Computer Equipment Calculation and The difference The intervention effect was quantitatively measured as follows: systolic blood pressure increased by 13 mmHg at 10 minutes, 12 mmHg at 20 minutes, and 13 mmHg at 30 minutes, with a mean difference of 12.7 mmHg and a variance of 0.34. This indicates that 5 mg of ephedrine can effectively increase the patient's systolic blood pressure, and the intervention effect is positive and stable, providing a quantitative basis for clinicians' intervention decisions.

[0035] IV. Alternative Examples To prevent competitors from circumventing patent protection, the present invention provides the following alternative embodiments, all of which achieve the same technical effect: 1. Backbone network replacement: Replace the Mamba architecture with the S4 architecture. The S4 architecture has a state dimension of 1024, a dilation factor of 4, a convolution kernel size of 3, and other parameters are the same as in this embodiment. The model inference time is ≤50ms, the waveform generation MAE is ≤0.55, and the clinical event prediction accuracy is ≥92%. 2. Action fusion method replacement: The cross-attention fusion is replaced by a hypernetwork to generate SSM parameters. The input of the hypernetwork is the action feature vector, and the output is the A, B, and C parameters of the Mamba layer, which realizes the injection of action information. The intervention effect quantification error is ≤5%. 3. Time window replacement: Replace the 100ms waveform slice time window with 80ms or 120ms, and adjust the overlap rate to 20% or 30%. The real-time performance and prediction accuracy of the model are not significantly reduced. 4. Decoding method replacement: The 1D transposed convolutional layer of the waveform reconstruction head is replaced with a combination of interpolation upsampling and linear layers, and the Softmax classifier of the clinical event prediction head is replaced with a Sigmoid classifier. The prediction effect is consistent with that of this embodiment.

[0036] The technical scope of this invention is not limited to the content described above. Those skilled in the art can make various modifications and variations to the above embodiments without departing from the technical concept of this invention, and all such modifications and variations should fall within the protection scope of this invention.

Claims

1. A method for action-conditional state-space modeling and counterfactual deduction, characterized in that, The method is executed by a computer device and includes the following steps: S1.1 The computer device acquires multi-channel high-frequency physiological waveform data and patient static context data through a data acquisition interface. After standardizing and preprocessing the multi-channel high-frequency physiological waveform data, it performs slice processing according to a fixed time window. The slice data is mapped into a fixed-dimensional waveform feature vector through a one-dimensional convolutional neural network. After normalizing and preprocessing the patient static context data, it is mapped into a fixed-dimensional static context vector through a multilayer perceptron. The static context vector is concatenated to the head of the waveform feature vector sequence to obtain the initial encoding sequence. S1.2 The computer device acquires clinical intervention action data, constructs a pre-trained drug attribute matrix, and maps the clinical intervention action data into action feature vectors containing pharmacological features; based on the timestamp of the clinical intervention action, the action feature vectors are deeply fused with the waveform feature vectors at the corresponding time positions in the initial encoding sequence to generate a mixed input sequence containing action information; S1.3 The computer device inputs the mixed input sequence into the stacked selective state space model layer, and performs iterative updates of the hidden states based on the discrete state space equation to obtain the evolved hidden state sequence; the number of stacked selective state space model layers is 2 to 8, and the hidden state dimension of each layer is 512 to 2048. The S1.4 computer device performs multi-head decoding on the evolved hidden state sequence, outputs the predicted future physiological waveform data through the waveform reconstruction head, and outputs the prediction results of possible discrete clinical events through the clinical event prediction head. The S1.5 computer device extrapolates path bifurcation based on the hidden state at the current moment, inputs empty action sequence and target intervention action sequence into the selective state space model layer respectively, generates baseline physiological sequence without intervention and physiological sequence under intervention, calculates the difference between the two sets of sequences, and completes the quantitative evaluation of the intervention effect.

2. The method for action-conditional state-space modeling and counterfactual deduction according to claim 1, characterized in that, In step S1.1, the multi-channel high-frequency physiological waveform data is at least one of ECG, ABP, and PPG, with a sampling rate of 100Hz to 250Hz; the standardization preprocessing specifically involves: using the Z-score standardization method to map the waveform data to the [0,1] interval to eliminate the influence of dimensions; fixing the time window to 80ms to 120ms, preferably 100ms, and the overlap rate of adjacent slices during slice processing to 20% to 30%; the structure of the one-dimensional convolutional neural network is as follows: the number of input channels is consistent with the number of physiological waveform channels, the kernel size is 3 to 7, the stride is 1, the number of kernels is 64 to 256, the activation function is ReLU, and the dimension of the output waveform feature vector is 256 to 1024.

3. The method for action-conditional state-space modeling and counterfactual deduction according to claim 1, characterized in that, In step S1.1, the patient static context data includes the patient's age, gender, height, weight, comorbidities, and type of surgery; The normalization preprocessing is as follows: numerical data is mapped to the [0,1] interval using the Min-Max normalization method, and categorical data is processed using the one-hot encoding method; the structure of the multilayer perceptron is as follows: the input layer dimension is consistent with the number of features of the static context data, the hidden layer has 2 to 3 layers, the number of neurons in each layer is 64 to 256, the activation function is ReLU, and the output static context vector dimension is consistent with the waveform feature vector dimension.

4. The method for action-conditional state-space modeling and counterfactual deduction according to claim 1, characterized in that, In step S1.2, the clinical intervention action data includes at least one of drug injection, mechanical ventilation parameter adjustment, and fluid resuscitation, specifically including action type, action occurrence timestamp, and action parameters; the pre-trained drug attribute matrix has a dimension of N×M, where N is the total number of commonly used clinical intervention drugs / operations, and M is the pharmacological feature dimension, M=8~16, and the pharmacological features include receptor affinity, onset time, half-life, target of action, and dose-response relationship; the dimension of the action feature vector is consistent with the dimension of the waveform feature vector, and the fusion method is splicing or cross-attention fusion, with 4~8 attention heads in cross-attention fusion.

5. The method for action-conditional state-space modeling and counterfactual deduction according to claim 1, characterized in that, In step S1.3, the discrete state-space equation is: in, The hidden state at time t has dimensions of 512 to 2048, representing the patient's complete physiological state at time t; The hidden state at time t-1; , , The learnable parameter matrix for the selective SSM layer. It is the hidden state transition matrix with dimension D×D (D is the hidden state dimension). C is the input projection matrix with dimensions D×K (K is the dimension of the mixed input sequence), and C is the output projection matrix with dimensions E×D (E is the output feature dimension). The mixed input sequence data at time t has a dimension of K; Let E be the output feature at time t; the selectivity mechanism of the selective SSM layer is implemented through a gating unit, and the calculation formula for the gating unit is: ,in It is the Sigmoid activation function. For the gated weight matrix, For gating bias terms, is the gating coefficient, used to regulate the absorption intensity of intervention information, and its value ranges from [0,1].

6. The method for action-conditional state-space modeling and counterfactual deduction according to claim 1, characterized in that, In step S1.3, the selective state-space model layer is any one of the Mamba architecture, S4 architecture, LinearTransformer, or RWKV, with the Mamba architecture being preferred. The expansion factor of the Mamba architecture is 2 to 4, and the temporal mixing window size is 64 to 128.

7. The method for action-conditional state-space modeling and counterfactual deduction according to claim 1, characterized in that, In step S1.4, the waveform reconstruction head is structured as follows: it consists of a 1D transposed convolutional layer and a linear layer. The kernel size of the 1D transposed convolutional layer is 3 to 7, the stride is 1, and the number of output channels is consistent with the number of physiological waveform channels. The output dimension of the linear layer is consistent with the length of the waveform slice, and it is used to map the hidden state sequence into continuous physiological waveform data. The clinical event prediction head is structured as follows: it consists of a fully connected layer and a Softmax classifier. The number of neurons in the fully connected layer is 128 to 256, the activation function is ReLU, and the Softmax classifier is used to output the prediction probability of discrete clinical events such as hypotension and arrhythmia, with a prediction probability threshold of 0.5 to 0.

7.

8. The method for action-conditional state-space modeling and counterfactual deduction according to claim 1, characterized in that, In step S1.5, the specific process of the deduced path bifurcation is as follows: S8.1 Input the patient's historical physiological data for past time intervals (T = 30 min to 60 min) into the computer device. Through the processing steps 1.1 to 1.3, calculate the latent state at the current moment. ; S8.2 Input an empty action sequence into the selective state-space model layer. The length of the empty action sequence is consistent with the prediction duration, which is 5 min to 30 min. Through state-space evolution and multi-head decoding, generate an uninterrupted natural evolutionary physiological sequence. ; S8.3 Input the target intervention action sequence into the selective state-space model layer. The target intervention action sequence includes action type, action occurrence time, and action parameters. Through state-space evolution and multi-head decoding, generate the physiological evolution sequence affected by the intervention. ; S8.4 Calculation and The difference between The mean and variance of the difference are used as quantitative indicators of the intervention effect. A positive mean indicates that the intervention has a positive effect, a negative mean indicates that the intervention has a negative effect, and the variance indicates the stability of the intervention effect.

9. The method for action-conditional state-space modeling and counterfactual deduction according to claim 1, characterized in that, The method further includes a model system training step: a computer device acquires a training set consisting of clinical physiological data and intervention action data, the training set containing clinical data of at least 1000 patients, with each patient's data duration ≥4 hours; mean squared error is used as the loss function for waveform generation, cross-entropy loss function is used as the loss function for clinical event prediction, and the Adam optimizer is used for model system training, with a learning rate of 1e-4 to 1e-3, 100 to 300 iterations, and a batch size of 32 to 64; an early stopping strategy is adopted during training, and training is stopped when the validation set loss does not decrease for 10 consecutive iterations.