A hypertension prediction method based on random forest and LSTM neural network

Through the combination of random forests and LSTM neural network with attention mechanism and multi-layer perceptron, key features are screened and a hypertension prediction model is generated, which solves the problem of inability to accurately predict individual disease risk in traditional methods, and achieves efficient hypertension risk assessment and personalized management.

CN119905261BActive Publication Date: 2025-08-29SOUTH CHINA AGRICULTURAL UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510133779.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-02-06
Publication Date
2025-08-29
Estimated Expiration
2045-02-06

AI Technical Summary

Technical Problem

Traditional hypertension risk prediction methods rely on statistical models of a small number of indicators, and cannot fully explore the potential laws in a large number of complex data, and it is difficult to achieve accurate prediction of individual disease risks.

Method used

Using a method based on random forest and LSTM neural network, key features are screened through feature importance analysis, combined with attention mechanism and multi-layer perceptron MLP, the complex relationship between key features is captured and a hypertension prediction model is generated.

Benefits of technology

Accurate prediction of individual risk of hypertension is achieved, efficient hypertension prediction tools are provided, and high-risk prediction tools are provided to help identify high-risk individuals and provide early intervention suggestions. The prediction results are optimized and reliable data support is provided for health management and clinical decision-making.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119905261B_ABST
    Figure CN119905261B_ABST
Patent Text Reader

Abstract

The present invention discloses a hypertension prediction method based on a random forest and LSTM neural network, belonging to the field of medical data processing technology. The method comprises the following steps: obtaining patient sample information and establishing an information collection library; performing feature importance analysis on the preprocessed sample information using a random forest; calculating the weight of each key feature using an attention mechanism and generating a weighted feature representation; inputting the weighted feature representation into a neural network to generate a context vector; inputting the context vector into a multilayer perceptron for prediction output; optimizing the multilayer perceptron, the attention mechanism, and the neural network based on the predicted output and the true value to obtain a prediction model; and inputting sample information into the prediction model to obtain a hypertension prediction result. The method for hypertension prediction based on a random forest and LSTM neural network solves the problem that existing prediction methods have difficulty in accurately predicting individual disease risks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of medical data processing technology, and in particular to a hypertension prediction method based on random forest and LSTM neural network. Background Art

[0002] With changes in lifestyle and the increasing aging of the population, hypertension has become a major public health problem worldwide. As a chronic disease, hypertension is not only closely related to cardiovascular and cerebrovascular diseases, but also has a significant impact on the occurrence of various diseases such as kidney disease and diabetes. Therefore, timely and effective prediction of the risk of hypertension is of great significance for improving patients' quality of life and reducing the medical burden. However, traditional hypertension risk prediction methods mostly rely on statistical models based on a small number of indicators, which cannot fully explore the potential patterns in large amounts of complex data and make it difficult to accurately predict individual disease risks. Summary of the Invention

[0003] In order to overcome the defects of the existing technology, the present invention provides a hypertension prediction method based on random forest and LSTM neural network to solve the above problems.

[0004] The technical solution adopted by the present invention to solve the technical problem is: a hypertension prediction method based on random forest and LSTM neural network, comprising the following steps:

[0005] S1: Obtain the patient's sample information and establish an information collection database; pre-process the sample information in the information collection database;

[0006] S2: Performing feature importance analysis on the preprocessed sample information through random forest, so as to screen out features that have an impact on hypertension prediction from the preprocessed sample information as key features based on the feature importance analysis;

[0007] S3: The attention mechanism is used to calculate the weight of each key feature and generate a weighted feature representation. The weighted feature representation is sorted by weight to form sequence data. The weighted feature representation is then input into an LSTM neural network to capture the dynamic features in the sequence data and generate a context vector. Finally, the context vector is input into a multi-layer perceptron (MLP) for prediction output. Based on the predicted output and the true value, the MLP, attention mechanism, and LSTM neural network are optimized to obtain a prediction model.

[0008] S4: Input sample information into the prediction model to obtain hypertension prediction results.

[0009] It is worth noting that in step S2, according to the pre-processed sample information Importance Sort them and set a threshold to filter out the importance Preprocessed sample information exceeding the threshold As a key feature;

[0010] Based on the preprocessed sample information Importance Calculated by the following formula: ; T is the T decision trees that make up the random forest; represents the sample set used by the t-th tree, ; For the sample set Nodes in The proportion of samples in ; is the sample information after preprocessing Changes in the Gini coefficient due to division.

[0011] Preferably, in step S3, the loss function is calculated by predicting the output and the true value, and then the gradient of the loss function with respect to the parameters of the multilayer perceptron MLP, the gradient of the parameters of the attention mechanism, and the gradient of the parameters of the LSTM neural network are calculated in sequence by the back propagation algorithm to optimize the parameters corresponding to the multilayer perceptron MLP, the attention mechanism, and the LSTM neural network; the multilayer perceptron MLP, the attention mechanism, and the LSTM neural network after parameter optimization are used to form a prediction model.

[0012] Specifically, in step S3, the loss function is calculated for the parameters of the multi-layer perceptron MLP. The steps of the gradient are: ,in is the loss function, is the predicted output, parameter are the weights of the multi-layer perceptron MLP.

[0013] Specifically, in step S3, the parameters of the loss function for the attention mechanism are calculated The steps of the gradient are: ,in is the loss function, is the weighted feature representation generated by the attention mechanism, and the parameter Used to reflect the accuracy of key feature capture.

[0014] Specifically, in step S3, the loss function is calculated for the parameters of the LSTM neural network. The steps of the gradient are: ,in is the loss function, is the hidden state or output of the LSTM neural network, and the parameters It is used to reflect the modeling ability of LSTM neural network on the global dependency of key features in the sequence.

[0015] Optionally, the step of optimizing the parameters corresponding to the multi-layer perceptron MLP, attention mechanism and LSTM neural network in step S3 is: ;in is the updated parameter value, Indicates the parameter value of the current iteration, is the learning rate;

[0016] For the multi-layer perceptron MLP, The loss function is the parameter of the multi-layer perceptron MLP Gradient ; For the attention mechanism, is the parameter of the loss function for the attention mechanism Gradient ; For LSTM neural network, The parameters of the LSTM neural network for the loss function Gradient .

[0017] Preferably, the step of optimizing the parameters corresponding to the multi-layer perceptron MLP, attention mechanism and LSTM neural network in step S3 is: ;in is the updated parameter value, Indicates the parameter value of the current iteration, is the learning rate, Used to prevent division by zero errors;

[0018] Corrected first-order moment of gradient , , is the first-order moment estimate of the gradient in the current iteration, is the first-order moment estimate of the gradient in the previous iteration, is a hyperparameter that controls the decay rate of the first-order moment estimate, is the gradient of the current iteration;

[0019] Corrected second-order moment of gradient , , is the second-order moment estimate of the gradient in the current iteration, is the second-order moment estimate of the gradient in the previous iteration, is a hyperparameter that controls the decay rate of the second-order moment estimate, is the square of the current gradient;

[0020] For the multi-layer perceptron MLP, The loss function is the parameter of the multi-layer perceptron MLP Gradient ; For the attention mechanism, is the parameter of the loss function for the attention mechanism Gradient ; For LSTM neural network, The parameters of the LSTM neural network for the loss function Gradient .

[0021] It is worth noting that the loss function in step S3 is ,in Represents the total value of the loss function Represents the true value of the i-th sample information, Represents the predicted output of the i-th sample information, Indicates the total number of samples.

[0022] Specifically, in step S3, the prediction model is continuously trained and optimized until the precision, recall rate and F1 score of the prediction model are greater than or equal to a preset threshold, and the prediction model at this time is output;

[0023] Obtaining the precision, recall, and F1 score of the prediction model through cross-validation: Precision , recall rate , F1 score ; TP represents the number of patients correctly predicted by the model as high-risk, FP represents the number of patients whose low-risk condition was incorrectly predicted by the model as high-risk; FN represents the number of samples whose high-risk condition was incorrectly predicted by the model as low-risk.

[0024] The beneficial effects of the present invention are: in the hypertension prediction method based on random forest and LSTM neural network, a multi-layer perceptron MLP is used in combination with an LSTM neural network and an attention mechanism to capture the complex relationship between key features, and based on the weighted combination of these key features, the probability of hypertension in an individual is predicted, thereby providing an efficient hypertension prediction tool for clinicians, helping to identify high-risk individuals and providing early intervention recommendations; this prediction method optimizes the prediction results by evaluating the impact of features on the occurrence of hypertension, achieves accurate prediction of individual disease risks, and provides reliable data support and personalized management plans for health management and clinical decision-making. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Figure 1 This is a flowchart of a hypertension prediction method based on random forest and LSTM neural network in one embodiment of the present invention;

[0026] Figure 2 is a schematic diagram of an evaluation model in one embodiment of the present invention;

[0027] Figure 3 A confusion matrix diagram according to an embodiment of the present invention is shown;

[0028] Figure 4 FIG. 4 is a loss curve diagram in one embodiment of the present invention. DETAILED DESCRIPTION

[0029] The following is a further description of specific embodiments of the present invention in conjunction with the accompanying drawings. It should be noted that the description of these embodiments is intended to facilitate understanding of the present invention and does not constitute a limitation of the present invention. In addition, the technical features involved in the various embodiments of the present invention described below may be combined with each other as long as they do not conflict with each other.

[0030] like Figure 1-4 As shown in FIG, a hypertension prediction method based on random forest and LSTM neural network includes the following steps:

[0031] S1: Obtain patient sample information and establish an information collection database; collect various physiological data and lifestyle information of patients through health examinations or questionnaires, and establish a data set containing basic information and health indicators of patients. Sample information includes but is not limited to the patient's age, gender, height, weight, pulse pressure, waist circumference, body mass index (BMI), blood sugar, postprandial blood sugar, total cholesterol, glycated hemoglobin, high-density lipoprotein, and low-density lipoprotein;

[0032] Preprocess the sample information in the information collection library, including handling missing values, feature scaling, and standardization. Missing numerical data in the information collection library is filled with the mean, and missing non-numerical data is filled with the mode. For example, the patient's weight, height, blood pressure and other data are standardized, and the target variable "whether the patient is a hypertensive patient" is converted into a binary label to meet the model input requirements. The preprocessed sample information is standardized and normalized, and compressed using the MinMaxScaler saved during training to reduce the dimension or size of the data, thereby improving the training efficiency and performance of subsequent models.

[0033] S2: Performing feature importance analysis on the preprocessed sample information through random forest, so as to screen out features that have an impact on hypertension prediction from the preprocessed sample information as key features based on the feature importance analysis;

[0034] In step S2, the random forest is composed of The predictions of each decision tree are aggregated through an ensemble method to finally obtain an optimal prediction result. In order to screen out the representative features for hypertension prediction, according to the preprocessed sample information Importance Sort them and set a threshold to filter out the importance Preprocessed sample information exceeding the threshold As key features; the threshold can be adjusted through experiments, usually a percentage ranking based on importance score or a fixed weight value can be used for screening. The purpose of screening is to retain those features that have made significant contributions in predicting hypertension, ensuring that the prediction effect of the model is significantly improved; in the hypertension prediction task, the key features screened by the random forest method include weight, age, blood sugar level and blood lipids. Based on the preprocessed sample information Importance Calculated by the following formula: ; T is the T decision trees that make up the random forest. In the random forest, the predictions of each decision tree are aggregated through an ensemble method to output the optimal prediction result; represents the sample set used by the t-th tree, , sample set is a subset sampled from the training data, which can be obtained by bootstrap sampling; For the sample set Nodes in The proportion of samples in ; The sample information after preprocessing Changes in the Gini coefficient due to division.

[0035] S3: The key features screened out by methods such as random forest are input into the LSTM neural network for training: an attention mechanism is introduced during the training process to calculate the weight of each key feature and generate a weighted feature representation, wherein the weighted feature representation is sorted by the size of the weight to form sequence data; subsequently, the weighted feature representation is input into the LSTM neural network to capture the dynamic features in the sequence data and generate a context vector through the LSTM neural network. In this embodiment, the LSTM neural network processes the feature representation weighted by the attention mechanism. These weighted feature representations are combined in a certain order to form a set of sequence data. The LSTM neural network processes this sequence data to understand the dependency between different features and capture the interaction between them; finally, the context vector is input into the multi-layer perceptron MLP for prediction output; the multi-layer perceptron MLP, attention mechanism and LSTM neural network are optimized according to the predicted output and the true value to obtain a prediction model. In this embodiment, the LSTM neural network is good at processing sequence data and can capture dependencies in long sequences, so it can extract dynamic features in the sequence of key features. In order to further improve the performance of the model, an attention mechanism is introduced on the basis of the LSTM neural network. The attention mechanism weights each key feature to better focus on the features most relevant to the target prediction. The model quantifies the importance of the feature by calculating the attention weight of each feature, and calculates the weighted feature representation based on these weights, thereby optimizing feature extraction. The feature representation weighted by the attention mechanism can better reflect the part of the entire sample information that is most relevant to the target prediction. Then, the feature representation weighted by the LST The context vector processed by the M neural network and attention mechanism is input into the multi-layer perceptron (MLP) for the final prediction output. The MLP, as a fully connected layer, further processes the feature representations obtained from the previous layer to output the final prediction result. During the prediction process, the model first passes the input data through each layer of the network, including the LSTM neural network, the attention mechanism, and the MLP, through forward propagation. The result of the forward propagation is the model's output prediction value. During this process, the attention mechanism weights the features to focus on the most relevant ones, the LSTM neural network captures sequential dependencies, and the MLP is used to integrate features and generate the final prediction output. It is worth noting that the prediction model obtained by combining the MLP with the LSTM neural network and the attention mechanism consists of multiple fully connected layers and attention layers, which can effectively capture the complex relationships between features.

[0036] Specifically, in step 3, the LSTM neural network training uses residual connections and a bidirectional LSTM structure to improve the model's learning ability and accuracy. Specifically, the residual connection adds the output of the previous layer within the LSTM neural network to the output of the current layer within the LSTM neural network to avoid the gradient vanishing problem that may occur in deep networks, thereby improving the training effect;

[0037] The formula for the residual connection is: ;in, is the output of the current layer after addition, is the output of the current layer inside the LSTM neural network, is the output of the previous layer inside the LSTM neural network, It is a nonlinear mapping function of the LSTM neural network, such as ReLU or tanh. Residual connections help the model learn deeper features and maintain network stability by enhancing information transfer.

[0038] At the same time, the bidirectional LSTM structure introduces two-way processing within the LSTM neural network: forward and backward, to form context, thereby fully utilizing information on both sides of the input features. Although time series prediction is not involved here, the introduction of the bidirectional LSTM structure can still help the LSTM neural network learn the relationships between features more comprehensively. Specifically, by processing input features from both the forward and backward directions, the bidirectional LSTM structure enables the LSTM neural network to comprehensively utilize the contextual information of the features, further improving the comprehensiveness of feature learning and model performance.

[0039] In step S3, the loss function is calculated by predicting the output and the true value, and then the gradient of the loss function with respect to the parameters (weights and biases) of the multilayer perceptron MLP, the gradient of the parameters (weight matrix) of the attention mechanism, and the gradient of the parameters of the LSTM neural network (input gate, forget gate, output gate, and cell state-related parameters) are calculated in sequence through the backpropagation algorithm, so as to achieve the purpose of forwarding the gradient layer by layer to optimize the parameters corresponding to the multilayer perceptron MLP, the attention mechanism, and the LSTM neural network; the multilayer perceptron MLP, the attention mechanism, and the LSTM neural network after parameter optimization are used to form a prediction model; in this embodiment, the difference between the predicted output and the true value is represented by the loss function to quantify the model performance.

[0040] In step S3, the loss function is calculated for the parameters of the multi-layer perceptron MLP. The steps of the gradient are: ,in is the loss function, is the predicted output, parameter are the weights of the multi-layer perceptron MLP.

[0041] In step S3, the gradient is passed to the attention mechanism to calculate the loss function for the parameters of the attention mechanism The steps of the gradient are: ,in is the loss function, is the weighted feature representation generated by the attention mechanism, and the parameter Used to reflect the accuracy of key feature capture and optimize It can capture key features more accurately and improve the rationality of feature weighting.

[0042] In step S3, the gradient is passed to the LSTM neural network to calculate the loss function for the parameters of the LSTM neural network. The steps of the gradient are: ,in is the loss function, is the hidden state or output of the LSTM neural network, and the parameters It is used to reflect the modeling ability of LSTM neural network on the global dependency of key features in the sequence, so it is optimized It can enhance the LSTM neural network's ability to model global dependencies in sequence data.

[0043] In one embodiment, the step of optimizing the parameters corresponding to the multilayer perceptron MLP, attention mechanism, and LSTM neural network in step S3 is as follows: ;in is the updated parameter value, Indicates the parameter value of the current iteration, Is the learning rate, which determines the step size of each update; for the multi-layer perceptron MLP, The loss function is the parameter of the multi-layer perceptron MLP Gradient ; For the attention mechanism, is the parameter of the loss function for the attention mechanism Gradient ; For LSTM neural network, The parameters of the LSTM neural network for the loss function Gradient In each iteration, the gradient descent method uses the calculated gradient to update the parameters, gradually approaching the minimum value of the loss function. By backpropagating the gradient, the model can identify the degree to which each layer parameter affects the final loss and adjust the corresponding weights and biases to optimize the model's performance.

[0044] In another embodiment, the steps of optimizing the parameters corresponding to the multilayer perceptron MLP, attention mechanism, and LSTM neural network in step S3 using the Adam optimizer are as follows: ;in is the updated parameter value, Indicates the parameter value of the current iteration, is the learning rate, Used to prevent division by zero errors;

[0045] Corrected first-order moment of gradient , , is the first-order moment estimate of the gradient in the current iteration, is the first-order moment estimate of the gradient in the previous iteration, is a hyperparameter that controls the decay rate of the first-order moment estimate (typically set to 0.9), is the gradient of the current iteration; Adam first introduces the momentum mechanism by calculating the first-order moment (momentum) of the gradient. Through exponentially weighted averaging, Adam can take into account the gradient information of previous updates, thereby smoothing the update process;

[0046] Corrected second-order moment of gradient , , is the second-order moment estimate of the gradient in the current iteration, is the second-order moment estimate of the gradient in the previous iteration, is a hyperparameter that controls the decay rate of the second-order moment estimate (typically set to 0.999), is the square of the current gradient; Adam calculates the weighted average of the square of the gradient (i.e., the gradient second-order moment estimate) to adjust the learning rate of each parameter so that the learning rate changes adaptively with the size of the gradient;

[0047] For the multi-layer perceptron MLP, The loss function is the parameter of the multi-layer perceptron MLP Gradient ; For the attention mechanism, is the parameter of the loss function for the attention mechanism Gradient ; For LSTM neural network, The parameters of the LSTM neural network for the loss function Gradient ;

[0048] In this embodiment, Adam is an adaptive optimization algorithm that combines momentum and learning rate adaptive adjustment in each update, avoiding the problems of traditional gradient descent that are prone to falling into local optimality and unstable updates; Adam continuously adjusts the learning rate and accumulated gradient momentum to make the model parameters more stable and converge to the state with the minimum loss faster. Since the number of iterations is small in the early stage of training, and It will be biased towards 0. Adam uses bias correction to correct this problem. By correcting it, the estimated value in the initial stage is more accurate. Therefore, the first-order moment of the gradient after correction is and the corrected second-order moment of the gradient The parameter optimization process is repeated over multiple epochs, gradually reducing the model loss and improving the model's prediction accuracy.

[0049] In step S3, the loss function is cross entropy loss: ,in Represents the total value of the loss function, which measures the predicted output and the true value The difference between the predicted output and the true value is expressed as high risk of hypertension or low risk of hypertension; Represents the true value of the i-th sample information, Represents the predicted output of the i-th sample information, Represents the total number of samples; the model undergoes multiple iterations of training and gradually optimizes parameters to ensure that it can effectively learn patterns in the data and has good generalization capabilities. Figure 4 As shown in the figure, the total value of the loss function forms a time curve graph, which shows the changing trend of the loss value during training. By analyzing the loss curve, the training effect and convergence of the model can be evaluated.

[0050] In step S3, the prediction model is continuously trained and optimized until the precision, recall and F1 score of the prediction model are greater than or equal to a preset threshold, and the prediction model at this time is output;

[0051] like Figure 2 As shown, the accuracy, recall and F1 score of the prediction model are obtained through cross-validation: Accuracy , recall rate , F1 score ; TP (True Positive) indicates the number of patients correctly predicted by the model as high-risk (positive class), FP (False Positive) indicates the number of patients incorrectly predicted by the model as low-risk (negative class) as high-risk (positive class); FN (False Negative) indicates the number of samples incorrectly predicted by the model as high-risk (positive class) as low-risk (negative class). Preferably, Figure 3 As shown in Figure 1, the confusion matrix formed by the number of true positives (TP), false positives (FP), true negatives (TN), and false negatives (FN) can intuitively understand the classification effect of the model. In this example, the true negatives (TN) can represent the number of patients correctly predicted as low risk.

[0052] Model performance was evaluated through cross-validation, using metrics such as precision, recall, and F1 score to measure model effectiveness. Specifically, precision measures the accuracy of the model's predictions of high-risk patients, while recall assesses the proportion of true high-risk patients correctly identified by the model. The F1 score, the harmonic mean of precision and recall, comprehensively considers the balance between these two. In this solution, the target precision, recall, and F1 score values ​​were 0.9, 0.9, and 0.92, respectively, to ensure that the model neither misses high-risk patients nor misdiagnoses low-risk patients when predicting hypertension risk. Cross-validation training and validation ensured the model's stability and generalization capabilities. After training, the trained prediction model was deployed to a cloud-based hypertension risk assessment platform. This platform uses an API to pass user input data to the prediction model and retrieve prediction results. Advantages of cloud-based deployment include dynamically scalable computing resources based on demand, efficient prediction services, and user-friendly, anytime, anywhere access to prediction capabilities. Furthermore, the platform features data encryption and user privacy protection mechanisms to ensure the security and privacy of patient data. Once trained, the predictive model is deployed in the cloud. The risk assessment platform accesses the model via an API, and patients manually enter their data for hypertension risk prediction. During deployment, the platform's API supports efficient data exchange and real-time delivery of prediction results.

[0053] S4: Input sample information into the prediction model to obtain hypertension prediction results. Patients manually enter sample data through the risk assessment platform, which is then fed into the prediction model to predict hypertension risk. Patients access the risk assessment platform via the front-end website or mobile app and manually enter their sample data, such as recent physical examination results. The platform preprocesses this input data, including normalization and encoding, before passing it to the hypertension risk prediction model deployed in the cloud. After receiving the data, the prediction model calculates a hypertension risk prediction and returns the prediction results to the patient in the form of probabilities. The prediction results may include the probability of hypertension, recommended preventive measures, and health management recommendations. The accuracy of the prediction results is evaluated. If the prediction is incorrect, the data is used as a training set to further optimize the prediction model. The optimization process includes data cleaning, feature selection, and model hyperparameter adjustment to improve the overall model performance. If the prediction is correct, the data is included in the information collection database for the next round of model training.

[0054] In this solution, based on the prediction model's results, rules can be designed to stratify patients' hypertension risk into high, medium, and low risk categories, providing personalized health management recommendations for each risk level. Based on the prediction results, appropriate health intervention plans can be developed, such as dietary adjustments, increased exercise, or regular blood pressure monitoring.

[0055] Regularly optimize and update the prediction model. To maintain the accuracy and adaptability of the model's predictions, the platform needs to regularly collect patient input data and actual condition information to form a continuously updated database. The platform will regularly evaluate model performance, analyze the model's predictions on new data, and identify and correct deviations in the predictions. If a significant deviation is found between the predicted results and the actual situation, the new data will be incorporated into the training set for further training and optimization of the prediction model. This continuous optimization process ensures that the prediction model can maintain high-precision prediction capabilities over time. In addition, new data will also be included in the information collection library to enrich the training data set and support future model updates. Specifically, the platform regularly collects patient input data and compares it with the prediction model's prediction results to evaluate the prediction accuracy of the prediction model; this evaluation is performed through cross-validation. During the evaluation process, indicators such as confusion matrix, precision, recall rate, and F1 score are used to comprehensively analyze model performance.

[0056] In the hypertension prediction method based on random forest and LSTM neural network, a multi-layer perceptron MLP is used in combination with an LSTM neural network and an attention mechanism to capture the complex relationship between key features, and the probability of hypertension in an individual is predicted based on a weighted combination of these key features, thereby providing an efficient hypertension prediction tool for clinicians, helping to identify high-risk individuals and providing early intervention recommendations; this prediction method optimizes the prediction results by evaluating the impact of features on the occurrence of hypertension, achieves accurate prediction of individual disease risks, and provides reliable data support and personalized management plans for health management and clinical decision-making.

[0057] The embodiments of the present invention are described in detail above with reference to the accompanying drawings, but the present invention is not limited to the described embodiments. It is apparent to those skilled in the art that various changes, modifications, substitutions, and variations to these embodiments may be made without departing from the principles and spirit of the present invention, and these changes and modifications still fall within the scope of protection of the present invention.

Claims

1. A hypertension prediction method based on random forest and LSTM neural network, characterized in that: The following steps are involved: S1: Obtain the patient's sample information and establish an information collection database; pre-process the sample information in the information collection database; S2: Performing feature importance analysis on the preprocessed sample information through random forest, so as to screen out features that have an impact on hypertension prediction from the preprocessed sample information as key features based on the feature importance analysis; S3: The attention mechanism is used to calculate the weight of each key feature and generate a weighted feature representation. The weighted feature representation is sorted by weight to form sequence data. The weighted feature representation is then input into an LSTM neural network to capture the dynamic features in the sequence data and generate a context vector. Finally, the context vector is input into a multi-layer perceptron (MLP) for prediction output. Based on the predicted output and the true value, the MLP, attention mechanism, and LSTM neural network are optimized to obtain a prediction model. In step S3, a loss function is calculated by predicting the output and the true value, and then the gradient of the loss function with respect to the parameters of the multilayer perceptron MLP, the gradient of the parameters of the attention mechanism, and the gradient of the parameters of the LSTM neural network are calculated in sequence by a back propagation algorithm to optimize the parameters corresponding to the multilayer perceptron MLP, the attention mechanism, and the LSTM neural network; and a prediction model is formed using the multilayer perceptron MLP, the attention mechanism, and the LSTM neural network after parameter optimization; The steps for optimizing the parameters of the multi-layer perceptron MLP, attention mechanism and LSTM neural network are as follows: ;in is the updated parameter value, Indicates the parameter value of the current iteration, is the learning rate; for the multi-layer perceptron MLP, The loss function is the parameter of the multi-layer perceptron MLP Gradient ; For the attention mechanism, is the parameter of the loss function for the attention mechanism Gradient ; For LSTM neural network, The parameters of the LSTM neural network for the loss function Gradient ; Alternatively, the steps of optimizing the parameters corresponding to the multilayer perceptron MLP, attention mechanism, and LSTM neural network are: ;in is the updated parameter value, Indicates the parameter value of the current iteration, is the learning rate, Used to prevent division by zero errors; Corrected gradient first moment , , is the first-order moment estimate of the gradient in the current iteration, is the first-order moment estimate of the gradient in the previous iteration, is a hyperparameter that controls the decay rate of the first-order moment estimate, is the gradient of the current iteration; the modified gradient second-order moment , , is the second-order moment estimate of the gradient in the current iteration, is the second-order moment estimate of the gradient in the previous iteration, is a hyperparameter that controls the decay rate of the second-order moment estimate, is the square of the current gradient; for the multi-layer perceptron MLP, The loss function is the parameter of the multi-layer perceptron MLP Gradient ; For the attention mechanism, is the parameter of the loss function for the attention mechanism Gradient ; For LSTM neural network, The parameters of the LSTM neural network for the loss function Gradient ; S4: Input sample information into the prediction model to obtain hypertension prediction results.

2. The method for predicting hypertension based on random forest and LSTM neural network according to claim 1, characterized in that: In step S2, according to the pre-processed sample information Importance Sort them and set a threshold to filter out the importance Preprocessed sample information exceeding the threshold As a key feature; Based on the preprocessed sample information Importance Calculated by the following formula: ; T is the T decision trees that make up the random forest; represents the sample set used by the t-th tree, ; For the sample set Nodes in The proportion of samples in ; is the sample information after preprocessing Changes in the Gini coefficient due to division.

3. The method for predicting hypertension based on random forest and LSTM neural network according to claim 1, characterized in that: In step S3, the loss function is calculated for the parameters of the multi-layer perceptron MLP. The steps of the gradient are: ,in is the loss function, is the predicted output, parameter are the weights of the multi-layer perceptron MLP.

4. The method for predicting hypertension based on random forest and LSTM neural network according to claim 3, characterized in that: In step S3, the loss function is calculated for the parameters of the attention mechanism The steps of the gradient are: ,in is the loss function, is the weighted feature representation generated by the attention mechanism, and the parameter Used to reflect the accuracy of key feature capture.

5. The method for predicting hypertension based on random forest and LSTM neural network according to claim 4, characterized in that: In step S3, the loss function is calculated for the parameters of the LSTM neural network The steps of the gradient are: ,in is the loss function, is the hidden state or output of the LSTM neural network, and the parameters It is used to reflect the modeling ability of LSTM neural network on the global dependency of key features in the sequence.

6. The method for predicting hypertension based on random forest and LSTM neural network according to claim 5, characterized in that: In step S3, the loss function ,in Represents the total value of the loss function Represents the true value of the i-th sample information, Represents the predicted output of the i-th sample information, Indicates the total number of samples.

7. The method for predicting hypertension based on random forest and LSTM neural network according to claim 6, characterized in that: In step S3, the prediction model is continuously trained and optimized until the precision, recall and F1 score of the prediction model are greater than or equal to a preset threshold, and the prediction model at this time is output; Obtaining the precision, recall, and F1 score of the prediction model through cross-validation: Precision , recall rate , F1 score ; TP represents the number of patients correctly predicted by the model as high-risk, FP represents the number of patients whose low-risk condition was incorrectly predicted as high-risk by the model, and FN represents the number of samples whose high-risk condition was incorrectly predicted as low-risk by the model.

Citation Information

Patent Citations

  • Chinese text abstract generation method based on sequence-to-sequence model

    CN111078866A

  • Chronic disease risk assessment method and system based on multi-model algorithm

    CN115602325A