Breast cancer classification prediction method based on machine learning
Through machine learning-based methods, the integrated classifier is constructed using gene expression data and clinical staging data of breast cancer patients, which solves the problem of lack of breast cancer TNM staging prediction methods in the existing technology, and significantly improves the accuracy of breast cancer classification prediction.
Patent Information
- Application Number
- CN202411692710.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-25
- Publication Date
- 2025-03-14
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
There is a lack of a classification prediction method for breast cancer based on machine learning, especially when medical equipment lags behind in underdeveloped areas, it is difficult to detect and treat breast cancer early.
Using a machine learning-based approach, data cleaning and feature screening are carried out by downloading gene expression data and clinical staging data from the TCGA database, and training and testing using a variety of machine learning models (such as K-nearest neighbors, support vector machines, logistic regression, decision trees and random forests), and finally an integrated classifier is built to improve prediction accuracy.
The prediction accuracy of breast cancer classification results was significantly improved. Compared with traditional machine learning models, the correction averages of the accuracy and recall of the integrated classifier were improved by 31.25%, 12.28%, 26.67%, 81.82%, and 37.93%, respectively, and the prediction performance was maintained under the imbalance of the initial data.
Smart Images

Figure CN119626318A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of breast cancer classification prediction methods, and in particular to a breast cancer classification prediction method based on machine learning. Background Art
[0002] With the development of medical technology, there are more specific treatment plans for breast cancer at different stages and better treatment effects.
[0003] The treatment plan for breast cancer basically depends on the stage. With timely diagnosis, breast cancer usually has a good prognosis. However, the survival status of breast cancer patients in different regions of the world varies. Whether breast cancer can be detected early is largely related to the patient's living environment.
[0004] In underdeveloped areas, backward medical equipment and untimely detection and treatment are important reasons. Therefore, the existing technology lacks a method for classification and prediction of TNM staging of breast cancer based on machine learning. Summary of the invention
[0005] In view of the technical problem that the existing technology lacks a method for classifying and predicting the TNM staging of breast cancer based on machine learning, the present invention provides a method for classifying and predicting breast cancer based on machine learning.
[0006] The technical solution adopted by the present invention is: a method for classifying and predicting breast cancer based on machine learning, which specifically includes the following steps:
[0007] Step S1, first download the dataset HiSeqV2 (gene expression dataset) and clinical.cases_selection.2024-01-05 (clinical staging dataset) from the TCGA database;
[0008] Step S2, collecting statistics of multiple breast cancer patients, the statistical data of each patient includes 20530 gene expression data, and the clinical staging data set provides clinical data such as cancer staging of multiple breast cancer patients, wherein the staging includes 12 stages from stage I to stage V including subclass divisions;
[0009] Step S3, processing the data set for missing labels, deleting the data with missing staging results of 4 groups, and then deleting the sample data with missing values of gene expression data accounting for more than 20%, and then obtaining 1194 samples, and then deleting the feature data with missing values of gene expression data accounting for more than 20%, and then obtaining 16630 gene data;
[0010] Step S4, merging the data of stageI, stageIA, and stageIB as stageI data of breast cancer, merging the data of stageII, stageIIA, and stageIIB as stageII data of breast cancer, and merging the data of stageIII, stageIIIA, stageIIIB, and stageIIIC as stageIII data of breast cancer;
[0011] Step S5, numerically process the labels in the data set, then calculate the correlation coefficient between each feature and the label, and take its absolute value, select the top 20 features with the largest absolute value of the correlation coefficient from these features, and use these selected features to construct and draw a heat map to show the strength of the relationship between the feature and the label;
[0012] Step S6, feature extraction using ANOVA, using the f_classif function in Python, based on the F distribution, using the sum of squares and degrees of freedom to calculate the F value of the Cohen'sf statistic constructed by ANOVA, and screening features based on the F value and the corresponding p value. Based on experience and research purposes, a p value less than 0.05 is used as a screening condition, and the gene expression data is sorted in descending order by F value to select the top 50 features as the features used in subsequent research;
[0013] Step S7, using the variance_inflation_factor library function in Python to calculate the VIF values of the 50 features screened out, and setting VIF less than 10 as the screening condition to obtain gene features that meet the conditions, and using the 1194 samples obtained after the above data cleaning and the matrix containing label values composed of the genes obtained after feature screening as the sample data set for model training;
[0014] Step S8, randomly dividing the data set obtained in step S7 into a training set and a test set by hierarchical sampling according to the multi-classification results, and constructing a model.
[0015] The present invention is further configured such that step S5 also includes drawing a box plot by selecting four features with higher correlation according to the heat map.
[0016] The present invention is further configured as follows: in step S8, the test set is not sampled, and a balanced sample set with consistent proportions of each stage is obtained as a training set.
[0017] The beneficial effects of the present invention are:
[0018] 1. In the present invention, the data is cleaned and the features of the data set are extracted to screen out relevant features that are beneficial to the machine learning algorithm. Then, the data set is divided into a training set and a test set using a stratified sampling method. To avoid information leakage, only the training set is oversampled, and several classification samples with less data volume are interpolated to synthesize new samples to obtain balanced stage data and construct a corresponding model. It is found that the prediction accuracy of each classification result is significantly improved compared with the traditional machine learning model.
[0019] 2. In the present invention, the K nearest neighbor model, support vector machine model, logistic regression model, decision tree model and random forest model are used to predict the stage of balanced samples, and the grid search method is used to screen the preset hyperparameters. Then, the stacking idea is used to construct an integrated classifier on this basis, so that the newly obtained model is compared with the decision tree model with the best effect among the five machine learning models, and the harmonic mean of the precision and recall rate in the five classification results is increased by 31.25%, 12.28%, 26.67%, 81.82% and 37.93% respectively. The final results show that the constructed integrated classifier has a significant improvement in the prediction accuracy of each classification result relative to the traditional machine learning model. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 is a frequency distribution diagram of cancer stages in the samples of the present invention;
[0021] Figure 2 It is the feature heat map selected in the present invention;
[0022] Figure 3 It is a box plot of the features selected in the present invention;
[0023] Figure 4 It is a line graph of the characteristic F value selected in the present invention;
[0024] Figure 5 is the confusion matrix of the K nearest neighbor model in the present invention Figure 1 ;
[0025] Figure 6 is the confusion matrix of the K nearest neighbor model in the present invention Figure 2 ;
[0026] Figure 7 is the confusion matrix of the support vector machine model in the present invention Figure 1 ;
[0027] Figure 8 is the confusion matrix of the support vector machine model in the present invention Figure 2 ;
[0028] Fig. 9 is the confusion matrix of the logistic regression model in the present invention Figure 1 ;
[0029] Fig.10 is the confusion matrix of the logistic regression model in the present invention Figure 2 ;
[0030] Fig.11 is the confusion matrix of the decision tree model in the present invention Figure 1 ;
[0031] Fig.12 is the confusion matrix of the decision tree model in the present invention Figure 2 ;
[0032] Fig.13 is the confusion matrix of the random forest model in the present invention Figure 1 ;
[0033] Fig.14 is the confusion matrix of the random forest model in the present invention Figure 2 ;
[0034] Fig.15 The confusion matrix of the integrated classifier model in the present invention is Figure 1 ;
[0035] Fig.16 The confusion matrix of the integrated classifier model in the present invention is Figure 2 . DETAILED DESCRIPTION
[0036] The following will be combined with the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0037] refer to Figure 1-16 In order to solve the problems existing in the background technology, the present application proposes the following technical solution: a method for classifying and predicting breast cancer based on machine learning, specifically comprising the following steps:
[0038] Step S1, first download the dataset HiSeqV2 (gene expression dataset) and clinical.cases_selection.2024-01-05 (clinical staging dataset) from the TCGA database;
[0039] Step S2, collecting statistics of multiple breast cancer patients, the statistical data of each patient includes 20530 gene expression data, and the clinical staging data set provides clinical data such as cancer staging of multiple breast cancer patients, wherein the staging includes 12 stages from stage I to stage V including subclass divisions;
[0040] Step S3, processing the data set for missing labels, deleting the data with missing staging results of 4 groups, and then deleting the sample data with missing values of gene expression data accounting for more than 20%, and then obtaining 1194 samples, and then deleting the feature data with missing values of gene expression data accounting for more than 20%, and then obtaining 16630 gene data;
[0041] Among them, for filling missing values, the present invention applies both mean filling and median filling schemes, among which the mean interpolation scheme has better effect, and the median filling scheme is prone to overfitting. This is because the outliers in the research of the present invention have certain information value, and median filling will weaken this information, resulting in poor model effect, which is specifically reflected in the confusion matrix comparison in the following text.
[0042] In any case, before dealing with outliers, it is very important to understand the source of data and outliers. Because of physical abnormalities and the unlimited proliferation characteristics of cancer, a certain indicator will grow infinitely, so outliers in the present invention have a research significance that cannot be deleted. In addition, under the premise that the data distribution is unclear, directly filtering outliers has limitations. Therefore, for the processing of outliers, instead of deleting them, Z-score standardization is used to reduce the impact.
[0043] Step S4, merging the data of stageI, stageIA, and stageIB as stageI data of breast cancer, merging the data of stageII, stageIIA, and stageIIB as stageII data of breast cancer, and merging the data of stageIII, stageIIIA, stageIIIB, and stageIIIC as stageIII data of breast cancer;
[0044] Among them, the number and frequency of all values of cancer stage in the samples after finally merging into five staging types are shown in Tables 1 and Figure 1 shown.
[0045] Table 1 Number and frequency of all values of cancer stage in the sample
[0046] stage Frequency frequency Stage I 201 0.1683 StageII 683 0.5720 Stage III 275 0.2303 StageIV 22 0.0184 StageX 13 0.0109
[0047] Table 1
[0048] Step S5, numerically process the labels in the data set, then calculate the correlation coefficient between each feature and the label, and take its absolute value, select the top 20 features with the largest absolute value of the correlation coefficient from these features, and use these selected features to construct and draw a heat map to show the strength of the relationship between the feature and the label, such as Figure 2 As shown; step S5 also includes selecting four features with higher correlation according to the heat map to draw a box plot.
[0049] Then, four features with high correlation, 'ABCB9', 'CHPT1', 'FOS', and 'C8orf55', are selected according to the heat map to draw a box plot, such as Figure 3 As shown in the figure, the box plot shows that even for highly correlated gene features, there is overlap in the distribution of their contents in different cancer stages, so it is difficult to obtain an accurate classification standard for distinguishing different cancer stages.
[0050] Step S6, feature extraction using ANOVA, using the f_classif function in Python, based on the F distribution, using the sum of squares and degrees of freedom to calculate the F value of the Cohen'sf statistic constructed by ANOVA, and screening features based on the F value and the corresponding p value. Based on experience and research purposes, a p value less than 0.05 is used as a screening condition, and the gene expression data is sorted in descending order by F value to select the top 50 features as the features used in subsequent research. The F values of the 50 screened features are visualized as follows: Figure 4 As shown;
[0051] Among them, the top 20 features in descending order of gene features are shown in Table 2.
[0052] Table 2 The top 20 gene features in descending order
[0053]
[0054]
[0055] Table 2
[0056] Among them, the larger the value of Cohen'sf statistic, the greater the impact of inter-group differences on intra-group differences, that is, the more significant the mean differences between different groups. In addition to correlation tests, feature screening also requires testing of multicollinearity Variance Inflation Factor (VIF). The present invention uses the variance_inflation_factor library function in python to calculate the VIF values of the 50 screened features, and sets VIF less than 10 as the screening condition based on experience, and finally obtains 48 gene features that meet the conditions;
[0057] Step S7, use the variance_inflation_factor library function in Python to calculate the VIF values of the 50 features selected, and set VIF less than 10 as the screening condition to obtain the gene features that meet the conditions. After this screening process, the key gene features with low multicollinearity are retained. Finally, the 1194 samples after the above data cleaning and the screened features are combined into a matrix with label values as the sample data set for subsequent model training;
[0058] Step S8, the data set obtained in step S7 is randomly divided into a training set and a test set by hierarchical sampling according to the multi-classification results, and the test set is not sampled, so as to obtain a balanced sample set with a consistent proportion of each stage as the training set, and then the model is constructed;
[0059] The previously obtained data set is randomly divided into a training set and a test set by hierarchical sampling according to the multi-classification results. 80% of the entire sample data set is randomly selected as the training set, and the remaining 20% is used as the test set.
[0060] Since the number of StageIV and StageX in the obtained data is small, as shown in the test set data in Table 3, the SMOTE oversampling method is selected to construct a balanced training data set. In order to prevent information leakage during model training, the test set is not oversampled, and finally a balanced sample set (a total of 2730 samples) with consistent proportions of each stage is obtained as the training set, as shown in Table 4.
[0061] Table 3 Number and frequency of all values of cancer stage in the test set;
[0062] stage Frequency frequency Stage I 40 0.1674 StageII 137 0.5732 Stage III 55 0.2301 StageIV 4 0.0167 StageX 3 0.0126
[0063] Table 4 Number and frequency of all values of cancer stage in the balanced sample set;
[0064] stage Frequency frequency Stage I 546 0.2 StageII 546 0.2 Stage III 546 0.2 StageIV 546 0.2 StageX 546 0.2
[0065] The K nearest neighbor algorithm is used. The K nearest neighbor algorithm uses the grid search k value 1 to 31 and other parameter combinations. K is 1, which makes the model work best. That is, the data will not be overfitted and a more complex model is required to process it. The performance of the KNeighborsClassifier classifier is shown in Table 5 and Figure 5 ;
[0066] Table 5K nearest neighbor model evaluation
[0067] stage precision recall f1-score support Stage I 0.30 0.57 0.40 40 StageII 0.74 0.33 0.45 137 Stage III 0.34 0.47 0.40 55 StageIV 0.08 0.25 0.12 4 StageX 0.08 0.33 0.12 3
[0068] In the table, support indicates the number of samples in the corresponding stage used for testing. From the table and confusion matrix, we can see that the accuracy of KNN prediction for Stage II reaches 0.74, and there are samples with correct predictions for Stage IV and Stage X. The sample data training results obtained by filling missing values with the median are as follows Figure 6 shown.
[0069] Next, the results of the combination of parameters such as penalty parameters and kernel functions were determined by grid search through the support vector machine algorithm. The performance of the SVM_Classifier classifier under the optimal combination is shown in Table 6 and Figure 7 .
[0070] Table 6 Support vector machine model evaluation
[0071] stage precision recall f1-score support Stage I 0.32 0.23 0.26 40 StageII 0.59 0.74 0.66 137 Stage III 0.28 0.20 0.23 55 StageIV 1.00 0.25 0.40 4 StageX 0.00 0.00 0.00 3
[0072] Among them, by analyzing the data shown in the table and confusion matrix, it can be clearly seen that the support vector machine achieved a recall rate of 0.74 when predicting Stage II breast cancer, which is an indicator of the model's ability to identify all positive samples;
[0073] At the same time, the F1 score of the model also reached 0.66. The F1 score is the harmonic mean of precision and recall, which can provide a balanced perspective on the overall performance of the model. There are samples that are correctly predicted for StageIV but not for StageX. The sample data training results obtained by filling missing values with the median are as follows Figure 8 shown.
[0074] The results of the combination of parameters such as penalty parameters and regularization terms were determined by using the logistic regression algorithm using grid search. The performance of the LogisticRegression classifier under the optimal combination is shown in Tables 7 and Fig. 9 .
[0075] Table 7 Logistic regression model evaluation
[0076] stage precision recall f1-score support Stage I 0.21 0.38 0.27 40 StageII 0.68 0.33 0.44 137 Stage III 0.37 0.51 0.43 55 StageIV 0.05 0.25 0.08 4 StageX 0.14 0.33 0.20 3
[0077] By looking at the results of the table and confusion matrix, it can be found that the logistic regression model performs best in predicting Stage II breast cancer;
[0078] At the same time, for breast cancer in Stage IV and Stage X, the LR model can also successfully predict some correct cases;
[0079] In addition, for missing data, the present invention adopts the median filling method to process it, and the model results trained using these processed sample data have been Figure 4-10 This shows clearly that even in the case of incomplete data, appropriate data preprocessing methods can still help the model achieve a certain degree of prediction accuracy;
[0080] Among them, the decision tree algorithm was used to determine the results of the maximum depth and maximum number of leaf nodes using grid search. The performance of the DecisionTreeClassifier classifier under the optimal combination is shown in Table 8 and Fig.11 .
[0081] Table 4-8 Decision tree model evaluation
[0082] stage precision recall f1-score support Stage I 0.28 0.38 0.32 40 StageII 0.66 0.50 0.57 137 Stage III 0.26 0.35 0.30 55 StageIV 0.20 0.25 0.22 4 StageX 0.25 0.33 0.29 3
[0083] From the table and confusion matrix, we can see that DT has the best prediction effect for Stage II. On the premise of having the correct prediction ability for each type of label, the decision tree not only shows good prediction ability for each type of label, but also when considering the prediction effect of all labels comprehensively, DT's overall performance is better than other classifiers.
[0084] This comprehensive predictive ability shows that decision trees can effectively distinguish different categories of samples when dealing with this specific problem, and can maintain high accuracy even in the face of complex data patterns. The sample data training results obtained by filling missing values with the median are shown in Figure 2. Fig.12 shown.
[0085] Among them, the random forest algorithm was used to determine the results of the combination of parameters such as the number of base classifiers and the maximum depth using grid search. The performance of the RandomForestClassifier classifier under the optimal combination is shown in Table 9 and Fig.13 .
[0086] Table 9 Random Forest Model Evaluation
[0087] stage precision recall f1-score support Stage I 0.41 0.40 0.41 40 StageII 0.68 0.69 0.69 137 Stage 0.38 0.42 0.40 55 StageIV 1.00 0.25 0.40 4 StageX 0.00 0.00 0.00 3
[0088] From the table and confusion matrix, we can see that the RF ensemble learning algorithm performs better than the four classifiers discussed previously in predicting breast cancer in Stage I, Stage II, and Stage IV.
[0089] This shows that RF can more effectively capture patterns and associations in the data when processing breast cancer data at these specific stages, thereby making more accurate predictions. Although RF performs well in most cases, it encounters difficulties in predicting breast cancer at the StageX stage and fails to successfully identify any correct cases. This may be related to the small number of StageX samples, which leads to a lack of sufficient training information for the model. The sample data training results obtained by filling missing values with the median are shown in the figure below. Fig.13 shown.
[0090] Among them, a custom integrated classifier is used to adjust the model by permuting and combining the base classifier and the meta classifier. The base classifier permutes and combines the previous five classifiers, with a total of 31 combinations, and the meta classifier selects one of the previous five classifiers, with 5 selection methods. Among the 155 combinations obtained comprehensively, the integrated classifier obtained by using KNN, LR and RF as the base classifier and RF as the meta classifier stacked generalization has the best effect. The performance of the EmsebleLearningClassifier classifier is shown in Tables 10 and Fig.15 .
[0091] Table 4 Evaluation of ensemble classifier model
[0092]
[0093]
[0094] It can be seen from the table and confusion matrix that the integrated classifier finally constructed by the present invention has the ability to correctly predict samples of each label, and compared with the decision tree model with the best comprehensive effect, the f1 score of the integrated classifier is improved by 31.25%, 12.28%, 26.67%, 81.82% and 37.93% respectively. However, the comparison group using the median to fill the missing values weakens the information provided by the outliers, which makes the model prone to overfitting. Under the data quality of the initial sample imbalance, the model prediction effect is poor. The training results of the integrated classifier constructed by the same method are shown in Figure 2. Fig.16 shown.
[0095] In summary, since the traditional tumor marker classification standards are very mature, they can be used as a reference for medical detection indicators. However, the research object of the present invention is a wider range of biomarkers, and the content of biomarkers is not linearly related to cancer staging, that is, the content of biomarkers will first increase and then decrease or first decrease and then increase as the cancer worsens. This complexity significantly increases the difficulty of formulating numerical classification standards based on gene expression data, and its practical significance is relatively limited. Therefore, the present invention uses the designed classifier model as a classification standard for accurate staging of breast cancer. This is a classification standard based on a model rather than a statistical data value, that is, the data to be predicted is input into the integrated classifier created by the present invention for prediction, and the result of the classifier prediction is the possible classification result of the data.
[0096] The present invention screened 48 gene expression data as features for subsequent research through statistical variance analysis and multicollinearity test. In addition, the integrated classifier constructed by the present invention can finally have the correct prediction ability for each classification label and the overall accuracy rate exceeds half when the initial data is severely unbalanced and different features cannot clearly distinguish different breast cancer stages, which fully demonstrates the data mining ability of machine learning technology for genetic data;
[0097] The innovation of the present invention lies in that it fully considers the information contained in the outliers and minimizes the impact of outliers on model construction. At the same time, the present invention uses a stacked generalization ensemble learning algorithm based on the traditional machine learning classifier, thereby constructing an ensemble classifier with greatly improved capabilities.
[0098] In terms of model construction, the present invention introduces a stacked generalized ensemble learning algorithm to improve classification performance. By inputting the prediction results of multiple basic classifiers (such as logistic regression, support vector machine and random forest, etc.) into the meta-classifier for secondary learning, the ensemble classifier constructed by the present invention is significantly better than a single classifier. Experiments show that, especially when dealing with complex multi-category tasks such as breast cancer staging, the ensemble classifier can show significant advantages in prediction performance, accuracy and robustness.
[0099] The main work of the present invention is to first fully investigate the research background and current situation, understand the traditional research methods based on statistical methods and tumor markers, and understand the current research status of scientists on gene expression data. Then, fully learn the relevant theories of machine learning and the relationship between learning gene data and breast cancer. Then, a complete application of machine learning technology in data analysis was carried out, including data cleaning, feature screening, model construction and optimization, building integrated classifiers and evaluation. The integrated classifier finally built improved the f1 scores of the five classification stages by 31.25%, 12.28%, 26.67%, 81.82%, and 37.93% respectively compared with the decision tree model. Finally, the present invention analyzed the experimental results and tried to formulate a classification standard based on a machine learning model.
[0100] While the embodiments of the present invention have been shown and described, it will be apparent to those skilled in the art that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A method for classifying and predicting breast cancer based on machine learning, characterized in that: The specific steps include: Step S1, first download the dataset HiSeqV2 (gene expression dataset) and clinical.cases_selection.2024-01-05 (clinical staging dataset) from the TCGA database; Step S2, collecting statistics of multiple breast cancer patients, the statistical data of each patient includes 20530 gene expression data, and the clinical staging data set provides clinical data such as cancer staging of multiple breast cancer patients, wherein the staging includes 12 stages from stage I to stage V including subclass divisions; Step S3, processing the data set for missing labels, deleting the data with missing staging results of 4 groups, and then deleting the sample data with missing values of gene expression data accounting for more than 20%, and then obtaining 1194 samples, and then deleting the feature data with missing values of gene expression data accounting for more than 20%, and then obtaining 16630 gene data; Step S4, merging the data of stageI, stageIA, and stageIB as stageI data of breast cancer, merging the data of stageII, stageIIA, and stageIIB as stageII data of breast cancer, and merging the data of stageIII, stageIIIA, stageIIIB, and stageIIIC as stageIII data of breast cancer; Step S5, numerically process the labels in the data set, then calculate the correlation coefficient between each feature and the label, and take its absolute value, select the top 20 features with the largest absolute value of the correlation coefficient from these features, and use these selected features to construct and draw a heat map to show the strength of the relationship between the feature and the label; Step S6, feature extraction using ANOVA, using the f_classif function in Python, based on the F distribution, using the sum of squares and degrees of freedom to calculate the F value of the Cohen'sf statistic constructed by ANOVA, and screening features based on the F value and the corresponding p value. Based on experience and research purposes, a p value less than 0.05 is used as a screening condition, and the gene expression data is sorted in descending order by F value to select the top 50 features as the features used in subsequent research; Step S7, using the variance_inflation_factor library function in Python to calculate the VIF values of the 50 features screened out, and setting VIF less than 10 as the screening condition, removing features with significant multicollinearity, and obtaining gene features that meet the conditions. The 1194 samples obtained after the above data cleaning and the matrix containing label values composed of genes obtained after feature screening are used as the sample data set for model training; Step S8, randomly dividing the data set obtained in step S7 into a training set and a test set by hierarchical sampling according to the multi-classification results, and constructing a model.
2. The method for classifying and predicting breast cancer based on machine learning according to claim 1, characterized in that: Step S5 also includes selecting four features with higher correlation according to the heat map to draw a box plot.
3. The method for classifying and predicting breast cancer based on machine learning according to claim 2, characterized in that: Step S8: No sampling is performed on the test set, and a balanced sample set with consistent proportions of each stage is obtained as the training set.