Vision change prediction method based on random forest algorithm

By optimizing the decision tree using the random forest algorithm and establishing a retraining mechanism, the problems of nonlinear relationships and individual differences in traditional vision change prediction methods are solved, achieving higher accuracy and adaptability in vision change prediction.

CN121565494APending Publication Date: 2026-02-24YUNNAN BIANFENG INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511759573.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-27
Publication Date
2026-02-24

AI Technical Summary

Technical Problem

Traditional methods for predicting vision changes are difficult to fully consider complex nonlinear relationships and individual differences. In particular, the prediction results for vision changes in pregnant women may be biased, and the data types are diverse and have problems such as missing data and noise.

Method used

The random forest algorithm is adopted to collect data related to vision changes, identify significant influencing features, optimize the decision tree, establish a retraining mechanism, handle data quality and adapt to individual and time changes, consider nonlinearity and interaction, reduce multicollinearity, and improve model stability and adaptability.

Benefits of technology

It improves the accuracy and reliability of vision change prediction, expands the application scope of the model, ensures the timeliness and universality of the model, and can more accurately capture the key factors of vision changes and reflect the latest medical advances.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121565494A_ABST
    Figure CN121565494A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of vision change prediction, in particular to a vision change prediction method based on a random forest algorithm. The method comprises the following steps: S1, collecting basic data related to vision change; s2, identifying features having significant influence on vision change by using a vision correlation method; s3, using a random forest as a prediction model, and training the prediction model through a retraining mechanism; and S4, performing vision change prediction on the new data by using the trained prediction model. According to the technology, through detailed data preprocessing steps including missing value removal or filling, abnormal value processing, data standardization or normalization and feature selection, the data quality and effectiveness of an input model are ensured, in addition, the vision correlation coefficient is optimized, and the accuracy of the vision correlation coefficient is improved. Particularly, the nonlinear relation and interaction among age, intraocular pressure and diopter are considered, so that the model can more accurately capture key influence factors of vision change.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of vision change prediction technology, and more specifically, to a vision change prediction method based on the random forest algorithm. Background Technology

[0002] Vision changes are influenced by a variety of factors, including but not limited to age, sex, genetic background, lifestyle habits, and eye diseases. These factors may interact in complex ways, and traditional statistical analysis methods often struggle to fully account for these complex relationships, especially nonlinear relationships and interactions. Individual patterns of vision change can vary significantly, particularly during specific physiological states such as pregnancy, where women's vision may change dramatically. Traditional prediction models may not adequately account for these individual differences, leading to biased predictions. Furthermore, vision change research involves diverse data types, including quantitative data (such as age and intraocular pressure) and qualitative data (such as sex and genetic history). In addition, data may contain missing information or be subject to noise. In summary, this paper presents a vision change prediction method based on the random forest algorithm. Summary of the Invention

[0003] The purpose of this invention is to provide a vision change prediction method based on the random forest algorithm to solve the problems of the complexity, data diversity and uncertainty of vision changes mentioned in the background art.

[0004] To achieve the above objectives, the present invention aims to provide a method for predicting vision changes based on the random forest algorithm, comprising the following steps:

[0005] S1. Collect basic data related to changes in vision;

[0006] S2. Use vision-related methods to identify features that have a significant impact on changes in vision;

[0007] S3. Use random forest as the prediction model, train the prediction model through a retraining mechanism, and optimize the decision tree in the random forest prediction model for vision changes during pregnancy.

[0008] S4. Apply the trained prediction model to predict changes in vision based on new data.

[0009] As a further improvement to this technical solution, in S1, the basic data related to changes in vision include: the age, gender, intraocular pressure, and refractive error of the researcher.

[0010] As a further improvement to this technical solution, in step S2, a vision-related method is used to identify features that have a significant impact on changes in vision, including the following steps:

[0011] S2.1 Preprocess the basic data;

[0012] S2.2 Calculate the correlation coefficient between all features and visual acuity changes using the visual acuity correlation coefficient. Considering that the relationship between age and intraocular pressure and visual acuity changes is non-linear, optimize the visual acuity correlation coefficient. Further optimize the visual acuity correlation coefficient for the interaction of age, intraocular pressure and refractive error.

[0013] S2.3 Set a threshold m and filter out features with a correlation coefficient greater than the threshold m;

[0014] S2.4. Based on the correlation coefficient and threshold m, select features that have a significant impact on visual acuity changes, and use the visual acuity factor method to detect multicollinearity among features.

[0015] As a further improvement to this technical solution, in S2.2, the visual acuity correlation coefficient is:

[0016] ;

[0017] Considering that the relationship between age, intraocular pressure, and visual acuity is non-linear, the correlation coefficient between visual acuity and these factors is optimized:

[0018] ;

[0019] Further optimization of the visual acuity correlation coefficient was performed to address the interaction between age, intraocular pressure, and refractive error.

[0020] ;

[0021] in, Indicates the correlation coefficient between visual acuity and visual perception; This represents the visual acuity correlation coefficient after considering the nonlinear effects of age and intraocular pressure on changes in visual acuity; The visual acuity correlation coefficient represents the interaction of age, intraocular pressure, and refractive error. Indicates the first The difference in the ranks of two variables in a sample; Indicates the number of samples; Indicates the sample index; Indicates the nonlinear adjustment parameter; The weights represent the interaction effects and are used to adjust the degree of influence of the interaction on the correlation coefficient. Indicates the first Interaction metrics for individual samples.

[0022] As a further improvement to this technical solution, step S2.4, which uses the visual factor method to detect multicollinearity among features, includes the following steps:

[0023] S2.41. For each continuous feature, construct a linear regression model with that feature as the target variable and all other features as independent variables.

[0024] S2.42 Calculate the coefficient of determination for the linear regression model;

[0025] S2.43. Calculate the visual factor value of this feature based on the coefficient of determination;

[0026] S2.44. Set a visual acuity factor threshold k, and determine the severity of multicollinearity based on the visual acuity factor value;

[0027] S2.45. If the visual factor value of a feature exceeds the set threshold k, then remove the feature.

[0028] As a further improvement to this technical solution, in step S3, a random forest is used as the prediction model, and a mechanism is established to periodically retrain the prediction model, including the following steps:

[0029] S3.1 Determine the number of trees in the random forest, the maximum depth of each decision tree, and the number of features used to find the best split; then standardize the features.

[0030] S3.2. The collected basic data related to vision changes are divided into training set and test set, and the data on the training set is used to train the random forest model.

[0031] S3.3 Use the test set to evaluate the prediction accuracy of the model and calculate the mean squared error of the evaluation index;

[0032] S3.4. Set up a retraining mechanism to train the prediction model.

[0033] As a further improvement to this technical solution, step S3.2, which uses data from the training set to train a random forest model, includes the following steps:

[0034] S3.21. Randomly select samples from the training set, with each sample having an equal probability of being selected, and return the samples after each selection.

[0035] S3.22. For each node, randomly select a subset from all features, and then select features from this subset for splitting;

[0036] S3.23. Based on the selected features and samples, recursively construct a decision tree until the set maximum depth h is reached. Optimize the decision tree for changes in vision during pregnancy and ensure that the optimized decision tree performs stably in different age groups.

[0037] As a further improvement to this technical solution, in S3.23, the decision tree is as follows:

[0038] ;

[0039] The decision tree was optimized to account for changes in vision during pregnancy.

[0040] ;

[0041] To ensure the optimized decision tree performs stably across different age groups:

[0042] ;

[0043] in, Representing a decision tree; This represents a decision tree that addresses changes in vision during pregnancy. This represents a decision tree that demonstrates stable performance across different age groups. This represents a basic dataset related to changes in vision; This indicates that the attribute is being considered for use as a split node; Represents the basic dataset Information entropy; Represents attributes The size of the value range; Represents attributes The specific value; Represents the basic dataset In, attributes Values A subset of; Representing a subset The number of samples in the sample; Representing a subset Information entropy; Indicates the weight of pregnancy; Indicates the index of the sample; An adjustment factor representing the age of the group; Indicates the age of the group.

[0044] As a further improvement to this technical solution, in step S3.4, a retraining mechanism is set to train the prediction model, including the following steps:

[0045] S3.41. Define each quarter as the retraining cycle, and set it to automatically trigger retraining when the amount of new data reaches a threshold p;

[0046] S3.42. At the beginning of each retraining cycle, collect new data accumulated since the last retraining and preprocess and standardize the new data.

[0047] S3.43. Merge the new data with the old data and re-divide them into training and test sets;

[0048] S3.44. Retrain the random forest model using a new training set, readjusting the number of trees, the maximum depth of each decision tree, and the number of features used to find the best split.

[0049] As a further improvement to this technical solution, in step S4, the trained prediction model is used to predict changes in vision based on new data, including the following steps:

[0050] S4.1 Prepare the new dataset;

[0051] S4.2 Perform the same feature standardization process on the new data, and use the standardization parameters of the training data to standardize the new dataset;

[0052] S4.3 Load the pre-trained random forest model;

[0053] S4.4 Use the trained model to predict new data and obtain the predicted value of vision change.

[0054] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0055] 1. This vision change prediction method based on the random forest algorithm ensures the quality and effectiveness of the input data through detailed data preprocessing steps, including removing or imputing missing values, handling outliers, data standardization or normalization, and feature selection. Furthermore, by optimizing the vision correlation coefficient, particularly considering the nonlinear relationship and interaction between age, intraocular pressure, and refractive error, and by introducing weight adjustments for pregnancy status during decision tree construction, the model can more accurately capture the key influencing factors of vision changes, thereby improving the accuracy and reliability of predictions.

[0056] 2. In this vision change prediction method based on the random forest algorithm, a periodic retraining mechanism is established, allowing the model to be continuously updated with the accumulation of time and new data, ensuring the model's timeliness and adaptability. This dynamic update mechanism not only considers individual vision changes over time but also reflects the latest advances in medical research, keeping the model in optimal condition. Furthermore, by incorporating age group adjustment coefficients into the decision tree construction, the model's stable performance across different age groups is ensured, thereby expanding its application scope and improving its universality. Attached Figure Description

[0057] Figure 1 This is a flowchart of the overall method of the present invention. Detailed Implementation

[0058] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0059] Example: Please refer to Figure 1 As shown, this embodiment provides a method for predicting vision changes based on the random forest algorithm, including the following steps:

[0060] S1. Collect basic data related to changes in vision;

[0061] In this embodiment, the basic data related to changes in vision include: the age, gender, intraocular pressure, and refractive error of the researcher.

[0062] S2. Use vision-related methods to identify features that have a significant impact on changes in vision;

[0063] In this embodiment, a vision-related method is used to identify features that have a significant impact on changes in vision, including the following steps:

[0064] S2.1. Preprocess the basic data, remove or fill missing values, handle outliers, ensure data quality, use one-hot coding to convert non-numerical data (such as gender) into numerical form, and standardize or normalize the numerical features so that features of different magnitudes can be compared on the same scale.

[0065] S2.2 Calculate the correlation coefficient between all features and visual acuity changes using the visual acuity correlation coefficient. Considering that the relationship between age and intraocular pressure and visual acuity changes is non-linear, optimize the visual acuity correlation coefficient. Further optimize the visual acuity correlation coefficient for the interaction of age, intraocular pressure and refractive error.

[0066] The visual acuity correlation coefficient is a statistical measure used to quantify the strength of the relationship between different characteristics (such as age, intraocular pressure, and refractive error) and changes in visual acuity; the visual acuity correlation coefficient is:

[0067] ;

[0068] The relationship between age, intraocular pressure (IOP), and visual acuity changes is often non-linear, and traditional linear correlation coefficients may not accurately capture these non-linear relationships. Optimizing the visual acuity correlation coefficient can more accurately identify features that significantly influence visual acuity changes, thereby improving the model's predictive accuracy. This helps the model better understand the actual impact of age and IOP on visual acuity changes. The optimized visual acuity correlation coefficient can more sensitively capture subtle changes in visual acuity caused by age and IOP, thus improving the model's sensitivity and helping to detect signs of visual acuity changes earlier. Considering the non-linear relationship between age, IOP, and visual acuity changes, the visual acuity correlation coefficient is optimized as follows:

[0069] ;

[0070] As we age, changes may occur in the intraocular structures, such as hardening of the lens and slowed aqueous humor circulation. These changes can lead to increased intraocular pressure (IOP). Simultaneously, the elasticity of blood vessels weakens in older adults, making IOP fluctuations more pronounced. The combined effect of age and elevated IOP may increase the risk of vision loss. For example, high IOP can cause more severe optic nerve damage in older adults, thus accelerating vision decline. As we age, the lens loses elasticity, leading to decreased accommodative ability, which may cause presbyopia (hyperopia) or worsening myopia. The combined effect of age and changes in refractive error may also increase the risk of vision loss; for example, changes in refractive error may be more significant in older adults, leading to faster vision decline. Changes in IOP can affect the shape of the eyeball, thus affecting refractive error. High IOP may cause the eyeball to elongate, leading to worsening myopia. The combined effect of elevated IOP and changes in refractive error may increase the risk of vision loss; for example, high IOP may cause refractive instability, further affecting vision. The interaction between age, IOP, and refractive error can have complex effects on changes in vision. Traditional methods may not fully capture these interaction effects. By further optimizing the visual acuity correlation coefficient, these interaction effects can be identified and quantified more accurately, thereby improving the model's predictive ability. To further enhance the model's predictive ability, the interaction between age, intraocular pressure, and refractive error is considered by introducing an adjustment coefficient for the interaction. and interaction indicators Further optimization of the visual acuity correlation coefficient can more clearly demonstrate the interactions between different factors, improving the model's interpretability. By considering interactions, the model's bias towards single factors can be reduced, making the model more accurate and reliable when handling complex data, which helps improve the model's generalization ability. The visual acuity correlation coefficient is further optimized to address the interactions between age, intraocular pressure, and refractive error.

[0071] ;

[0072] ;

[0073] ;

[0074] ;

[0075] ;

[0076] in, Indicates the correlation coefficient between visual acuity and visual perception; This represents the visual acuity correlation coefficient after considering the nonlinear effects of age and intraocular pressure on changes in visual acuity; The visual acuity correlation coefficient represents the interaction of age, intraocular pressure, and refractive error. Indicates the first The difference in the ranks of two variables in a sample; Indicates the number of samples; the samples are those studied by researchers. Indicates the sample index; This represents a nonlinear adjustment parameter used to control the degree of influence of the nonlinear relationship. Positive values ​​of α mean that larger differences in rank have a greater impact on the correlation coefficient, while negative values ​​have the opposite effect. The weights represent the interaction effects and are used to adjust the degree of influence of the interaction on the correlation coefficient. Indicates the first Interaction metrics for individual samples; This indicates the strength of the interaction between age and intraocular pressure; It indicates the strength of the interaction between intraocular pressure and refractive error; This indicates the strength of the interaction between age and refractive error; Indicates age; Indicates intraocular pressure; Indicates diopter; This indicates the degree of influence of the interaction between age and intraocular pressure on changes in visual acuity. This indicates the degree to which age alone affects changes in vision; This indicates the degree of influence of the interaction between intraocular pressure and refractive error on changes in visual acuity. This indicates the degree to which intraocular pressure alone affects changes in visual acuity; This indicates the degree of influence of the interaction between age and refractive error on changes in visual acuity. This indicates the degree of influence of refractive error alone on changes in visual acuity;

[0077] Further steps to optimize the visual acuity correlation coefficient are as follows: First, calculate the rank difference between each variable (age, intraocular pressure, refractive error) and the change in visual acuity based on the raw data. Considering the interaction between age, intraocular pressure, and refractive error, a new comprehensive grade difference is defined. It includes not only the effects of individual variables, but also the effects of interaction terms, where: ;

[0078] Specifically, , and These are the grade differences between age, intraocular pressure, and refractive error and changes in visual acuity. , , and The weights of the interaction terms are estimated using statistical methods such as regression analysis; the overall grade difference is adjusted using the logistic function (a non-linear transformation). To better capture nonlinear relationships: , here This is an adjustment parameter; finally, the optimized overall grade difference is used. Calculate the visual correlation coefficient : ;

[0079] S2.3 Set a threshold m (e.g., 0.3 or 0.5) to filter out features with a correlation coefficient greater than the threshold m;

[0080] S2.4. Based on the correlation coefficient and threshold m, select features that have a significant impact on visual acuity changes, and use the visual acuity factor method to detect multicollinearity among features, avoiding the selection of highly correlated features;

[0081] Furthermore, the visual factor method effectively identifies and addresses multicollinearity by transforming the original features into a set of orthogonal principal components. Multicollinearity refers to a high degree of correlation between independent variables, which can lead to unstable model estimation and difficulty in interpreting parameters. The visual factor method can identify which features exhibit multicollinearity, thus avoiding these problems. Multicollinearity causes unstable estimation of model parameters, resulting in decreased predictive power. By detecting and addressing multicollinearity, the stability and predictive accuracy of the model can be improved. The visual factor method for detecting multicollinearity among features includes the following steps:

[0082] S2.41. For each continuous feature (because the visual acuity factor is mainly applicable to continuous variables), construct a linear regression model with that feature as the target variable and all other features as independent variables: ;

[0083] S2.42 Calculate the coefficient of determination for the linear regression model The coefficient of determination represents the explanatory power of the independent variable for the target variable, and its value ranges from 0 to 1. The closer the value is to 1, the better the model fits.

[0084] S2.43. Calculate the visual factor value of this feature based on the coefficient of determination. , It is the first Features The coefficient of determination of a linear regression model when the target variable is used;

[0085] S2.44. Set a visual factor threshold k. Determine the severity of multicollinearity based on the visual factor value. If the visual factor value of a feature exceeds 10, the feature is considered to have a severe multicollinearity problem. If the visual factor value is between 5 and 10, the feature is considered to have a moderate degree of multicollinearity. If the visual factor value is less than 5, the multicollinearity problem is not obvious.

[0086] S2.45. If the visual factor value of a feature exceeds the set threshold k, then remove the feature.

[0087] S3. Use random forest as the prediction model and train the prediction model through a retraining mechanism;

[0088] In this embodiment, random forest, by integrating multiple decision trees, can reduce the risk of overfitting from a single decision tree, thereby improving the model's prediction accuracy. Vision change prediction involves multiple features (such as age, intraocular pressure, and refractive error), and random forest can effectively handle high-dimensional data and capture the complex relationships between features. Through random sampling and feature selection, random forest improves the model's robustness and generalization ability, ensuring stable performance even with different data distributions. Using random forest as the prediction model and establishing a mechanism to periodically retrain the model includes the following steps:

[0089] S3.1 Determine the number of trees in the random forest, the maximum depth of each decision tree, and the number of features used to find the best split (the number of trees is usually set relatively large to reduce the risk of overfitting; the maximum depth needs to be adjusted according to the specific problem, as too deep a depth may lead to overfitting; the number of features can be the square root or logarithm of all features, which helps to improve the model's generalization ability). Standardize the features to ensure that data of different scales does not affect the model's learning performance. Since vision-related data may contain variables of different dimensions (such as age, intraocular pressure, etc.), it is essential to standardize the features before inputting them into the model.

[0090] S3.2. The collected basic data related to vision changes are divided into training set and test set, and the data on the training set is used to train the random forest model.

[0091] The process of training a random forest model using data from the training set includes the following steps:

[0092] S3.21. Randomly select samples from the training set. Each sample has an equal probability of being selected, and the sample is replaced after each selection. Therefore, some samples may be selected multiple times, while some samples may not be selected at all. The number of samples selected is the same as the number of samples in the original training set. This ensures that each tree has enough data to learn.

[0093] S3.22. For each node, randomly select a subset from all features (the size of the selected feature subset is the square root or logarithm of all features, which helps to improve the generalization ability of the model and reduce overfitting), and then select features from this subset for splitting.

[0094] S3.23. Based on the selected features and samples, recursively construct a decision tree until the set maximum depth h is reached (if the number of samples in the current node is less than a certain threshold (such as 1 or 2), stop splitting and mark the node as a leaf node; if all samples in the current node belong to the same category (or have the same target value), stop splitting and mark the node as a leaf node; if the depth of the current node reaches the set maximum depth h, stop splitting and mark the node as a leaf node; at the current node, divide the samples into multiple child nodes according to the selected best features, repeat the above process for each child node, and recursively construct a subtree). Optimize the decision tree for vision changes during pregnancy and ensure that the optimized decision tree performs stably in different age groups.

[0095] Furthermore, a decision tree is a supervised learning algorithm that constructs a tree structure by recursively splitting the dataset. Each internal node represents a test on a feature, and each leaf node represents a prediction. A decision tree is as follows:

[0096] ;

[0097] Vision changes during pregnancy can differ from those at other times, influenced by various factors such as hormone levels and weight changes. During pregnancy, estrogen and progesterone levels rise significantly. These hormones can affect the structure and function of the eye, leading to increased corneal thickness and changes in tear composition. Elevated prolactin levels may also affect tear secretion, causing dry eye syndrome. Increased water retention during pregnancy can lead to corneal edema, affecting corneal transparency and refractive index, causing blurred vision. Optimizing the decision tree ensures the model can more accurately capture these specific vision change characteristics. By introducing weights and adjustment coefficients for pregnancy status, the impact of pregnancy status on vision changes can be more clearly demonstrated, improving the model's interpretability and helping doctors and researchers better understand the mechanisms of vision changes during pregnancy. Optimizing the decision tree better adapts to these specific patterns, thereby improving the model's predictive accuracy in pregnant women. The following optimizations were made to the decision tree specifically for vision changes during pregnancy:

[0098] ;

[0099] The characteristics and patterns of vision changes may differ across age groups. Optimizing the decision tree to ensure stable performance across different age groups guarantees high predictive accuracy when dealing with data from various age groups. Age is a significant influencing factor, and vision change patterns may vary significantly across different age groups. By optimizing the decision tree, bias towards a specific age group can be reduced, resulting in more balanced performance across all age groups. The optimized decision tree demonstrates stable performance across different age groups, thereby improving the overall predictive accuracy of the model. This helps to more accurately predict vision changes in individuals of different ages. Ensuring the optimized decision tree performs stably across different age groups is crucial.

[0100] ;

[0101] in, The information gain in a decision tree measures the reduction in information entropy before and after splitting a dataset according to a certain feature. The greater the information gain, the better the feature splits the dataset, meaning the more important the feature is for classification tasks. This represents a decision tree that addresses changes in vision during pregnancy. This represents a decision tree that demonstrates stable performance across different age groups. This represents a basic dataset related to changes in vision; This indicates that the attribute is being considered for use as a split node; Represents the basic dataset Information entropy is a metric that measures the uncertainty of a dataset; Represents attributes The size of the value range, i.e., the attribute The number of different values ​​that can be taken; Represents attributes The specific value; Represents the basic dataset In, attributes Values A subset of; Representing a subset The number of samples in the sample; Representing a subset Information entropy; Indicates the weight of pregnancy; Indicates the index of the sample; An adjustment factor representing the age of the group; Indicates the age of the group;

[0102] Furthermore, for each age group Calculate the mean square error of the model Use formula Calculate the initial adjustment factor for each age group; find the minimum adjustment factor for all age groups. and maximum value Using the normalization formula Calculate the normalized adjustment coefficient;

[0103] S3.3 Use the test set to evaluate the prediction accuracy of the model and calculate the mean squared error of the evaluation index;

[0104] S3.4. Set up a retraining mechanism to train the prediction model. As time goes by, an individual's vision may change, and new research findings may also affect our understanding of vision changes. Therefore, it is very important to set a reasonable model retraining cycle. This can not only ensure that the model can adapt to the latest data trends, but also capture any potential changes in a timely manner. Each time it is retrained, the feature selection process should be reconsidered to ensure that the model can be continuously optimized and always trained based on the latest and most accurate data.

[0105] Furthermore, an individual's vision may change over time, and new research findings may also influence our understanding of vision changes. Regular retraining ensures that the model is always trained on the latest data, thus maintaining its timeliness and accuracy. Data distribution changes over time; for example, the emergence of new medical technologies or treatments may alter patterns of vision changes. Regular retraining helps the model adapt to these changes, improving its robustness and generalization ability. Regular retraining mechanisms allow the model to dynamically adapt to new data, ensuring that it reflects the latest data trends in a timely manner. This is particularly important for predictive models in the medical field because medical data is updated rapidly, with new cases and research results constantly emerging. Setting up a retraining mechanism to train the predictive model includes the following steps:

[0106] S3.41. Define each quarter as the retraining cycle, and set it to automatically trigger retraining when the amount of new data reaches a threshold p;

[0107] S3.42 At the beginning of each retraining cycle, collect new data accumulated since the last retraining. The new data should include all the latest information related to changes in vision, such as new patient records, updated medical research results, etc., and preprocess and standardize the new data to ensure the quality of the new data and exclude outliers and incomplete records.

[0108] S3.43. Merge the new data with the old data and re-divide them into training and test sets, ensuring that the ratio of training and test sets is the same as that of the initial model, so as to maintain the consistency and comparability of the evaluation.

[0109] S3.44. Retrain the random forest model using a new training set, readjusting the number of trees, the maximum depth of each decision tree, and the number of features used to find the best split to optimize model performance.

[0110] S4. Apply the trained prediction model to predict changes in vision based on new data.

[0111] Applying a trained prediction model to predict changes in vision on new data includes the following steps:

[0112] S4.1 Prepare a new dataset, ensuring that the features of the new data are consistent with those of the training dataset. The new data includes the following information: age, gender, pregnancy status, intraocular pressure, and refractive error.

[0113] S4.2 Perform the same feature standardization process on the new data to ensure that the features of the new data are on the same scale as the features of the training data. Standardize the new dataset using the standardization parameters of the training data (such as mean and standard deviation).

[0114] S4.3 Load the pre-trained random forest model, ensuring that the model file is saved intact, including the model's structure and parameters;

[0115] S4.4 Use the trained model to predict new data and obtain the predicted value of vision change.

[0116] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely preferred examples and are not intended to limit the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the claimed invention.

Claims

1. A method for predicting vision changes based on the random forest algorithm, characterized in that, Includes the following steps: S1. Collect basic data related to changes in vision; S2. Use vision-related methods to identify features that have a significant impact on changes in vision; S3. Use random forest as the prediction model, train the prediction model through a retraining mechanism, and optimize the decision tree in the random forest prediction model for vision changes during pregnancy. S4. Apply the trained prediction model to predict changes in vision based on new data.

2. The vision change prediction method based on random forest algorithm according to claim 1, characterized in that: In S1, the basic data related to changes in vision include: the age, gender, intraocular pressure, and refractive error of the researcher.

3. The vision change prediction method based on random forest algorithm according to claim 2, characterized in that: In step S2, a vision-related method is used to identify features that have a significant impact on changes in vision, including the following steps: S2.1 Preprocess the basic data; S2.2 Calculate the correlation coefficient between all features and visual acuity changes using the visual acuity correlation coefficient. Considering that the relationship between age and intraocular pressure and visual acuity changes is non-linear, optimize the visual acuity correlation coefficient. Further optimize the visual acuity correlation coefficient for the interaction of age, intraocular pressure and refractive error. S2.3 Set a threshold m and filter out features with a correlation coefficient greater than the threshold m; S2.

4. Based on the correlation coefficient and threshold m, select features that have a significant impact on visual acuity changes, and use the visual acuity factor method to detect multicollinearity among features.

4. The vision change prediction method based on random forest algorithm according to claim 3, characterized in that: In S2.2, the visual acuity correlation coefficient is: ; Considering that the relationship between age, intraocular pressure, and visual acuity is non-linear, the correlation coefficient between visual acuity and these factors is optimized: ; Further optimization of the visual acuity correlation coefficient was performed to address the interaction between age, intraocular pressure, and refractive error. ; in, Indicates the correlation coefficient between visual acuity and visual perception; This represents the visual acuity correlation coefficient after considering the nonlinear effects of age and intraocular pressure on changes in visual acuity; The visual acuity correlation coefficient represents the interaction of age, intraocular pressure, and refractive error. Indicates the first The difference in the ranks of two variables in a sample; Indicates the number of samples; Indicates the sample index; Indicates the nonlinear adjustment parameter; The weights represent the interaction effects and are used to adjust the degree of influence of the interaction on the correlation coefficient. Indicates the first Interaction metrics for individual samples.

5. The vision change prediction method based on random forest algorithm according to claim 4, characterized in that: In step S2.4, the detection of multicollinearity among features using the visual factor method includes the following steps: S2.

41. For each continuous feature, construct a linear regression model with that feature as the target variable and all other features as independent variables. S2.42 Calculate the coefficient of determination for the linear regression model; S2.

43. Calculate the visual factor value of this feature based on the coefficient of determination; S2.

44. Set a visual acuity factor threshold k, and determine the severity of multicollinearity based on the visual acuity factor value; S2.

45. If the visual factor value of a feature exceeds the set threshold k, then remove the feature.

6. The vision change prediction method based on random forest algorithm according to claim 5, characterized in that: In step S3, a random forest is used as the prediction model, and a mechanism is established to periodically retrain the model, including the following steps: S3.1 Determine the number of trees in the random forest, the maximum depth of each decision tree, and the number of features used to find the best split; then standardize the features. S3.

2. The collected basic data related to vision changes are divided into training set and test set, and the data on the training set is used to train the random forest model. S3.

3. Use the test set to evaluate the predictive accuracy of the model; S3.

4. Set up a retraining mechanism to train the prediction model.

7. The vision change prediction method based on random forest algorithm according to claim 6, characterized in that: In step S3.2, training a random forest model using data from the training set includes the following steps: S3.

21. Randomly select samples from the training set, with each sample having an equal probability of being selected, and return the samples with replacement after each selection. S3.

22. For each node, randomly select a subset from all features, and then select features from this subset for splitting; S3.

23. Based on the selected features and samples, recursively construct a decision tree until the set maximum depth h is reached. Optimize the decision tree for changes in vision during pregnancy and ensure that the optimized decision tree performs stably in different age groups.

8. The vision change prediction method based on random forest algorithm according to claim 7, characterized in that: In S3.23, the decision tree is as follows: ; The decision tree was optimized to account for changes in vision during pregnancy. ; To ensure the optimized decision tree performs stably across different age groups: ; in, Representing a decision tree; This represents a decision tree that addresses changes in vision during pregnancy. This represents a decision tree that demonstrates stable performance across different age groups. This represents a basic dataset related to changes in vision; This indicates that the attribute is being considered for use as a split node; Represents the basic dataset Information entropy; Represents attributes The size of the value range; Represents attributes The specific value; Represents the basic dataset In, attributes Values A subset of; Representing a subset The number of samples in the sample; Representing a subset Information entropy; Indicates the weight of pregnancy; Indicates the index of the sample; An adjustment factor representing the age of the group; Indicates the age of the group.

9. The vision change prediction method based on random forest algorithm according to claim 8, characterized in that: In step S3.4, a retraining mechanism is set up to train the prediction model, including the following steps: S3.

41. Define each quarter as the retraining cycle, and set it to automatically trigger retraining when the amount of new data reaches a threshold p; S3.

42. At the beginning of each retraining cycle, collect new data accumulated since the last retraining and preprocess and standardize the new data. S3.

43. Merge the new data with the old data and re-divide them into training and test sets; S3.

44. Retrain the random forest model using a new training set, readjusting the number of trees, the maximum depth of each decision tree, and the number of features used to find the best split.

10. The vision change prediction method based on random forest algorithm according to claim 9, characterized in that: In step S4, the trained prediction model is applied to predict changes in vision based on new data, including the following steps: S4.1 Prepare the new dataset; S4.2 Perform the same feature standardization process on the new data, and use the standardization parameters of the training data to standardize the new dataset; S4.3 Load the pre-trained random forest model; S4.4 Use the trained model to predict new data and obtain the predicted value of vision change.