Whole blood donor low hemoglobin delayed blood donation risk prediction method
Through the combination of SMOTE and LightGBM models, combined with HyperBand super -parameter optimization, the problem of poor classification accuracy of blood donation delayed prediction models is solved, and higher model performance and stability of blood supply are realized.
Patent Information
- Application Number
- CN202411910956.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-24
- Publication Date
- 2025-01-24
AI Technical Summary
The existing blood donation delay prediction model has shortcomings in classification accuracy and generalization performance, and it is difficult to effectively capture nonlinear features, resulting in poor classification accuracy of the model.
The SMOTE method is used for data set oversampling, and the LightGBM model is used for classification. At the same time, the Hyperband method is used for hyperparameter optimization to build a performance-optimized prediction model.
Through the mechanism of setting and early suspension, the classification accuracy and generalization performance of the model have been improved, the ability to identify the blood donation sample of low HB, optimize the blood donation invitation strategy, and enhance the continuity and stability of blood supply. Essence
Smart Images

Figure CN119361157A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of medical data analysis and processing, and in particular relates to a method for predicting the risk of delayed blood donation by whole blood donors with low hemoglobin. Background Art
[0002] In the blood donation process, in order to ensure the health of whole blood donors, all whole blood donors need to undergo a series of detailed blood tests before donating. The detection of hemoglobin (Hb) level is one of the core tests. By testing the hemoglobin level, the blood management agency can evaluate the blood oxygenation capacity of the whole blood donor and whether there is a potential risk of anemia, so as to ensure that there will be no severe anemia after blood donation. In this process, if the hemoglobin or other blood indicators of the whole blood donor do not meet the prescribed health standards, they cannot donate blood and need to postpone until the next time when the blood indicators meet the standards. This phenomenon of blood donation postponement is not uncommon in blood donation screening, especially in people with more fluctuating health conditions. Blood donation postponement will not only affect the efficiency of blood management agencies, but may also cause psychological frustration to whole blood donors who are dissuaded or postponed due to non-compliance, thereby weakening their enthusiasm for participating in voluntary blood donation in the future and affecting the long-term stability of blood supply. In this context, developing a prediction model to classify and identify which whole blood donors may have their blood donations postponed due to low hemoglobin can, on the one hand, provide decision support for blood management agencies and optimize the invitation and screening process for whole blood donors. On the other hand, by prejudging and identifying high-risk whole blood donors (who have a higher probability of postponing blood donation due to low hemoglobin), blood management agencies can take personalized health guidance or reminder measures to increase the success rate of blood donation and ensure the continuity and stability of long-term blood supply.
[0003] Since 2011, the research team jointly formed by Sanquin Blood Bank in the Netherlands and Utrecht University and other institutions has continued to carry out nearly ten studies in this field, and has continuously updated research methods and expanded the scope of research. Baart et al. (2011)'s study was based on data from 5191 whole blood donors who donated whole blood at least twice in some parts of the Netherlands between 2000 and 2004. They screened out multiple candidate predictive variables, processed missing values through ten multiple imputations, and used a logistic regression model to predict low Hb levels (yes / no). In the model test, the research team screened out the variables with the strongest association with low Hb levels through the backward selection method, and used Bootstrap resampling to evaluate the model's and AUC (area under the ROC curve) to measure the overall performance and discrimination ability of the model. The team then expanded the research scope from parts of the Netherlands to cross-national comparisons, and introduced methods such as random forests, support vector machines, and dynamic linear mixed models. They also explained the importance of predictive variables through the SHAP method, and finally achieved the cross-national application and sharing of the delayed blood donation prediction model, which was recorded in Barrt et al. 2014; Vinkenog et al. 2023.
[0004] This type of research is of great significance in promoting the development of the field of blood donation delay prediction, but it still has the following shortcomings: (1) In terms of model selection, statistical models such as logistic regression and linear mixed models and classic machine learning models such as support vector machines and random forests are used. Since such models are difficult to capture nonlinear features, they have underfitting problems, which is manifested as poor model classification accuracy; (2) In terms of model tuning, hyperparameter tuning methods based on modern optimization algorithms are not introduced, and the model has room for improvement in classification accuracy and generalization performance.
[0005] Therefore, how to solve the problem that the blood donation delay prediction model has poor classification accuracy and cannot effectively capture nonlinear characteristics, and provide a method for predicting delayed blood donation with low hemoglobin in whole blood donors that improves the accuracy and reliability of the blood donation delay prediction model is a technical problem that needs to be urgently solved by technical personnel in this field. Summary of the invention
[0006] The purpose of the present invention is to provide a method for predicting the risk of delayed blood donation due to low hemoglobin in whole blood donors, aiming at the problem of delayed blood donation prediction.
[0007] To this end, the above-mentioned purpose of the present invention is achieved through the following technical solutions: A method for predicting the risk of delayed blood donation due to low hemoglobin in whole blood donors comprises the following steps: S1, integration of basic information of blood donors and pre-donation test data, pre-processing and calculation of derived variables: integrating basic information of blood donors and pre-donation test data to form a comprehensive data set, including personal information, blood donation history, health data and hemoglobin test data; correcting variables with input errors in the comprehensive data set, and calculating the number of days between blood donations and historical Hb mean derived variables; for variables with missing values, using histogram-based interpolation method to fill missing values, and finally constructing a sample data set suitable for statistical analysis; S2, type conversion and feature encoding: convert the integer variables in the sample data set formed in step S1 into floating-point types, and convert the character variables into factor types; perform feature encoding on the factor variables, and construct a machine learning binary classification task; S3, prediction model construction and optimization: The SMOTE method is used to oversample the data set, and the LightGBM model is used for classification, and the Hyperband method is used for hyperparameter optimization: First, initialize SMOTE and LightGBM, and define their hyperparameter search spaces; second, build a learning pipeline and perform hyperparameter optimization, and finally, train the best model and perform performance evaluation; build a learning pipeline to integrate the two processes of data processing and model training into a unified learner, and use the Hyperband method to optimize the learner's hyperparameters to obtain a performance-optimized model; finally, perform performance evaluation on the tuned model to ensure that its effect meets the application requirements.
[0008] While adopting the above technical solutions, the present invention may also adopt or combine the following technical solutions: As a preferred technical solution of the present invention: in step S1, blood donation records and hemoglobin test data are collected, including data reading, formatting, input exception processing, and descriptive statistics functions, specifically including the following steps: S11, collect blood donation records and Hb test data; S12, correcting input errors: Check the format of the input data to see if it contains variables such as Hb test value and whether it is delayed. If the input data does not meet the conditions, an exception is thrown to indicate that the input data is incorrect. If the data meets the conditions, the data is encapsulated as a data.table data frame. Check the weight variable for input errors and use the repair function to correct the input errors. If the first digit is 1 or 2, keep the first three digits. If the first digit is not 1 or 2, keep the first two digits. S13, calculation of derived variables: grouping based on the whole blood donor ID variable, and calculating the variable of the number of days between blood donations according to the blood donation date; for variables involved in the test data, such as Hb test value and body weight, calculating derived variables such as the historical Hb test mean and historical body weight mean to meet the actual available data; S14, histogram-based interpolation to fill missing values: use a histogram-based interpolation method to fill in the variables with missing data to obtain a sample data set suitable for statistical analysis; S15, descriptive statistics of the adjusted data.
[0009] As a preferred technical solution of the present invention: the type conversion and feature encoding in S2 includes the following steps: S21, convert the integer variables in the data frame into floating point types to facilitate SMOTE oversampling; S22, convert the character variables in the data frame into factor types to facilitate subsequent encoding processing; S23. Select factor variables with a category cardinality greater than 10 and encode their effects; S24, select factor variables whose category cardinality is greater than 2 and less than 10, and perform one-hot encoding on them; S25. Select a binary factor variable and encode it as a dummy variable; S26, grouping based on the whole blood donor ID variable, selecting the most recent blood donation record data as the test set, and the remaining blood donation record data as the training set; S27. Initialize the R language mlr3 classification task, specify the variable "whether to postpone blood donation" as the classification target, and define "postpone blood donation" as the positive class.
[0010] As a preferred technical solution of the present invention: the prediction model construction and optimization in S3 includes the following steps: S31. Initialize SMOTE and use SMOTE to oversample the training data for class balance of classification targets; define the SMOTE hyperparameter space: specify its K nearest neighbor parameters and the number of oversampling repetitions as the hyperparameter search targets; S32. Import the LightGBM library and define its hyperparameter search space: initialize the LightGBM learner for learning classification rules; refer to the recommended parameter search space for LightGBM by the automatic hyperparameter optimization software Optuna, and adjust the hyperparameter settings such as the regularization coefficient, the number of leaf nodes, the random extraction ratio of features and bagging, the bagging frequency, and the minimum number of samples per leaf node; S33. Use the R language mlr3 package to encapsulate the SMOTE oversampling method and the LightGBM learner into a learning pipeline and combine them into a learner to be adjusted. S34. Use Hyperband for hyperparameter optimization, initialize the Hyperband tuner, and set its parameter to 2, that is, only 1 / 2 of the hyperparameter combinations can enter the next round in each iteration; set the number of iterations of LightGBM to computing resources; S35. Use the Successive Halving algorithm to quickly iterate the hyperparameter configuration, use F1-score as the performance indicator, use the Hyperband tuner to evaluate multiple hyperparameter configurations, and save the hyperparameter combination with the best F1-score. S36, constructing a tuned model using the hyperparameters obtained through tuning, training the model on the training set data, and then predicting the test set data; S37. Use indicators such as precision, recall, AUC, F1-score, confusion matrix, etc. to measure the performance of the model after parameter adjustment. If the F1-score of the model's prediction results on the test set reaches above 0.75, its performance is considered acceptable.
[0011] Compared with the prior art, the method for predicting the risk of delayed blood donation due to low hemoglobin in whole blood donors of the present invention has the following beneficial effects: the hyperparameters of the SMOTE oversampling and LightGBM models are nested and adjusted through the Hyperband method, and random search and early stopping mechanisms are combined to allocate resources to multiple configurations. The resource allocation is dynamically adjusted according to the intermediate evaluation results, and the configuration with better performance is given priority, achieving a better parameter combination under a lower computational burden, thereby improving the classification accuracy of the model for low Hb delayed blood donation samples. LightGBM itself is an efficient gradient boosting decision tree algorithm, suitable for processing large-scale data. The Hyperband method is simpler to implement and does not rely on proxy models. It significantly improves the utilization efficiency of computing resources through dynamic resource allocation and early stopping mechanism. LightGBM combines the Hyperband method for nested parameter adjustment, and can converge to a better hyperparameter combination faster on large-scale data sets. It is suitable for sample data sets for statistical analysis with large data volume after type conversion and feature encoding, and low complexity of related parameter settings. Through effective interpretation and deployment of the model, this method optimizes the invitation strategy for whole blood donors, effectively improves the efficiency of blood management, reduces unnecessary blood donation extensions, and enhances the continuity and stability of blood supply.
[0012] In the present invention, data integration and preprocessing are used to solve data inconsistency, missing values and storage efficiency through pre-designed data structure, effective outlier processing method and use of efficient data storage format, improve the accuracy and reliability of data analysis, and also improve the maintainability and adaptability of the prediction system; the encoding method is flexibly selected through the category cardinality of factor-type features, which can not only effectively balance the degree of classification information retention and model complexity, but also reduce the dimension disaster problem by optimizing data dimensions, reduce information noise and model overfitting risks; the histogram-based interpolation method can significantly save memory resources while retaining data distribution characteristics; the SMOTE algorithm is used to effectively solve the category imbalance phenomenon of the target variable, avoid overfitting of the LightGBM model, and improve the generalization performance of the model; the Hyperband method is used to nest the hyperparameters of the SMOTE algorithm and the LightGBM model in the program pipeline, which can have the mutual influence of model setting and oversampling process to achieve hyperparameter combination optimization; the Hyperband method is used to quickly test and screen hyperparameter configurations to achieve intelligent and efficient parameter tuning. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] Figure 1 This is a schematic diagram of a method for predicting the risk of delayed blood donation due to low hemoglobin in whole blood donors of the present invention. DETAILED DESCRIPTION
[0014] The present invention will be described in further detail with reference to the accompanying drawings and specific embodiments.
[0015] A method for predicting the risk of delayed blood donation due to low hemoglobin in whole blood donors comprises the following steps: S1, data integration and preprocessing: Integrate the basic information of blood donors and the test data before blood donation to form a comprehensive data set, including personal information, blood donation history, health data and hemoglobin test data; correct the variables with input errors, and calculate the derived variables such as the number of days between blood donations and the historical Hb mean; for variables with missing values, use the histogram-based interpolation method to fill the missing values, and finally construct a sample data set suitable for statistical analysis.
[0016] S2, type conversion and feature encoding: To ensure the data type compatibility between the prediction model and the oversampling method, the integer variables in the data set are uniformly converted to floating point types, and the character variables are converted to factor types; according to the number of categories of the factor variable, the appropriate encoding method (effect encoding, one-hot encoding, dummy variable encoding) is selected for feature encoding; the variable "whether to postpone blood donation" is set as the classification target, and "postponed blood donation" is defined as the positive class. The most recent blood donation record data is selected as the test set, and the rest of the blood donation record data is used as the training set, and the problem is formulated as a machine learning binary classification task.
[0017] S3, prediction model construction and optimization: For this binary classification task, the SMOTE method is used to oversample the data set, and the LightGBM model is used for classification. First, initialize SMOTE and LightGBM, and define the hyperparameter search space of the two. Secondly, build a learning pipeline to integrate the two processes of data processing and model training into a unified learner, and use the Hyperband method to optimize the hyperparameters of the learner to obtain a performance-optimized model. Finally, the performance of the tuned model is evaluated to ensure that its effect meets the application requirements.
[0018] While adopting the above technical solutions, the present invention may also adopt or combine the following technical solutions: As a preferred technical solution of the present invention: in step S1, blood donation records and hemoglobin test data are collected, including data reading, formatting, input exception processing, and descriptive statistics functions, specifically including the following steps: S11, collect blood donation records and Hb test data; S12, input error adjustment: Check the format of the input data to see if it contains variables such as Hb test value and whether it is postponed. If the input data does not meet the conditions, an exception is thrown to indicate that the input data is incorrect. If the data meets the conditions, the data is encapsulated as a data.table data frame. Check the weight variable for input errors and use the repair function to correct the input errors. If the first digit is 1 or 2, keep the first three digits. If the first digit is not 1 or 2, keep the first two digits. S13, calculate derived variables: group the whole blood donors based on the ID variable, calculate the variable of the number of days between blood donations according to the blood donation date; calculate the derived variables such as the historical Hb test mean and historical weight mean for the variables involved in the test data, such as Hb test value and body weight, to meet the actual available data; S14, histogram interpolation: use the histogram-based interpolation method to fill in the variables with missing data; S15, descriptive statistics of the adjusted data.
[0019] As a preferred technical solution of the present invention: the feature coding in S2 includes the following steps: S21, convert the integer variables in the data frame into floating point types to facilitate SMOTE oversampling; S22, convert the character variables in the data frame into factor types to facilitate subsequent encoding processing; S23. Select factor variables with a category cardinality greater than 10 and encode their effects; S24, select factor variables whose category cardinality is greater than 2 and less than 10, and perform one-hot encoding on them; S25. Select a binary factor variable and encode it as a dummy variable.
[0020] S26. Grouping is performed based on the whole blood donor ID variable, and the most recent blood donation record data is selected as the test set, and the remaining blood donation record data is used as the training set.
[0021] S27. Initialize the R language mlr3 classification task, specify the variable "whether to postpone blood donation" as the classification target, and define "postpone blood donation" as the positive class.
[0022] As a preferred technical solution of the present invention: the prediction model construction and optimization in S3 includes the following steps: S31. Initialize the SMOTE oversampling method to balance the categories of the classification targets; define the SMOTE hyperparameter space: specify its K nearest neighbor parameters and the number of oversampling repetitions as the hyperparameter search targets.
[0023] S32. Initialize the LightGBM learner for learning classification rules; refer to the recommended parameter search space for LightGBM by the automatic hyperparameter optimization software Optuna, and adjust the hyperparameter settings such as the regularization coefficient, number of leaf nodes, random extraction ratio of features and Bagging, Bagging frequency, and the minimum number of samples per leaf node.
[0024] S33. Use the R language mlr3 package to encapsulate the SMOTE oversampling method and the LightGBM learner into a machine learning pipeline and combine them into a learner to be adjusted.
[0025] S34. Initialize the Hyperband tuner and set its parameter to 2, that is, only 1 / 2 of the hyperparameter combinations can enter the next round in each iteration; set the number of iterations of LightGBM to computing resources.
[0026] S35. Use the Successive Halving algorithm to quickly iterate the hyperparameter configuration, use F1-score as the performance indicator, use the Hyperband tuner to evaluate multiple hyperparameter configurations, and save the hyperparameter combination with the best F1-score.
[0027] S36. Use the tuned hyperparameters to construct a tuned model, train the model on the training set data, and then predict the test set data.
[0028] S37. Use indicators such as precision, recall, AUC, F1-score, confusion matrix, etc. to measure the performance of the model after parameter adjustment. If the F1-score of the model's prediction results on the test set reaches above 0.75, its performance is considered acceptable. Example
[0029] like Figure 1 As shown, a method for predicting delayed blood donation due to low hemoglobin in whole blood donors based on the LightGBM model and Hyperband hyper-parameter optimization of the present invention is further described in detail.
[0030] S1, data integration and preprocessing: Integrate the basic information of blood donors and the test data before blood donation to form a comprehensive data set, including personal information, blood donation history, health data and hemoglobin test data; correct the variables with input errors, and calculate the derived variables such as the number of days between blood donations and the historical Hb mean; for variables with missing values, use the histogram-based interpolation method to fill the missing values, and finally construct a sample data set suitable for statistical analysis.
[0031] S2, type conversion and feature encoding: To ensure the data type compatibility between the prediction model and the oversampling method, the integer variables in the data set are uniformly converted to floating point types, and the character variables are converted to factor types; according to the number of categories of the factor variable, the appropriate encoding method (effect encoding, one-hot encoding, dummy variable encoding) is selected for feature encoding; the variable "whether to postpone blood donation" is set as the classification target, and "postponed blood donation" is defined as the positive class. The most recent blood donation record data is selected as the test set, and the rest of the blood donation record data is used as the training set, and the problem is formulated as a machine learning binary classification task.
[0032] S3, prediction model construction and optimization: For this binary classification task, the SMOTE method is used to oversample the data set, and the LightGBM model is used for classification. First, initialize SMOTE and LightGBM, and define the hyperparameter search space of the two. Secondly, build a learning pipeline to integrate the two processes of data processing and model training into a unified learner, and use the Hyperband method to optimize the hyperparameters of the learner to obtain a performance-optimized model. Finally, the performance of the tuned model is evaluated to ensure that its effect meets the application requirements.
[0033] In the present invention, the data integration and preprocessing in S1 includes the following steps: S11, collect blood donation records and Hb test data; S12, input error adjustment: Check the format of the input data to see if it contains variables such as Hb test value and whether it is postponed. If the input data does not meet the conditions, an exception is thrown to indicate that the input data is incorrect. If the data meets the conditions, the data is encapsulated as a data.table data frame. Check the weight variable for input errors and use the repair function to correct the input errors. If the first digit is 1 or 2, keep the first three digits. If the first digit is not 1 or 2, keep the first two digits. S13, calculate derived variables: group the whole blood donors based on the ID variable, calculate the variable of the number of days between blood donations according to the blood donation date; calculate the derived variables such as the historical Hb test mean and historical weight mean for the variables involved in the test data, such as Hb test value and body weight, to meet the actual available data; S14, Histogram interpolation: Use a histogram-based interpolation method to fill in variables with missing data.
[0034] Furthermore, the feature encoding and sample balancing process in S2 includes the following steps: S21, convert the integer variables in the data frame into floating point types to facilitate SMOTE oversampling; S22, convert the character variables in the data frame into factor types to facilitate subsequent encoding processing; S23. Select factor variables with a category cardinality greater than 10 and encode their effects; S24, select factor variables whose category cardinality is greater than 2 and less than 10, and perform one-hot encoding on them; S25. Select a binary factor variable and encode it as a dummy variable; S26, grouping based on the whole blood donor ID variable, selecting the most recent blood donation record data as the test set, and the remaining blood donation record data as the training set; S27. Initialize the R language mlr3 classification task, specify the variable "whether to postpone blood donation" as the classification target, and define "postpone blood donation" as the positive class.
[0035] As the preferred technical solution of the present invention: Furthermore, the prediction model construction and optimization in S3 includes the following steps: S31. Initialize the SMOTE oversampling method to balance the categories of the classification targets; define the SMOTE hyperparameter space: specify its K nearest neighbor parameters and the number of oversampling repetitions as the hyperparameter search targets.
[0036] S32. Initialize the LightGBM learner for learning classification rules; refer to the recommended parameter search space for LightGBM by the automatic hyperparameter optimization software Optuna, and adjust the hyperparameter settings such as the regularization coefficient, number of leaf nodes, random extraction ratio of features and Bagging, Bagging frequency, and the minimum number of samples per leaf node.
[0037] S33. Use the R language mlr3 package to encapsulate the SMOTE oversampling method and the LightGBM learner into a machine learning pipeline and combine them into a learner to be adjusted.
[0038] S34. Initialize the Hyperband tuner and set its parameter to 2, that is, only 1 / 2 of the hyperparameter combinations can enter the next round in each iteration; set the number of iterations of LightGBM to computing resources.
[0039] S35. Use the Successive Halving algorithm to quickly iterate the hyperparameter configuration, use F1-score as the performance indicator, use the Hyperband tuner to evaluate multiple hyperparameter configurations, and save the hyperparameter combination with the best F1-score.
[0040] S36. Use the tuned hyperparameters to construct a tuned model, train the model on the training set data, and then predict the test set data.
[0041] S37. Use indicators such as precision, recall, AUC, F1-score, confusion matrix, etc. to measure the performance of the model after parameter adjustment. If the F1-score of the model's prediction results on the test set reaches above 0.75, its performance is considered acceptable.
[0042] In this application, the LightGBM model refers to an efficient open source framework based on the gradient boosting decision tree GBDT, which is mainly used to quickly process regression and classification tasks in large-scale data sets.
[0043] The Hyperband method refers to an algorithm for efficient hyperparameter optimization that reduces computational costs by adjusting resource allocation and early stopping mechanisms.
[0044] Effect coding refers to a method of encoding categorical variables by generating continuous numerical features by calculating the relationship between each category and the target variable.
[0045] One-hot encoding refers to an encoding method that converts categorical variables into a sparse matrix, where each category value is represented as a 1 in a unique position in a binary vector and 0 in the rest.
[0046] Dummy variable coding refers to a coding method that converts a categorical variable into multiple 0-1 binary variables, usually excluding a benchmark category to avoid collinearity.
[0047] SMOTE refers to a data augmentation method that addresses the problem of insufficient minority class samples in a dataset by generating synthetic examples.
[0048] By systematically searching and optimizing the hyperparameters of the SMOTE and LightGBM models, the performance of the models on the blood donation postponement prediction task can be improved. This not only helps to improve the accuracy of the model, but also enhances the generalization ability of the model, making it more reliable in practical applications.
[0049] Precision refers to the proportion of samples predicted as positive by the classification model that are actually positive, and is used to measure the accuracy of the model's prediction results.
[0050] Recall rate refers to the proportion of actual positive samples that the classification model successfully identifies as positive, and is used to measure the recognition ability of the model.
[0051] AUC refers to the area under the ROC curve, which is used to evaluate the comprehensive discrimination ability of the classification model. The closer the value is to 1, the better the model performance.
[0052] F1-score refers to an indicator that combines precision and recall, and measures the performance of a classification model through their harmonic mean, which is particularly suitable for unbalanced data sets.
[0053] The confusion matrix refers to a matrix representation for evaluating the performance of a classification model, including TP, FP, TN, and FN, which is used to analyze the error type of the model.
[0054] The Successive Halving method is a step-by-step hyperparameter optimization algorithm that reduces resource allocation in rounds to select the best performing hyperparameter configuration. The Successive Halving algorithm improves the efficiency of hyperparameter search by rapidly iterating and eliminating poorly performing configurations.
[0055] By limiting the number of evaluations for each configuration, the Hyperband algorithm is able to explore more hyperparameter combinations with limited computing resources. Successive Halving further accelerates this process, allowing poorly performing configurations to be identified at an early stage, thereby saving computing resources. The Hyperband algorithm and Successive Halving provide an automated hyperparameter search method that reduces the need for manual tuning and improves the repeatability of experiments.
[0056] Shiny is an R package for building interactive web-based applications.
[0057] data.table refers to a data manipulation package in the R language, designed for efficient processing of large data sets, providing fast data filtering, aggregation, sorting, and updating functions.
[0058] The present invention discloses a method for predicting the risk of delayed donation due to low hemoglobin in whole blood donors, comprising a data regularization and outlier processing module, a classification feature encoding module, a category balance and model fitting module, a hyperparameter adjustment module and a model interpretation and deployment module. The prediction method proposed in the present invention performs data regularization and targeted feature encoding on blood donation records and hemoglobin detection data, fits a LightGBM model after category balance using the SMOTE oversampling algorithm, and uses the Hyperband hyperparameter adjustment method to tune the SMOTE and LightGBM parameters, and stores the tuned model for feature importance interpretation, model encapsulation and network deployment, thereby optimizing the whole blood donor invitation strategy and enhancing the continuity and stability of blood supply.
[0059] The above-mentioned specific implementation methods are used to explain the present invention and are only preferred embodiments of the present invention, rather than limiting the present invention. Any modifications, equivalent substitutions, improvements, etc. made to the present invention within the spirit of the present invention and the protection scope of the claims shall fall within the protection scope of the present invention.
Claims
1. A method for predicting the risk of delayed blood donation due to low hemoglobin in whole blood donors, characterized in that: The following steps are involved: S1, integration of basic information of blood donors and pre-donation test data, pre-processing and calculation of derived variables: integrating basic information of blood donors and pre-donation test data to form a comprehensive data set, including personal information, blood donation history, health data and hemoglobin test data; correcting variables with input errors in the comprehensive data set, and calculating the number of days between blood donations and historical Hb mean derived variables; for variables with missing values, using histogram-based interpolation method to fill missing values, and finally constructing a sample data set suitable for statistical analysis; S2, type conversion and feature encoding: convert the integer variables in the sample data set formed in step S1 into floating-point types, and convert the character variables into factor types; perform feature encoding on the factor variables, and construct a machine learning binary classification task; S3, prediction model construction and optimization: For this binary classification task, the SMOTE method is used to oversample the data set, and the LightGBM model is used for classification. At the same time, the Hyperband method is used to optimize the hyperparameters to obtain a performance-optimized model, and the performance of the tuned model is evaluated; The SMOTE method is used to oversample the dataset, and the LightGBM model is used for classification. The Hyperband method is used for hyperparameter optimization: first, SMOTE and LightGBM are initialized, and their hyperparameter search spaces are defined; second, a learning pipeline is constructed and hyperparameter optimization is performed, and finally, the best model is trained and performance evaluated; a learning pipeline is constructed to integrate the two processes of data processing and model training into a unified learner, and the Hyperband method is used to optimize the learner's hyperparameters to obtain a performance-optimized model; finally, the performance of the tuned model is evaluated.
2. The method for predicting the risk of delayed blood donation due to low hemoglobin in whole blood donors according to claim 1, characterized in that: In step S1, blood donation records and hemoglobin test data are collected, including data reading, formatting, input exception processing, and descriptive statistics functions, specifically including the following steps: S11, collect blood donation records and Hb test data; S12, correcting input errors: Check the format of the input data to see if it contains variables such as Hb test value and whether it is delayed. If the input data does not meet the conditions, an exception is thrown to indicate that the input data is incorrect. If the data meets the conditions, the data is encapsulated as a data.table data frame. Check the weight variable for input errors and use the repair function to correct the input errors. If the first digit is 1 or 2, keep the first three digits. If the first digit is not 1 or 2, keep the first two digits. S13, calculation of derived variables: grouping based on the whole blood donor ID variable, and calculating the variable of the number of days between blood donations according to the blood donation date; for variables involved in the test data, such as Hb test value and body weight, calculating derived variables such as the historical Hb test mean and historical body weight mean to meet the actual available data; S14, histogram-based interpolation to fill missing values: Use a histogram-based interpolation method to fill in the missing variables and obtain a sample data set suitable for statistical analysis. S15, descriptive statistics of the adjusted data.
3. The method for predicting the risk of delayed blood donation due to low hemoglobin in whole blood donors according to claim 1, characterized in that: The type conversion and feature encoding in S2 include the following steps: S21, convert the integer variables in the data frame into floating point types to facilitate SMOTE oversampling; S22, convert the character variables in the data frame into factor types to facilitate subsequent encoding processing; S23. Select factor variables with a category cardinality greater than 10 and encode their effects; S24, select factor variables whose category cardinality is greater than 2 and less than 10, and perform one-hot encoding on them; S25. Select a binary factor variable and encode it as a dummy variable; S26, grouping based on the whole blood donor ID variable, selecting the most recent blood donation record data as the test set, and the remaining blood donation record data as the training set; S27. Initialize the R language mlr3 classification task, specify the variable "whether to postpone blood donation" as the classification target, and define "postpone blood donation" as the positive class.
4. The method for predicting the risk of delayed blood donation due to low hemoglobin in whole blood donors according to claim 1, characterized in that: The prediction model construction and optimization in S3 includes the following steps: S31. Initialize SMOTE and use SMOTE to oversample the training data for class balance of classification targets; define the SMOTE hyperparameter space: specify its K nearest neighbor parameters and the number of oversampling repetitions as the hyperparameter search targets; S32. Import the LightGBM library and define its hyperparameter search space: initialize the LightGBM learner for learning classification rules; refer to the recommended parameter search space for LightGBM by the automatic hyperparameter optimization software Optuna, and adjust the hyperparameter settings such as the regularization coefficient, the number of leaf nodes, the random extraction ratio of features and bagging, the bagging frequency, and the minimum number of samples per leaf node; S33. Use the R language mlr3 package to encapsulate the SMOTE oversampling method and the LightGBM learner into a learning pipeline and combine them into a learner to be adjusted. S34. Use Hyperband for hyperparameter optimization, initialize the Hyperband tuner, and set its parameter to 2, that is, only 1 / 2 of the hyperparameter combinations can enter the next round in each iteration; set the number of iterations of LightGBM to computing resources; S35. Use the Successive Halving algorithm to quickly iterate the hyperparameter configuration, use F1-score as the performance indicator, use the Hyperband tuner to evaluate multiple hyperparameter configurations, and save the hyperparameter combination with the best F1-score. S36, constructing a tuned model using the hyperparameters obtained through tuning, training the model on the training set data, and then predicting the test set data; S37. Use indicators such as precision, recall, AUC, F1-score, confusion matrix, etc. to measure the performance of the model after parameter adjustment. If the F1-score of the model's prediction results on the test set reaches above 0.75, its performance is considered acceptable.
Citation Information
Patent Citations
Web anomaly detection method and system based on SMOTETomek and LightGBM
CN110138786A
Automatic credit score card generation method based on meta-learning
CN110866819A
PICC thrombus risk prediction method based on machine learning
CN113270193A
Platelet demand prediction system based on time sequence
CN119028452A
Cited By
Data analysis method and system for blood donation service platform supervision
CN120878177A
Whole blood donation adverse reaction risk prediction method and system
CN121054268A
A method and system for predicting the risk of adverse reactions of whole blood donation
CN121054268B
Blood donation adverse reaction risk prediction method and system based on hierarchical blood volume estimation
CN122494263A
Blood donation adverse reaction risk prediction method and system based on stratified blood volume estimation
CN122494263B