Hypertension prediction method based on random forest and LSTM neural network
By combining the hypertension prediction method with random forests, LSTM neural networks and attention mechanisms, the problem that traditional methods are difficult to accurately predict individual hypertension risks is solved, and accurate prediction of the probability of hypertension and personalized health management suggestions are achieved.
Patent Information
- Application Number
- CN202510133779.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-06
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2045-02-06
AI Technical Summary
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.
The hypertension prediction method based on random forests and LSTM neural networks is adopted to analyze the feature importance of random forests, and the features that have influence on hypertension prediction are screened out, and the weight of each feature is calculated through the attention mechanism, and the weighted feature representation is generated, and the dynamic features in the sequence data are inputted into the LSTM neural network to capture the dynamic features in the sequence data, and finally the prediction output is performed through the multi-layer perceptron MLP.
Accurate prediction of individual hypertension probability is achieved, efficient hypertension prediction tools are provided, helping to identify high-risk individuals and provide early intervention suggestions, optimize prediction results, and provide reliable data support and personalized management solutions for health management and clinical decision-making.
Smart Images

Figure CN119905261A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of medical data processing, and in particular to a hypertension prediction method based on random forest and LSTM neural network. Background Art
[0002] With the change of lifestyle and the 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 the quality of life of patients 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 laws in a large amount of complex data and make it difficult to accurately predict the risk of individual disease. Summary of the invention
[0003] In order to overcome the defects of the prior art, 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: S1: Obtain the patient's sample information and establish an information collection database; pre-process the sample information in the information collection database; S2: Perform feature importance analysis on the preprocessed sample information through random forest, so as to screen out the features that have influence on hypertension prediction from the preprocessed sample information as key features according to the feature importance analysis; S3: Calculate the weight of each key feature through the attention mechanism and generate a weighted feature representation, where the weighted feature representation is sorted by weight to form sequence data; then, input the weighted feature representation into the LSTM neural network to capture the dynamic features in the sequence data and generate a context vector through the LSTM neural network; finally, input the context vector into the multi-layer perceptron MLP for prediction output; optimize the multi-layer perceptron MLP, attention mechanism and LSTM neural network according to the predicted output and the true value to obtain a prediction model; S4: Input sample information into the prediction model to obtain hypertension prediction results.
[0005] It is worth noting that in step S2, according to the preprocessed sample information Importance Sort them and set a threshold to filter out the importance Preprocessed sample information exceeding this 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.
[0006] 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 prediction model is composed of the multilayer perceptron MLP, the attention mechanism, and the LSTM neural network after the parameter optimization.
[0007] 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, and the parameters is the weight of the multi-layer perceptron MLP.
[0008] Specifically, 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.
[0009] 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 in the sequence of key features.
[0010] Optionally, the step of optimizing the parameters corresponding to the multi-layer perceptron MLP, the attention mechanism and the 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; 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 .
[0011] Preferably, the step of optimizing the parameters corresponding to the multi-layer perceptron MLP, the attention mechanism and the 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; 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; Corrected gradient second 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 .
[0012] 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, Represents the total number of samples.
[0013] Specifically, in step S3, the prediction model is continuously trained and optimized until the accuracy, 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; 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 is incorrectly predicted by the model as high risk; FN represents the number of samples whose high risk is incorrectly predicted by the model as low risk.
[0014] The beneficial effects of the present invention are as follows: 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, an individual's probability of hypertension 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
[0015] Figure 1 A flowchart of a hypertension prediction method based on random forest and LSTM neural network in one embodiment of the present invention; Figure 2 is a schematic diagram of an evaluation model in one embodiment of the present invention; Figure 3 A confusion matrix diagram in one embodiment of the present invention; Figure 4 FIG. 4 is a loss curve diagram in one embodiment of the present invention. DETAILED DESCRIPTION
[0016] The specific embodiments of the present invention are further described below in conjunction with the accompanying drawings. It should be noted that the description of these embodiments is used to help understand the present invention, but 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 can be combined with each other as long as they do not conflict with each other.
[0017] like Figure 1-4 As shown, a hypertension prediction method based on random forest and LSTM neural network includes the following steps: S1: Obtain the patient's sample information and establish an information collection database; collect the patient's various physiological data and living habits information through health examinations or questionnaires, and establish a data set containing the patient's basic information and health indicators. The 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, glycosylated hemoglobin, high-density lipoprotein, and low-density lipoprotein; Preprocess the sample information in the information collection library, including processing missing values, feature scaling and standardization; use the mean to fill in the missing numerical data in the information collection library, and use the mode to fill in the missing non-numerical data; for example, standardize the patient's weight, height, blood pressure and other data, and convert the target variable "whether the patient is a hypertensive patient" into a binary label to meet the model input requirements; standardize and normalize the preprocessed sample information, and compress it using the MinMaxScaler saved during training to reduce the dimension or size of the data, so as to improve the training efficiency and performance of subsequent models; S2: Perform feature importance analysis on the preprocessed sample information through random forest, so as to screen out the features that have influence on hypertension prediction from the preprocessed sample information as key features according to the feature importance analysis; In step S2, the random forest is composed of The predictions of each decision tree are aggregated through an integrated method to finally obtain an optimal prediction result. In order to screen out the representative features for hypertension prediction, based on the preprocessed sample information Importance Sort them and set a threshold to filter out the importance Preprocessed sample information exceeding this threshold As the key feature; the threshold can be adjusted through experiments, usually based on the percentage ranking of importance score or a fixed weight value for screening, the purpose of screening is to retain those features that have made significant contributions in predicting hypertension, to ensure 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 integrated 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 ; is the sample information after preprocessing Changes in the Gini coefficient due to division.
[0018] 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 a weighted feature representation is generated, wherein the weighted feature representation is sorted by 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, and 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, the attention mechanism and the LSTM neural network are optimized according to the prediction 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 model performance, 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 LST The context vector processed by the M neural network and the attention mechanism is input to the multi-layer perceptron MLP for the final prediction output; the multi-layer perceptron MLP, as a fully connected layer structure, further processes the feature representation obtained from the previous layer to output the final prediction result; in the prediction process, the model first passes the input data through each layer of the network in sequence through forward propagation, including the LSTM neural network, the attention mechanism and the multi-layer perceptron MLP; the result of the forward propagation is the output prediction value of the model; in this process, the attention mechanism weights the features to focus on the most relevant features, the LSTM neural network captures sequence dependencies, and the multi-layer perceptron MLP is used to integrate features and generate the final prediction output. It is worth noting that the prediction model obtained by combining the multi-layer perceptron MLP with the LSTM neural network and the attention mechanism will consist of multiple fully connected layers and attention layers, which can effectively capture the complex relationship between features.
[0019] Specifically, in step 3, the training of the LSTM neural network uses residual connections and bidirectional LSTM structures to improve the learning ability and accuracy of the model. Specifically, the residual connection adds the output of the previous layer inside the LSTM neural network to the output of the current layer inside the LSTM neural network to avoid the gradient vanishing problem that may occur in deep networks, thereby improving the training effect; The formula for the residual connection is: ;in, is the output after adding the current layer, 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 LSTM neural network, such as ReLU or tanh. Residual connection helps the model learn deeper features and maintain the stability of the network by enhancing information transmission. At the same time, the bidirectional LSTM structure introduces two-way processing in the LSTM neural network: forward and backward to form context, so that it can make full use of the information on both sides of the input feature. Although time series prediction is not involved here, the introduction of the bidirectional LSTM structure can still help the LSTM neural network learn the relationship between features more comprehensively. Specifically, the bidirectional LSTM structure processes the input features from both the forward and backward directions at the same time, allowing the LSTM neural network to comprehensively utilize the contextual information of the features, thereby further improving the comprehensiveness of feature learning and the performance of the model.
[0020] In the step S3, the loss function is calculated by predicting the output and the true value, and then the gradient of the loss function 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 parameters related to cell state) are calculated in sequence through the back propagation algorithm, so as to achieve the purpose of forwarding the gradient layer by layer, so as 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.
[0021] 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, and the parameters is the weight of the multi-layer perceptron MLP.
[0022] In step S3, the gradient is passed to the attention mechanism, and 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 and optimize It can capture key features more accurately and improve the rationality of feature weighting.
[0023] 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 in the sequence of key features, so it is optimized It can enhance the LSTM neural network's ability to model global dependencies in sequence data.
[0024] In one embodiment, the step of optimizing the parameters corresponding to the multilayer perceptron MLP, the attention mechanism and the 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, 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, thereby gradually approaching the minimum value of the loss function. By back-propagating the gradient, the model can identify the degree of influence of each layer parameter on the final loss, and adjust the corresponding weights and biases to optimize the performance of the model.
[0025] In another embodiment, the step of optimizing the parameters corresponding to the multilayer perceptron MLP, the attention mechanism and the LSTM neural network in step S3 using the Adam optimizer is 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; 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 (usually 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 exponential weighted averaging, Adam can take into account the gradient information of the previous rounds of updates, thereby smoothing the update process; Corrected gradient second 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 (usually 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; 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 this embodiment, Adam is an adaptive optimization algorithm that combines momentum and learning rate adaptive adjustment at each update, avoiding the problem of falling into local optimum and unstable update in traditional gradient descent; 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. 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 corrected gradient first-order moment and the corrected gradient second moment The parameter optimization process is repeated over multiple epochs, and the model loss is gradually reduced, thereby improving the model's prediction accuracy.
[0026] In step S3, the loss function is the cross entropy loss: ,in Represents the total value of the loss function, which measures the predicted output With the true value , where both the predicted output and the true value are 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 constitutes a time curve graph, which shows the changing trend of the loss value during the training process. By analyzing the loss curve, the training effect and convergence of the model can be evaluated.
[0027] In step S3, the prediction model is continuously trained and optimized until the accuracy, 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; 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 whose low risk (negative class) is incorrectly predicted by the model as high risk (positive class); FN (False Negative) indicates the number of samples whose high risk (positive class) is incorrectly predicted by the model as low risk (negative class). Preferably, Figure 3 As shown in FIG. 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 embodiment, the true negatives (TN) can represent the number of patients correctly predicted to be low risk.
[0028] The model performance was evaluated through cross-validation, and the effect of the model was measured using indicators such as precision, recall, and F1 score. Specifically, precision is used to measure the accuracy of the model when predicting high-risk patients, recall evaluates how many of all real high-risk patients the model can correctly identify, and F1 score is the harmonic mean of precision and recall, which comprehensively considers the balance between the two. In this scheme, the values of precision, recall, and F1 score are expected to reach or exceed 0.9, 0.9, and 0.92, respectively, to ensure that the model neither misses high-risk patients nor misdiagnoses too many low-risk patients when predicting hypertension risk. After cross-validation training and verification, the stability and generalization ability of the model are ensured. After training, the trained prediction model is deployed to the hypertension risk assessment platform in the cloud. The platform passes the user input data to the prediction model through the API interface and obtains the prediction results. The advantages of cloud deployment include: the computing resources can be dynamically expanded as needed, efficient prediction services are provided, and users can access the prediction function anytime and anywhere. In addition, the platform has data encryption and user privacy protection mechanisms to ensure the security and privacy of patient data. After training, the prediction model is deployed in the cloud, the risk assessment platform calls it through the API, and the patient manually enters data through the platform to predict the risk of hypertension. During the deployment process, the API provided by the platform supports efficient data interaction and real-time return of prediction results.
[0029] S4: Input sample information into the prediction model to obtain hypertension prediction results. Patients manually input sample data through the risk assessment platform, and the platform inputs it into the prediction model for hypertension risk prediction. Patients access the risk assessment platform through the front-end web page or mobile application and manually input their own sample data, such as sample data such as recent physical examination results. The platform preprocesses these input data, including normalization, encoding and other operations, and then passes them to the hypertension risk prediction model deployed in the cloud. After receiving the data, the prediction model performs a prediction calculation of hypertension risk and returns the prediction results to the patient in the form of probability. The prediction results may include the probability of hypertension, recommended preventive measures and health management recommendations. By evaluating the accuracy of the prediction results, if the prediction is wrong, 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 performance of the model. If the prediction is correct, the data is included in the information collection library for the next round of model training.
[0030] In this solution, based on the prediction results of the prediction model, rules can be designed to provide patients with stratification of hypertension risk, such as high risk, medium risk and low risk, and provide personalized health management suggestions for each risk level. According to the prediction results, corresponding health intervention plans are formulated, such as adjusting diet, increasing exercise or regularly monitoring blood pressure.
[0031] Regularly optimize and update the prediction model. In order to maintain the accuracy and adaptability of the model prediction, the platform needs to regularly collect the patient's input data and actual condition information to form a continuously updated database. The platform will regularly evaluate the model performance, analyze the model's prediction results on new data, and identify and correct the deviations in the prediction. If it is found that the prediction results are significantly different from the actual situation, these new data will be included in the training set to further train and optimize the prediction model. Through this continuous optimization process, it is ensured 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 provide support for future model updates. Specifically, the platform regularly collects the patient's input data and compares it with the prediction results of the prediction model to evaluate the prediction accuracy of the prediction model; the evaluation is carried out through cross-validation. During the evaluation process, confusion matrix, precision, recall, F1 score and other indicators are used to comprehensively analyze the model performance.
[0032] 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.
[0033] 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. For those skilled in the art, various changes, modifications, substitutions and variations of these embodiments are made without departing from the principles and spirit of the present invention, and 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: Perform feature importance analysis on the preprocessed sample information through random forest, so as to screen out the features that have influence on hypertension prediction from the preprocessed sample information as key features according to the feature importance analysis; S3: Calculate the weight of each key feature through the attention mechanism and generate a weighted feature representation, where the weighted feature representation is sorted by weight to form sequence data; then, input the weighted feature representation into the LSTM neural network to capture the dynamic features in the sequence data and generate a context vector through the LSTM neural network; finally, input the context vector into the multi-layer perceptron MLP for prediction output; optimize the multi-layer perceptron MLP, attention mechanism and LSTM neural network according to the predicted output and the true value to obtain a prediction model; S4: Input sample information into the prediction model to obtain hypertension prediction results.
2. A hypertension prediction method based on random forest and LSTM neural network according to claim 1, characterized in that: In step S2, according to the preprocessed sample information Importance Sort them and set a threshold to filter out the importance Preprocessed sample information exceeding this 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. A hypertension prediction method based on random forest and LSTM neural network according to claim 2, characterized in that: 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 through 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 the parameter optimization are used to form a prediction model.
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 multi-layer perceptron MLP. The steps of the gradient are: ,in is the loss function, is the predicted output, and the parameters is the weight of the multi-layer perceptron MLP.
5. A hypertension prediction method 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 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.
6. A hypertension prediction method based on random forest and LSTM neural network according to claim 5, 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 in the sequence of key features.
7. The method for predicting hypertension based on random forest and LSTM neural network according to claim 6, characterized in that: The steps of optimizing the parameters corresponding to the multi-layer perceptron MLP, attention mechanism and LSTM neural network in step S3 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 .
8. The method for predicting hypertension based on random forest and LSTM neural network according to claim 6, characterized in that: The steps of optimizing the parameters corresponding to the multi-layer perceptron MLP, attention mechanism and LSTM neural network in step S3 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; 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; Corrected gradient second 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 .
9. The method for predicting hypertension based on random forest and LSTM neural network according to claim 6, 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, Represents the total number of samples.
10. The method for predicting hypertension based on random forest and LSTM neural network according to claim 9, characterized in that: In step S3, the prediction model is continuously trained and optimized until the accuracy, 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; Obtaining the precision, recall, and F1 score of the prediction model through cross-validation: Precision , recall rate , F1 score ; Among them, TP represents the number of patients correctly predicted by the model as high risk, FP represents the number of patients whose low risk is incorrectly predicted by the model as high risk, and FN represents the number of samples whose high risk is incorrectly predicted by the model as low risk.
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
Prediction method for metal stamping forming process parameters
CN117743793A
Cardiovascular case data processing method and system
CN118471540A
Microchannel gas-liquid two-phase flow pattern prediction system and method based on neural network
CN119203849A