MCI follow-up visit prediction method for community old people
Through the improved Transformer architecture, the problem of mixed data types and timing correlation is solved, efficient and interpretable prediction of MCI in the elderly population in the community is achieved, prediction accuracy and computing efficiency are improved, and visual prediction results and characteristic contribution analysis are provided.
Patent Information
- Application Number
- CN202510424084.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-07
- Publication Date
- 2025-07-18
AI Technical Summary
The prior art is difficult to effectively process MCI predictions of mixed data types, especially in high-dimensional and time-series data, and is computationally inefficient, making it impossible to accurately predict early diagnosis of Alzheimer's disease.
Using the improved Transformer architecture, efficient processing of mixed data types and longitudinal timing correlation analysis are achieved through data preprocessing, hybrid data embedding, multi-head self-attention mechanism and adversarial robustness training, combined with interpretability visual output.
It realizes efficient and interpretable prediction of MCI in the elderly population in the community, improves prediction accuracy and computing efficiency, can process large amounts of data in a short time, and provides visual prediction results and characteristic contribution analysis.
Smart Images

Figure CN120340901A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of mild cognitive impairment (MCI) prediction, and particularly relates to an MCI follow-up prediction method for the elderly in the community. Background Art
[0002] The early diagnosis of Alzheimer's disease (AD) relies on the accurate prediction of MCI. Currently, it depends on traditional cognitive scales (such as MoCA) and demographic analysis, but there are problems of strong subjectivity and low data dimension. The China Health and Retirement Longitudinal Study (CHARLS) provides multi-dimensional health data, but existing models (such as support vector machine SVM, decision tree) are difficult to handle its mixed data types (continuous physiological indicators + categorical questionnaire data).
[0003] Existing mainstream prediction methods include:
[0004] SVM: Based on kernel function mapping of high-dimensional features (Zhao et al., Int J Epidemiol 2014), but the accuracy drops below 75% in high-dimensional data such as data above 100 dimensions.
[0005] XGBoost: An ensemble tree model for feature importance ranking (Song et al., J Affect Disord 2025), but it cannot model temporal dynamics.
[0006] Traditional Transformer: Commonly applied in fields such as natural language processing (Vaswani et al., NeurIPS 2017), currently widely used in large language models, generative artificial intelligence, and translation fields, but not adapted to medical mixed data and requires customized improvement.
[0007] Existing prediction methods have the following limitations:
[0008] 1. Limitation of data type: The embedding layer of traditional models only supports integer encoding and cannot directly process floating-point physiological indicators such as blood glucose index.
[0009] 2. Lack of long-range dependence: Tree models (such as XGBoost) and fully connected networks cannot capture the temporal correlations within the 4-year cycle of CHARLS follow-up data.
[0010] 3. Low computational efficiency: Existing deep learning models take more than 200 hours to train with a sample size of 10,000 (Li et al., Chem Eng J 2024). Summary of the Invention
[0011] The present invention discloses an MCI follow-up prediction method for the elderly population in the community. The goal is to provide an efficient, interpretable, and mixed-data-type-supported MCI prediction system. Through an improved Transformer architecture, early cognitive impairment screening for the elderly in the community is realized, so as to have strong generalization ability and application prospects for longitudinal and multi-dimensional data.
[0012] To achieve the above object, the technical solution of the present invention is as follows:
[0013] An MCI follow-up prediction method for the elderly population in the community includes the following steps:
[0014] Step 1, input of original data: Receive the original CHARLS data, where the CHARLS data includes 16-dimensional continuous-type indicators and 148-dimensional categorical questionnaire data;
[0015] Step 2, data preprocessing: For the input data, complete missing value filling, time series alignment, and feature standardization, and output a normalized 3-dimensional time series data matrix (patient × time point × feature);
[0016] Step 3, embedding and splicing: Map the categorical features of the 3-dimensional time series data matrix into dense vectors through the embedding layer, project the continuous features through a dedicated feed-forward network, and generate a unified embedding space after splicing;
[0017] Step 4, perform Transformer calculation:
[0018] Step 5, output visual prediction results: Predict the MCI risk score (0-1), and simultaneously generate an attention heat map and a Shapley value contribution report.
[0019] Preferably, in step 2, missing value imputation refers to: in the process of data collection, the missing part of the data caused by loss to follow-up and other objective factors. First, the type of missing data is discriminated to determine whether it is randomly missing; then, for non-randomly missing variables, the end-mean imputation method is used for filling; for randomly missing variables, the multiple imputation method is used for filling. Time series alignment refers to: in the original data, there are heterogeneous data with different granularities in the time dimension. When bringing it into the model, it needs to be unified (there is regularization and normalization in the model module) to ensure that the accuracy of the data itself is not lost when the data is brought into the model for processing. This requires aligning the frequencies of the data in the time dimension. This step is called time series alignment. Feature standardization refers to: the input data types vary greatly. Some are text data for classification problems, and there are also medical measurement indicators such as physiological and biochemical ones. These indicators include integers and decimals. This requires a special modification module to ensure the unified format of the data when it is input into the model. This module is placed in the data embedding layer (embedding layer) and can convert the data into a unified vector format, which can not only convert text but also give the floating-point processing ability that traditional models do not have. The 3D time series data matrix refers to: patient dimension * time dimension * feature dimension, a total of three-dimensional data. By mathematically processing the vectors, new coding positions are assigned to form a three-dimensional composite data matrix.
[0020] Preferably, step 3 includes the following specific steps:
[0021] Step 31. Based on the categorical embedding sub-module, an independent embedding matrix is assigned to each categorical field (here, the categorical feature refers to a variable with classification as the main content, such as the assignment of educational attainment is divided into: primary school, junior high school, high school, etc.) of the categorical feature, to avoid semantic interference. The mathematical expression is:
[0022]
[0023] In the formula, k is the categorical field index, with a total of m, and d e = 8 is the embedding dimension;
[0024] Step 32. Based on the continuous projection sub-module, each continuous variable (such as BMI, uric acid value) is mapped to a unified dimension through an independent fully connected layer (weights are not shared). The mathematical expression is:
[0025]
[0026] Weight matrix W j ∈R 1×de corresponds to the jth continuous feature;
[0027] Step 33. Hybrid splicing method: splice all the embedding and projection results along the feature dimension, and the mathematical expression is:
[0028]
[0029] Preferably, step 4 includes the following specific steps:
[0030] Step 411. Through learning the position encoder, complete the preliminary processing of the data, localize and normalize the data features in time series for subsequent learning processes. The calculation method is:
[0031] Input: time stamp sequence (quarter number) T = [t1, t2,... t L
[0032] Operation steps:
[0033] ① Calculate the relative time difference matrix ΔT i,j = t j - t i (ΔT i,j is the quarter interval, i, j are the time series positions);
[0034] ② Combine the absolute position encoding and the relative time difference:
[0035]
[0036] In formula (4), α is a trainable parameter with an initial value of 0.7, which is the average absolute / relative position information.
[0037] Step 412. Through the directional sparse attention mechanism, capture the potential relationships between input variables, and generate relationship coefficients and attention heat maps for subsequent mining of key / latent variables. The calculation method is:
[0038] Preset key feature set: fields that have a significant impact on MCI, such as nephropathy diagnosis and medical assistance status (pre-verified through literature);
[0039] Forced attention retention rule: in multi-head attention, preset at least 10% of the attention weights to be assigned to key features: Attn final = Attn base + δ·Mask key Formula (5)
[0040] In the formula, Mask key is the keyword field position mask, and δ is the intensity coefficient (dynamically adjusted during training);
[0041] Step 413. Perform hierarchical feature extraction through 3 encoder layers, perform loss and loop on the attention variables of the previous attention layer, and hierarchically extract key feature variables:
[0042] Layer 1: Extract short-term fluctuation features through local window attention, with window size = 3 quarters.
[0043] Layer 2: Model cross-year dependencies through global unconstrained attention.
[0044] Layer 3: Adaptive pooling compression to retain the maximum response value at each time step.
[0045] Among them, modeling cross-year dependencies means: lifting the restrictions on the attention mechanism of the model (number of heads and context length) to freely explore potential connections in the data, and classifying long-term data that may span a year to determine whether there will be data jumps in terms of year changes.
[0046] Preferably, step 4 further includes adversarial robustness training, specifically including:
[0047] Step 421. For data type interference, train using the dynamic noise injection method:
[0048] For categorical data features: randomly permute the category labels with a probability of 5% (e.g., educational level "undergraduate" → "high school");
[0049] For continuous data features: add Gaussian noise, where σ x is the original standard deviation of the feature;
[0050] Step 422. Design a loss function based on a dual-constraint objective:
[0051]
[0052] In the formula, the main loss uses the mean squared error loss; the robustness loss is mathematically expressed as:
[0053] Force the prediction consistency before and after adding noise during training;
[0054] Step 433. Train through a progressive training strategy:
[0055] Phase 1 (first 30 rounds): Inject only 5% noise, β = 0.1;
[0056] Phase 2 (30 - 80 rounds): Increase the noise ratio to 10%, β = 0.3;
[0057] Phase 3 (after 80 rounds): Start random feature masking (masking rate 20%), β = 0.5.
[0058] Preferably, step 5 includes a method for outputting a visual prediction result through an interpretability service module, specifically:
[0059] Step 51. Visualize the number of heads of the model attention mechanism through a dynamic attention heatmap generator, so that potential variables / key variables can be intuitively seen in the feature heatmap. The specific calculation method is as follows:
[0060] Input: Attention weight matrices of each Transformer layer (H is the number of heads, L is the time step)
[0061] Feature importance calculation:
[0062]
[0063] In the formula, ξ i is the information value of the i-th feature (pre-computed through historical data);
[0064] Step 52. Decompose the contribution degrees of each feature variable in the model through the Shapley value contribution decomposition algorithm. Specifically for time series data (such as medical indicators detected multiple times), scenarios where the feature contribution changes over time need to be analyzed. Finally, the following are output: 1. The global contribution degree (value) of the feature 2. The weight distribution of the feature over time (time_weights): The specific method is to adopt improved Monte Carlo sampling: Considering the characteristics of time series data, only perturb the features at adjacent time points;
[0065] Output format: <json>
[0066]
[0067] Step 53. Visualize the patient risk trajectory:
[0068] Calculate the mean ± standard deviation of historical predicted values using a sliding window, mark intervention events (such as the start time point of medication), and generate a PDF report that includes an MCI trend chart and a comparison table of key indicators.
[0069] Preferably, in step 4, the training process is as follows: Optimizer: RMSProp (initial learning rate 0.001) + cosine annealing scheduler (minimum learning rate 6e-5); Batch setting: 1024 samples / batch, 150 rounds of training, and the loss converges to 0.12 within 20 rounds; Evaluation metric: When the MAE tolerance = 3.5, the test set accuracy > 90%.
[0070] The beneficial effects of a method for predicting MCI follow-up for the elderly population in the community according to the present invention are as follows:
[0071] a. Regarding the limitations of data types: The embedding layer of traditional models only supports integer encoding and cannot directly process floating-point physiological indicators such as blood glucose index. The present invention improves the traditional Transformer model so that it can process the operations of floating-point data through mathematical and underlying architecture methods.
[0072] b. Regarding the lack of long-range dependencies: Tree models (such as XGBoost) and fully connected networks cannot capture the temporal correlations within the 4-year cycle of CHARLS follow-up data, while the improved learning ability and multi-head self-attention mechanism of the Transformer in the present invention can keenly capture the correlations of data in the longitudinal time series.
[0073] c. Regarding the problem of low computational efficiency: Existing deep learning models take more than 200 hours to train with a sample size of 10,000 (Li et al., Chem EngJ 2024), while the improved model in the present invention takes less than 30 minutes to process 35,000 sample sizes * 175-dimensional data. Under the same computational efficiency, the economic cost of the present invention is only about one-tenth. Description of the Drawings
[0074] Figure 1 It is a schematic diagram of the model architecture;
[0075] Figure 2 It is a horizontal comparison of the prediction accuracies of several models;
[0076] Figure 3 It is the model training loss convergence curve. Detailed Embodiments
[0077] As described below, it is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
[0078] The following embodiments can be understood as separately expressing a part of the local structure or method of the present invention, or can also be understood as the embodiments combined with each other to explain the connotation of the structure or method of a larger scope of the present invention.
[0079] Embodiment 1
[0080] An MCI follow-up prediction method for the elderly population in the community includes the following steps:
[0081] Step 1, input of original data: Receive the original CHARLS data, and the CHARLS data includes 16-dimensional continuous type indicators and 148-dimensional categorical questionnaire data;
[0082] Step 2, data preprocessing: For the input data, complete missing value filling, time series alignment, and feature standardization, and output a normalized 3-dimensional time series data matrix (patient × time point × feature)
[0083] Step 3, embedding and splicing: Map the categorical features of the 3-dimensional time series data matrix into dense vectors through the embedding layer, project the continuous features through a dedicated feed-forward network, and splice them to generate a unified embedding space;
[0084] Step 4, perform Transformer calculation:
[0085] Step 5, output visual prediction results: Predict the MCI risk score (0-1), and synchronously generate an attention heat map and a Shapley value contribution report.
[0086] In this embodiment, the 16-dimensional continuous type indicators and 148-dimensional categorical questionnaire data are known, and the specific content can be found on the official website of the China Health and Retirement Longitudinal Study (CHARLS).
[0087] Embodiment 2
[0088] Based on Example 1, this example discloses that in step 2, missing value imputation refers to: the part of data missing due to loss to follow-up and other objective factors during data collection. First, the type of missing data is discriminated to determine whether it is randomly missing; subsequently, for non-randomly missing variables, the end-mean imputation method is used for filling; for randomly missing variables, the multiple imputation method is used for filling. Time series alignment refers to: in the original data, there are heterogeneous data with different granularities in the time dimension. When bringing it into the model, it needs to be unified (there is regularization and normalization in the model module) to ensure that the accuracy of the data itself is not lost when the data is brought into the model for processing. This requires aligning the frequencies of the data in the time dimension, and this step is called time series alignment. Feature standardization refers to: the input data types have a large degree of difference. Some are text data belonging to classification problems, and there are also medical measurement indicators such as physiological and biochemical indicators. These indicators include integers and decimals. This requires a special modification module to ensure the unified format of the data when it is input into the model. This module is placed in the data embedding layer (embedding layer) and can convert the data into a unified vector format, which can not only convert text but also endow the traditional model with the ability to process floating-point numbers that it does not have. The 3D time series data matrix refers to: patient dimension * time dimension * feature dimension, a total of three-dimensional data. By performing mathematical processing on the vectors, new coding positions are assigned to form a three-dimensional composite data matrix.
[0089] Example 3
[0090] Based on Example 1, to solve the problem that traditional models cannot collaboratively process continuous physiological indicators (floating-point numbers) and categorical questionnaire data (integer coding), this example discloses that step 3 includes the following specific steps:
[0091] Step 31. Based on the categorical embedding sub-module, each categorical field (such as education level, residence code) of the categorical features is assigned an independent embedding matrix to avoid semantic interference. The mathematical expression is:
[0092]
[0093] where k is the categorical field index (a total of m), and d e = 8 is the embedding dimension;
[0094] Step 32. Based on the continuous projection sub-module, each continuous variable (such as BMI, uric acid value) is mapped to a unified dimension through an independent fully connected layer (weights are not shared). The mathematical expression is:
[0095]
[0096] Weight matrix W j ∈R 1×de , corresponding to the jth continuous feature.
[0097] Step 33. Hybrid splicing method: Splice all the embeddings and projection results along the feature dimension, and the mathematical expression is:
[0098]
[0099] where m = 148 is the number of categorical features, n = 16 is the number of continuous features, and the final dimension is 164;
[0100] This embodiment can achieve the following effects: Avoid the dimensional explosion of traditional One-Hot encoding (original dimension 148 → 8×148 = 1184), and the memory occupancy is reduced by 64%.
[0101] Embodiment 4
[0102] Based on Embodiment 1, in order to capture the quarterly-level dynamic evolution law of elderly health data and identify the long-term impact of key events (such as drug discontinuation), this embodiment discloses that the step 4 includes the following specific steps:
[0103] Step 411. Complete the preliminary processing of the data through a learned positional encoder, and perform positioning and temporal normalization on the data features for subsequent learning processes. The calculation method is:
[0104] Input: Timestamp sequence (quarter number) T = [t1, t2,...t L
[0105] Operation steps:
[0106] ③ Calculate the relative time difference matrix ΔT i,j = t j - t i (quarter interval, i, j are temporal positions)
[0107] ④ Combine the absolute positional encoding and the relative time difference:
[0108]
[0109] In the formula, α is a trainable parameter with an initial value of 0.7, that is, the average absolute / relative position information;
[0110] Step 412. Capture the potential relationships between input variables through a directional sparse attention mechanism, and generate relationship coefficients and attention heatmaps for subsequent mining of key / latent variables. The calculation method is:
[0111] Preset key feature set: Fields that have a significant impact on MCI, such as nephropathy diagnosis and medical assistance status (pre-verified through literature);
[0112] Forced attention retention rule: In multi-head attention, at least 10% of the attention weights are preset to be allocated to key features: Attn final = Attn base + δ·Mask key Formula (5)
[0113] where Mask key is the keyword field position mask, and δ is the intensity coefficient (dynamically adjusted during training);
[0114] Step 413. Perform hierarchical feature extraction through a three-level encoder layer:
[0115] The first layer: Extract short-term fluctuation features through local window attention, with the window size = 3 quarters;
[0116] The second layer: Model the cross-year dependence through global unconstrained attention;
[0117] The third layer: Adaptive pooling compression to retain the maximum response value at each time step;
[0118] Among them, modeling the cross-year dependence means: lifting the restrictions on the attention mechanism of the model (the number of heads and the context length) to allow it to freely mine the potential connections in the data, and classify the long-term data that may span a year to judge whether there will be a data jump in the year change.
[0119] This embodiment can achieve the following technical effects: On the CHARLS test set, the F1 value of the time series dependence modeling is increased by 14.2%.
[0120] Embodiment 5
[0121] Based on Embodiment 1, in order to improve the stability of the model in the scenarios of missing community follow-up data and noise interference, this embodiment discloses that: Step 4 further includes adversarial robustness training, which specifically includes:
[0122] Step 421. For data type interference, train with the dynamic noise injection method:
[0123] For categorical data features: Randomly permute the category labels with a probability of 5% (e.g., educational level "undergraduate" → "high school");
[0124] For continuous data features: Add Gaussian noise to the features, where σ x is the original standard deviation of the feature;
[0125] Step 422. Design a loss function based on a dual-constraint objective:
[0126]
[0127] In the formula, the main loss adopts the mean square error loss; the robustness loss is mathematically expressed as:
[0128] forcing the prediction consistency before and after adding noise during training;
[0129] Step 433. Training is carried out through a progressive training strategy:
[0130] Phase 1 (the first 30 rounds): Only inject 5% noise, β = 0.1.
[0131] Phase 2 (rounds 30 - 80): The noise ratio is increased to 10%, β = 0.3.
[0132] Phase 3 (after 80 rounds): Start random feature masking (masking rate 20%), β = 0.5.
[0133] This embodiment achieves the following technical effects: Under the extreme condition of 30% data loss, the model prediction error only increases by 8.7% (traditional model > 35%).
[0134] Embodiment 6
[0135] Based on Embodiment 1, in order to provide a clinically understandable prediction basis and meet the requirements of medical compliance, this embodiment discloses that the above-mentioned Step 5 includes a method for outputting a visual prediction result through an interpretability service module, specifically:
[0136] Step 51. Visualize the number of heads of the model attention mechanism through a dynamic attention heatmap generator, so that potential variables / key variables can be intuitively seen in the feature heatmap. The specific calculation method is:
[0137] Input: Attention weight matrix of each Transformer layer (H is the number of heads, L is the time step)
[0138] Feature importance calculation:
[0139]
[0140] In the formula, ξ i is the information value of the i-th feature (pre-computed through historical data);
[0141] Step 52. Decompose the contribution degrees of each feature variable in the model through the Shapley value contribution degree decomposition algorithm. Specifically, for time series data (such as medical indicators detected multiple times), scenarios where feature contributions change over time need to be analyzed. The final outputs are: 1. The global contribution degree (value) of the feature; 2. The weight distribution of the feature over time (time_weights): The specific method is to use improved Monte Carlo sampling: Considering the characteristics of time series data, only perturb the features at adjacent time points;
[0142] Output format: <json>
[0143]
[0144] Step 53. Visualize the patient risk trajectory:
[0145] Calculate the mean ± standard deviation of historical predicted values using a sliding window, mark intervention events (such as the time point of starting medication), and generate a PDF report that includes an MCI trend chart and a comparison table of key indicators.
[0146] Example 7
[0147] In step 4 described above, the training process is as follows: Optimizer: RMSProp (initial learning rate 0.001) + cosine annealing scheduler (minimum learning rate 6e-5); Batch setting: 1024 samples / batch, 150 rounds of training, with the loss converging to 0.12 within 20 rounds; Evaluation metric: When the MAE tolerance = 3.5, the test set accuracy > 90%.
[0148] Example 8
[0149] Example of MCI risk prediction process:
[0150] Input: CHARLS follow-up data of a 70-year-old male patient for 4 consecutive years;
[0151] Processing steps:
[0152] 1. Preprocessing: Fill in the missing uric acid values (using the mean of the adjacent two years), and generate a 24×164 input matrix after quarterly alignment;
[0153] 2. Embedding calculation: Map "junior high school" for education level to [0.32, -0.15,...], and project BMI = 25.7 to [0.48, 0.21,...];
[0154] 3. Transformer inference: The third layer attention head assigns a weight of 0.85 to "lack of medical assistance in the past two years";
[0155] 4. Result output: The predicted score is 0.73 (high risk), mainly attributed to a history of kidney disease (+29%) and low social participation (+18%).
[0156] Example 9
[0157] Model training parameter settings:
[0158] Hardware environment: NVIDIA A100 GPU, CUDA 11.6, Python 3.12.0, Pytorch 2.0;
[0159] Hyperparameters: <python>;
[0160] training_config = {
[0161]
[0162] Through the above design, the present invention realizes high precision, strong robustness, and clinical interpretability in MCI prediction in community scenarios. The technical advantages of the present invention are shown in the following table:
[0163] Comparison Table of Technical Advantages
[0164]
[0165] Working Principle of the Present Invention:
[0166] 1. In step 3 of the present invention, through the hybrid data embedding module, it supports the joint embedding of floating-point types and categorical variables, and has good generalization ability on longitudinal time-series data.
[0167] 2. Dynamic weighted attention mechanism: By visualizing feature contributions through heatmaps (such as the contribution ratio of nephropathy diagnosis being 15%), it can assist in mining potential relevant variables.
[0168] 3. Efficient training strategy: Cosine annealing learning rate optimization + large-batch training, the training time is shortened by 40%, and the time and training cost are greatly optimized.
[0169] 4. As Figure 2 shown, compared with XGBoost (accuracy of 75% when MAE = 4.2), the present invention reaches 90% when MAE = 3.5. In addition, the interpretability of the present invention is enhanced: By feedback of attention heatmaps on key risk factors, it has potential value for the induction and mining of data categorical variables (such as the weight coefficient analysis of "hope value"). At the same time, the present invention has wide adaptability: It supports community port deployment (C / S architecture) and docking with hospital information system APIs.
[0170] 5. It should be noted that there are also the following alternative forms for the technical solution of the present invention: Embedding layer substitution: Replace random initialization with GloVe pre-training, and the model parameters need to be readjusted; Attention head adjustment: The number of heads can be extended to 6 - 8 heads to adapt to larger sample sizes (GPU acceleration is required, the device requirements are higher, the cost index increases, and the cost of existing high-performance computing devices is relatively high); Data source substitution: Compatible with international aging databases such as SHARE and HRS, and the input dimensions can be adjusted for migration.
[0171] 6. The relevant software code of the present invention is implemented based on the Python 3.12.0 environment and PyTorch 2.0. Deployment requires a GPU with ≥8GB video memory. If the hardware does not support it, it can be applied to the development and conversion of the front end through technical means such as API interfaces.
[0172] 7. The present invention can achieve the following remarkable effects:
[0173] a. Regarding the limitations of data types: The embedding layer of traditional models only supports integer encoding and cannot directly process floating-point physiological indicators such as blood glucose index. The present invention improves the traditional Transformer model so that it can process the operations of floating-point data through mathematical and underlying architecture methods.
[0174] b. Regarding the lack of long-range dependencies: Tree models (such as XGBoost) and fully connected networks cannot capture the temporal correlations within the 4-year cycle of CHARLS follow-up data, while the improved learning ability and multi-head self-attention mechanism of the Transformer in the present invention can keenly capture the correlations of data in the longitudinal time series.
[0175] c. Regarding the problem of low computational efficiency: Existing deep learning models take more than 200 hours to train with a sample size of 10,000 (Li et al., Chem EngJ 2024), while the improved model of the present invention only takes less than 30 minutes to process 35,000 samples * 175-dimensional data. Under the same computational efficiency, the economic cost of the present invention is only about one-tenth.< / python> < / json> < / json>
Claims
1. A follow-up prediction method for MCI in the elderly population of the community, characterized by It includes the following steps: Step 1, Original data input: Receive the original CHARLS data, where the CHARLS data includes 16-dimensional continuous indicators and 148-dimensional categorical questionnaire data; Step 2, Data preprocessing: For the input data, complete missing value filling, time series alignment, and feature standardization, and output a normalized 3-dimensional time series data matrix; Step 3, Embedding and splicing: Map the categorical features of the 3-dimensional time series data matrix into dense vectors through an embedding layer, project the continuous features through a dedicated feedforward network, and splice them to generate a unified embedding space; Step 4, Perform Transformer calculation: Step 5, Output visual prediction results: Predict the MCI risk score, and simultaneously generate an attention heat map and a Shapley value contribution report.
2. The MCI follow-up prediction method for the elderly in the community according to claim 1, wherein, In the above-mentioned Step 2, missing value filling refers to: For the data missing part caused by lost follow-up and other objective factors during the data collection process, first discriminate the type of missing data to determine whether it is randomly missing; then for non-randomly missing variables, use the end mean filling method to fill; for randomly missing variables, use the multiple imputation method to fill; Time series alignment refers to: In the original data, there are heterogeneous data with different granularities in the time dimension. When bringing it into the model, it needs to be unified to ensure that its own accuracy is not lost when the data is processed by the model. This requires aligning the frequencies of the data in the time dimension. This step is called time series alignment; Feature standardization refers to: Through a modification module to ensure the unified format of the data when it is input into the model; The modification module is placed in the data embedding layer to convert the data into a unified vector format; The 3-dimensional time series data matrix refers to: Patient dimension * Time dimension * Feature dimension, a total of three-dimensional data, and new coding positions are assigned through mathematical processing of the vectors to form a three-dimensional composite data matrix.
3. The MCI follow-up prediction method for the elderly in the community according to claim 1, characterized in that, The above-mentioned Step 3 includes the following specific steps: Step 31. Based on the categorical embedding sub-module, assign an independent embedding matrix to each categorical field of the categorical features to avoid semantic interference. The mathematical expression is: where k is the classification field index, with a total of m, and d e = 8 is the embedding dimension; Step 32. Based on the continuous projection sub-module, map each continuous variable to a unified dimension through an independent fully connected layer. The mathematical expression is: Weight matrix W j ∈R 1×de , corresponding to the j-th consecutive feature; Step 33. Hybrid splicing method: Splice all embedding and projection results along the feature dimension. The mathematical expression is:
4. The MCI follow-up prediction method for the elderly in the community according to claim 1, characterized in that, The above-mentioned Step 4 includes the following specific steps: Step 411, Complete the preliminary processing of the data through a learned position encoder, locate and normalize the time series of the data features. The calculation method is: Input: Timestamp sequence (quarter number) T = [t1, t2,... t L ; Operation steps: ① Calculate the relative time difference matrix ΔT i,j = t j - t i ; ② Combine absolute position encoding with relative time difference: In the formula, α is a trainable parameter with an initial value of 0.7, and is the average absolute / relative position information; Step 412, Through a directional sparse attention mechanism, capture the potential relationships between input variables and generate relationship coefficients and an attention heat map. The calculation method is: Preset a key feature set; Forced attention retention rule: In multi-head attention, preset at least 10% of the attention weights to be assigned to key features: Attn final = Attn base + δ·Mask key In Equation (5), Mask key is the keyword field position mask, and δ is the intensity coefficient; Step 413, Perform hierarchical feature extraction through 3 encoder layers: Layer 1: Extract short-term fluctuation features through local window attention, window size = 3 quarters; Layer 2: Model cross-year dependence through global unconstrained attention; Layer 3: Adaptive pooling compression to retain the maximum response value at each time step; Among them, modeling cross-year dependence means: lifting the restrictions on the attention mechanism of the model, that is, lifting the head number and context length, allowing it to freely explore the potential connections in the data, and classifying the long-term data that may span one year to judge whether there will be a data jump in the year change.
5. The MCI follow-up prediction method for the elderly in the community according to claim 1, characterized in that, Step 4 also includes adversarial robustness training, specifically including: Step 421. For data type interference, train with the dynamic noise injection method: For categorical data features: randomly permute the class labels with a probability of 5%; For continuous data features: Add Gaussian noise with to the feature, where σ x is the original standard deviation of the feature; Step 422. Design a loss function based on a dual-constraint objective; wherein, the main loss uses the mean squared error loss; the robustness loss is mathematically expressed as: Prediction consistency before and after forcing the addition of noise during training; Step 433. Train through a progressive training strategy: Phase 1, that is, the first 30 rounds: only inject 5% noise, β = 0.1; Phase 2, that is, rounds 30 - 80: the noise ratio is increased to 10%, β = 0.3; Phase 3, that is, after 80 rounds: start random feature masking, masking rate 20%, β = 0.
5.
6. The MCI follow-up prediction method for the elderly population in the community according to claim 1, characterized in that, Step 5 includes a method for outputting a visual prediction result through an interpretability service module, specifically: Step 51. Visualize the number of heads of the model's attention mechanism through a dynamic attention heatmap generator, and the specific calculation method is: Input: Attention weight matrices of each Transformer layer Calculate the feature importance; where ξ i is the information value of the i-th feature; Step 52. Decompose the contribution degree of each feature variable in the model through the Shapley value contribution decomposition algorithm. For the scenario where the feature contribution of time series data needs to be analyzed over time, finally output:
1. The global contribution degree of the feature; 2. The weight distribution of the feature over time: The specific method is to use improved Monte Carlo sampling: for the characteristics of time series data, only perturb the features of adjacent time points; Step 53. Visualize the patient risk trajectory; Calculate the mean ± standard deviation of the historical prediction values through a sliding window, mark the intervention events, and generate a PDF report, which includes an MCI trend chart and a key index comparison table.
7. The MCI follow-up prediction method for the elderly in the community according to claim 1, characterized in that, In step 4, the training process is as follows: Optimizer: RMSProp + cosine annealing schedule; Batch setting: 1024 samples / batch, 150 rounds of training, and the loss converges to 0.12 within 20 rounds; Evaluation metric: When the MAE tolerance = 3.5, the test set accuracy > 90%.