NK cell culture quality prediction method, system and storage medium
By combining feature selection and ensemble learning models with Bayesian optimization and SHAP interpretation, early and accurate prediction of NK cell culture quality is achieved, solving the problem of the inability to assess NK cell quality in the early stages in existing technologies. This improves prediction accuracy and interpretability, and reduces production costs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SICHUAN NEO LIFE STEM CELL BIOTECH
- Filing Date
- 2026-04-15
- Publication Date
- 2026-07-10
AI Technical Summary
Current technology cannot accurately assess cell quality in the early stages of NK cell culture, leading to delays in treatment and wasted production costs.
LASSO regression is used for feature selection, a Stacking ensemble learning model is constructed, and base learners such as XGBoost, logistic regression, random forest, support vector machine and LightGBM are combined. The hyperparameters are tuned by Bayesian optimization, and SHAP is used for model interpretation to build an interactive prediction system.
It improves the accuracy and interpretability of NK cell culture quality prediction, enabling early identification of substandard products, timely intervention or termination of culture, reducing production costs and improving treatment efficiency.
Smart Images

Figure CN122367263A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of cell culture quality control technology, specifically relating to a method, system, and storage medium for predicting the quality of NK cell culture. Background Technology
[0002] Currently, NK cell therapy products have shown high application potential in the treatment of various diseases. However, the quality of expanded NK cells can usually only be evaluated after culture is complete. Currently, there is no method to assess the quality of expanded NK cells early in the culture process. If the NK cell quality does not meet the relevant quality requirements at the end of the culture, it not only delays the optimal treatment time for patients but also wastes production costs. Therefore, in large-scale production and clinical applications, accurate prediction and evaluation of the final cell quality in the early stages of cell culture is particularly important.
[0003] This patent proposes a method, system, and storage medium for predicting NK cell culture quality. The implementation of this technical solution faces several key challenges: First, it requires the efficient collection and processing of large amounts of flow cytometry data, demanding robust data processing capabilities and standardized procedures. Second, the feature selection and model construction processes are complex, necessitating the use of LASSO regression for feature selection and the construction of a Stacking ensemble learning model incorporating multiple base learners, requiring a strong foundation in machine learning theory and practical experience. Furthermore, the use of Bayesian optimization for hyperparameter tuning and SHAP for model interpretation further complicates the implementation. Finally, building an interactive prediction system that supports single-sample input or batch import from Excel, and outputs prediction levels, probability distributions, confidence levels, and culture recommendations, requires strong system development and user interaction design capabilities. Therefore, the implementation of this patent's technical solution presents significant technical challenges due to the need to overcome multiple obstacles. Summary of the Invention
[0004] To address the aforementioned shortcomings in existing technologies, this invention provides a method, system, and storage medium for predicting NK cell culture quality. This addresses the problem that existing NK cell culture methods cannot predict NK cell culture quality in the early stages and provides a reliable process control tool for NK cell culture quality control, thereby reducing overall production costs.
[0005] To solve the above-mentioned technical problems, the present invention adopts the following technical solution:
[0006] One of the objectives of this invention is to provide a method for predicting the quality of NK cell culture, which can accurately assess the quality of NK cell culture, identify substandard products in the early stages, and intervene or terminate the culture in a timely manner.
[0007] To achieve the above objectives, the technical solution of the present invention is as follows:
[0008] A method for predicting the quality of NK cell culture includes the following steps:
[0009] S1. Obtain flow cytometry data at multiple time points during NK cell culture, including cell proportion and fluorescence intensity parameters. Based on the detection data, classify the NK cell culture quality into three levels: high, medium, and low, to form the original dataset.
[0010] S2. Preprocess, standardize, and stratify the original dataset to divide it into training and test sets, while keeping the proportion of samples in the three levels in the training and test sets approximately the same as that in the original dataset.
[0011] S3. Use LASSO regression to select features and identify 5 key features;
[0012] S4. Construct a Stacking ensemble learning model based on key features. The base learners include XGBoost, Logistic Regression, Random Forest, Support Vector Machine, and LightGBM, and the meta-learner is Logistic Regression.
[0013] S5. Automatically tune the model hyperparameters through Bayesian optimization;
[0014] S6. Use SHAP to interpret the model and analyze the contribution of each feature to the prediction results.
[0015] Further optimization of the design involves acquiring flow cytometry data at multiple time points during NK cell culture, including data before inoculation, at the end of the activation phase, and at the time of the last fluid replenishment. Based on the data from the last fluid replenishment, the NK cell culture quality is divided into three levels: high, medium, and low.
[0016] To further optimize the design, the original dataset is preprocessed, standardized, and stratified to divide into training and test sets in a 7:3 ratio. The RobustScaler method is used to standardize the features of the training set, and the standardizer parameters are saved. The same parameters are then used to standardize the test set and new samples.
[0017] Further optimization of the design involves using LASSO regression for feature selection, and introducing L1 regularization to achieve automatic feature filtering. The specific implementation process of feature selection includes data preparation, setting the candidate range of the regularization parameter α, cross-validation evaluation, and selecting the optimal α value.
[0018] To further optimize the design, the Stacking ensemble learning model is constructed based on key features. The base learners include XGBoost, Logistic Regression, Random Forest, Support Vector Machine, and LightGBM, and the meta-learner is Logistic Regression. Bayesian optimization is used to automatically tune the hyperparameters of each base learner and meta-learner, with cross-validation macro-average AUC as the optimization objective.
[0019] To further optimize the design, the model hyperparameters are automatically tuned using Bayesian optimization. The objective function of the optimization adopts the macro-average AUC with 5-fold hierarchical cross-validation. The value range and distribution type of the hyperparameters of each base learner and meta-learner are defined, and the optimization algorithm adopts the Bayesian optimization method.
[0020] To further optimize the design, the model is interpreted using SHAP, and the contribution of each feature to the prediction results is analyzed. The SHAP value is calculated using the Permutation Explainer, and the interpretation methods include overall feature importance, heatmap of feature importance for each category, SHAP value distribution, model prediction confidence distribution, feature correlation matrix, and total SHAP contribution of each sample.
[0021] A second objective of this invention is to provide an NK cell culture quality prediction system for running the above-mentioned NK cell culture quality prediction method on a computer.
[0022] To achieve the above objectives, the technical solution of the present invention is as follows:
[0023] An NK cell culture quality prediction system includes a data acquisition module, a data processing module, a model module, and an interactive prediction module.
[0024] The data acquisition module is configured to: input flow cytometry detection data with 5 key features, and support single sample entry and batch import from Excel;
[0025] The data processing module is configured to standardize the input data using a normalizer saved during model construction.
[0026] The model module is configured to automatically load the Stacking ensemble learning model built and saved based on key features when the system starts.
[0027] The interactive prediction module is configured to output the prediction level, probability distribution, confidence level, and targeted training suggestions for the sample.
[0028] A third objective of this invention is to provide a computer-readable storage medium for implementing the above-mentioned NK cell culture quality prediction method.
[0029] To achieve the above objectives, the technical solution of the present invention is as follows:
[0030] A computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the NK cell culture quality prediction method and the prediction method for further optimization design as described in one of the objectives of this invention.
[0031] Compared with the prior art, the present invention has the following advantages:
[0032] 1. This invention significantly improves the predictive accuracy of NK cell culture quality through feature selection and ensemble learning. Specifically, LASSO regression is used for feature selection, identifying five key features that are not only concise in number but also have clear immunological significance. Based on these key features, a Stacking ensemble learning model is constructed. This model combines multiple base learners such as XGBoost, logistic regression, random forest, support vector machine, and LightGBM. Bayesian optimization is used to automatically tune the model's hyperparameters. By complementing the capabilities of different models, the performance limitations of a single model are overcome, further improving the model's predictive performance.
[0033] 2. This invention interprets the model using SHAP (SHapley Additive exPlanations), analyzing the contribution of each feature to the prediction results. The SHAP value is based on the Shapley value in game theory, which can fairly allocate the "contribution of features to the prediction results," thereby enhancing the interpretability of the model. Through the calculation and interpretation of SHAP values, the impact of each feature on the prediction results can be clarified, helping users better understand the model's decision-making process and identify key monitoring indicators, providing data support for process optimization.
[0034] 3. This invention constructs an interactive prediction system that supports single sample entry and batch import from Excel, outputting the prediction level (high, medium, low), probability distribution, confidence level, and targeted cultivation suggestions for the sample. This user-friendly prediction tool not only facilitates producers in making judgments in the early cultivation stage, but also enables cultivation intervention to improve the quality of non-conforming products or terminate cultivation through prediction.
[0035] 4. This invention significantly improves prediction accuracy through feature selection and ensemble learning, enhances model interpretability by combining SHAP, and provides a user-friendly prediction tool, offering a scientific basis for the quality control process of NK cell culture. Furthermore, the innovation of this patent lies in applying machine learning algorithms to NK cell culture quality prediction, significantly improving prediction accuracy and enhancing model interpretability through feature selection and ensemble learning, thus providing a new solution for the quality control of NK cell therapy products.
[0036] 5. This invention, through a predictive model, can identify substandard products at an early stage, allowing for timely intervention or termination of cultivation, thereby reducing production costs and improving treatment efficiency. Attached Figure Description
[0037] Figure 1 This invention provides an overall flowchart of a method for predicting the quality of NK cell culture.
[0038] Figure 2 The present invention provides a functional module framework diagram of an NK cell culture quality prediction system. Detailed Implementation
[0039] The present invention will be further described below with reference to specific embodiments. It should be understood that these embodiments are for illustrative purposes only and are not intended to limit the scope of the invention. Furthermore, it should be understood that after reading the teachings of this invention, those skilled in the art can make various alterations or modifications to the invention, and these equivalent forms also fall within the scope defined by the appended claims.
[0040] To better explain the technical solution, the following technical terms are explained:
[0041] Flow cytometry is a technique that measures the physical and chemical properties of individual cells. It is widely used in fields such as immunology and oncology and can rapidly analyze the size, internal structure, surface markers, and other characteristics of large numbers of cells.
[0042] LASSO regression is a linear regression model that uses L1 regularization to select features, making some coefficients zero and thus achieving variable selection. LASSO can automatically remove irrelevant features in sparse datasets, improving model interpretability and prediction accuracy.
[0043] Stacking ensemble learning: a machine learning method that combines the predictions of multiple base learners (such as XGBoost, logistic regression, etc.) and then uses a meta-learner (such as logistic regression) for comprehensive judgment to improve the model's prediction performance and generalization ability.
[0044] Bayesian optimization: a global optimization method used to solve problems such as hyperparameter tuning. It guides the search process by constructing a surrogate model of the objective function, finding the optimal parameter combination with the fewest experiments, and is suitable for complex nonlinear function optimization problems.
[0045] SHAP (SHapley Additive exPlanations): A method for interpreting the predictions of machine learning models, based on the concept of Shapley values in game theory. It quantifies the contribution of each feature to the model's predictions, provides an explanation for each prediction, and enhances the model's transparency and interpretability.
[0046] Permutation Explainer: This is an interpreter provided by SHAP used to interpret the output of machine learning models. It calculates the importance of features by shuffling feature values and observing the changes in the model's output.
[0047] Interactive Prediction System: A user-friendly and highly interactive software system that supports user-input data for prediction and displays the prediction results. The system accepts single sample or batch data inputs, providing further analysis and suggestions along with the prediction results to help users understand the meaning and application scenarios of the predictions.
[0048] This embodiment provides a method for predicting the quality of NK cell culture, which specifically includes the following steps:
[0049] S1. Obtain flow cytometry data at multiple time points during NK cell culture, including cell proportion and fluorescence intensity parameters. Based on the detection data, classify the NK cell culture quality into three levels: high, medium, and low, to form the original dataset.
[0050] Specifically, flow cytometry data were obtained at multiple time points during NK cell culture, including data before inoculation, at the end of the activation phase, and at the time of the final fluid infusion. Based on the data at the time of the final fluid infusion, NK cell culture quality was categorized into high, medium, and low quality levels. NK cell samples were collected according to the flow cytometry requirements. After flow cytometry analysis, parameters including, but not limited to, those in the table below were collected:
[0051]
[0052] Based on this, and using the Last-Day-NB detection data, the training samples are divided into three levels: high, medium, and low, which serve as the target variable. The grading criteria are shown in the table below:
[0053]
[0054] S2. Preprocess, standardize, and stratify the original dataset to divide it into training and test sets, while maintaining the proportion of samples in the three levels of the training and test sets approximately the same as that in the original dataset.
[0055] Specifically, since flow cytometry is a routine assay during culture, there is no data gap. Furthermore, based on the stability of flow cytometry, all collected results are considered normal physiological levels of the cells and are therefore regarded as normal values.
[0056] Data splitting employs stratified sampling, dividing the dataset into training and test sets in a 7:3 ratio to ensure consistent sample distribution across categories. The RobustScaler method is used to standardize the features of the training set, and the standardizer parameters are saved. The same parameters are then used to standardize the test set and new samples.
[0057] S3. Use LASSO regression to select features and filter out 5 key features.
[0058] Specifically, LASSO (Least Absolute Shrinkage and Selection Operator) regression is used as the feature selection method. L1 regularization is introduced to achieve automatic feature selection. The specific implementation process for feature selection is as follows:
[0059] 1. Data Preparation
[0060] First, all candidate features are extracted from the preprocessed and standardized training set data, and the target variable is set as Last-Day-NB. The feature matrix is denoted as X. train The target variable is denoted as Y. train The test set data is also retained, but is only used for evaluation after feature selection.
[0061] 2. Set the candidate range for the regularization parameter α.
[0062] In LASSO regression, the regularization parameter is denoted by α. To comprehensively search for the optimal α, a wide candidate range is defined, covering the interval from very small penalties to large penalties. Specifically, 150 candidate α values are generated using logarithmic intervals, ranging from 10... -4 Up to 10 2 (i.e., from 0.0001 to 100). This ensures both the precision of the search and coverage of models with different sparsity levels.
[0063] 3. Cross-validation evaluation
[0064] To evaluate the predictive performance of the model at each α level, 10-fold cross-validation (K-Fold Cross-Validation) was used. Specific steps:
[0065] The training set is randomly divided into 10 subsets of similar size, and each subset is called a fold.
[0066] For each candidate α value, 9 folds are used as training data and the remaining 1 fold is used as validation data, and this process is repeated 10 times.
[0067] In each fold, the LASSO model is used to fit the training data, and the mean squared error (MSE) on the validation set is calculated.
[0068] The average MSE of 10 validations is taken as the mean cross-validation error (CV Score) under that α, and the standard deviation (CV Std) is calculated for subsequent 1SE rules.
[0069] 4. Evaluation Indicators
[0070] Mean squared error (MSE) is chosen as a metric for model performance, but to avoid potentially excessive model complexity (by retaining too many features), other criteria are combined to select a sparser model.
[0071] 5. Strategy for selecting the optimal α
[0072] This invention employs three strategies to comprehensively determine the final α value: prioritizing the number of target features, followed by the 1SE rule, and finally considering the minimum error as an alternative.
[0073] (1) Minimum cross-validation error criterion
[0074] The α value that minimizes the average cross-validation error is directly selected and denoted as α. min This model offers the highest prediction accuracy, but it typically includes a large number of features. While it boasts the best predictive performance, an excessive number of features can lead to model complexity, increased risk of overfitting, and difficulty in interpretation.
[0075] (2) 1SE (1 Standard Error) rule
[0076] To strike a balance between prediction accuracy and model simplicity, the 1SE rule is employed. This rule selects the sparsest model (i.e., the model with the fewest features) within a range of one standard deviation of minimum error. The specific steps are as follows:
[0077] Calculate the minimum error MSE min and its standard deviation Std min ;
[0078] Set the error threshold to Threshold=MSE min + Std min ;
[0079] Among all α values with average errors less than or equal to the threshold, the α with the fewest feature numbers is selected and denoted as α. 1SEThis model significantly reduces the number of features while maintaining performance comparable to the optimal model.
[0080] In this invention, α 1SE The corresponding feature number is approximately 8, compared to α. min The number of features (15) was reduced by nearly half, while the prediction error increased by less than one standard deviation, demonstrating good generalization ability.
[0081] (3) Target feature quantity criterion
[0082] Considering the interpretability and ease of practical application of the model, this invention introduces a target feature quantity range, aiming to retain 20%–50% of the original total number of features (approximately 4–11 features), with an ideal target of 30% (approximately 6–7 features). Based on this, all candidate α values are iterated to find those α values whose feature quantity falls within the target range, and then the α with the smallest cross-validation error is selected and denoted as α. target If there are no candidate values within the target range, then the feature number α that is closest to the target range is selected.
[0083] In this invention, multiple α values were found within the target range through calculation, and ultimately, α values with a minimum number of 5 features and a small error were selected. target The corresponding features are: D6-TB, D6-69-TB, D6-69-NB, D6-25-T-MFI, and D6-NB. These five features are not only concise in number but also have clear immunological significance. Furthermore, the cross-validation error is only about 2% higher than the minimum error, which is perfectly acceptable.
[0084] 6. The final determination of α
[0085] After comparing the three strategies, the result of the target feature quantity criterion was prioritized. This is because this criterion directly serves practical application needs, constructing a model that is both accurate and concise, facilitating subsequent ensemble learning and interpretive analysis. Therefore, α was ultimately selected. target As a regularization parameter for the LASSO model, it corresponds to 5 features.
[0086] S4. Construct a Stacking ensemble learning model based on key features. The base learners include XGBoost, Logistic Regression, Random Forest, Support Vector Machine, and LightGBM, and the meta-learner is Logistic Regression.
[0087] Specifically, a Stacking ensemble learning model is constructed based on five selected key features. The base learners include XGBoost, Logistic Regression, Random Forest, Support Vector Machine (SVM), and LightGBM; the meta-learner uses Logistic Regression. Bayesian optimization is employed to automatically tune the hyperparameters of each base learner and meta-learner, with the cross-validation macro-average AUC as the optimization objective to obtain the optimal parameter combination.
[0088] 1. Selection and configuration of base learners
[0089] The selection of base learners (first-layer models) is based on the following principles: (1) Diversity: covering different learning paradigms (tree models, linear models, kernel methods) to capture different types of patterns in the data; (2) High performance: each base learner has been proven to have good predictive ability in similar problems; (3) Interpretability: facilitating subsequent SHAP analysis.
[0090] This invention selects five representative machine learning algorithms as base learners, and their specific configurations (parameters) are automatically tuned on the training set using Bayesian optimization to maximize the macro-average AUC of 5-fold cross-validation. The base learners and the final determined optimal parameters are as follows:
[0091] (1) XGBoost (Extreme Gradient Boosting)
[0092] XGBoost is a high-efficiency algorithm based on gradient boosting decision trees, offering advantages such as regularization and parallel processing. It can automatically handle missing values and avoid overfitting. Its optimal parameters are:
[0093] n_estimators: 150 (number of trees)
[0094] max_depth: 4 (maximum depth of each tree)
[0095] learning_rate: 0.1 (learning rate, which controls the weight of each tree's contribution)
[0096] subsample: 0.8 (the proportion of random sampling during training of each tree)
[0097] colsample_bytree: 0.8 (the proportion of features randomly selected when training each tree)
[0098] reg_alpha: 0.5 (L1 regularization coefficient)
[0099] reg_lambda: 0.5 (L2 regularization coefficient)
[0100] random_state: 42 (fixed random seed to ensure repeatability)
[0101] eval_metric: 'mlogloss' (multi-class log loss, used for internal validation)
[0102] (2) Logistic Regression
[0103] Logistic regression is a classic linear classification model with advantages such as simple computation, strong interpretability, and low overfitting risk. For multi-class classification problems, this invention employs a "one-vs-rest" strategy and optimizes the following parameters:
[0104] C: 1.0 (the reciprocal of the regularization strength; the smaller the value, the stronger the regularization)
[0105] penalty: 'l2' (L2 regularization)
[0106] solver: 'lbfgs' (A quasi-Newton optimizer suitable for multi-class classification; avoid using the deprecated 'liblinear')
[0107] max_iter: 2000 (maximum number of iterations)
[0108] class_weight: 'balanced' (automatically adjusts class weights to address imbalanced samples)
[0109] random_state: 42
[0110] (3) Random Forest
[0111] Random forest is a Bagging-based ensemble algorithm that constructs multiple decision trees and outputs the results through voting. It is resilient to overfitting and capable of handling high-dimensional data. Its optimal parameters are:
[0112] n_estimators: 100 (number of decision trees)
[0113] max_depth: 5 (Maximum depth of each tree, limiting overfitting)
[0114] min_samples_split: 5 (Minimum number of samples required to further split internal nodes)
[0115] min_samples_leaf: 2 (Minimum number of samples per leaf node)
[0116] max_features: 'sqrt' (the number of features to consider in each split, taken as the square root)
[0117] bootstrap: True (whether to use bootstrap sampling)
[0118] class_weight: 'balanced' (class weights are balanced)
[0119] random_state: 42
[0120] (4) Support Vector Machine (SVM)
[0121] SVM maps data to a high-dimensional space using kernel functions to find the optimal classification hyperplane, demonstrating excellent performance for small sample sizes and nonlinear problems. This invention employs a probabilistic SVM (i.e., output probability estimation), with the following parameters:
[0122] C: 1.0 (penalty coefficient, controlling the tolerance for misclassification)
[0123] kernel: 'rbf' (radial basis function, suitable for nonlinear relationships)
[0124] gamma: 'scale' (kernel function coefficient, value is 1 / (number of features × feature variance))
[0125] probability: True (Enable probability estimation)
[0126] class_weight: 'balanced' (class weights are balanced)
[0127] random_state: 42
[0128] (5) LightGBM (Lightweight Gradient Booster)
[0129] LightGBM is a histogram-based gradient boosting framework that offers fast training speeds, low memory usage, and is particularly suitable for large-scale datasets. Its optimal parameters are:
[0130] n_estimators: 100 (number of iterations)
[0131] max_depth: 3 (maximum depth of the tree, to prevent overfitting)
[0132] learning_rate: 0.05 (learning rate)
[0133] num_leaves: 31 (The number of leaf nodes in each tree, adjusted to 31 through Bayesian optimization to balance fitting ability and complexity)
[0134] subsample: 0.8 (sample sampling ratio)
[0135] colsample_bytree: 0.8 (feature sampling ratio)
[0136] reg_alpha: 0.1 (L1 regularization coefficient)
[0137] reg_lambda: 0.1 (L2 regularization coefficient)
[0138] min_child_samples: 5 (Minimum number of samples for leaf nodes)
[0139] class_weight: 'balanced' (class weights are balanced)
[0140] random_state: 42
[0141] verbosity: -1 (Turns off training output)
[0142] 2. Setting up the meta-learner
[0143] The meta-learner (second-layer model) is responsible for integrating the outputs of the five base learners and generating the final prediction result. This invention chooses logistic regression as the meta-learner for the following reasons:
[0144] (1) Logistic regression is simple and efficient, and is not prone to overfitting, making it suitable as a fusion device;
[0145] (2) The output is a probability, which can be directly used to calculate the prediction confidence level;
[0146] (3) Fewer parameters, making it easier to interpret and optimize.
[0147] The specific configuration of the meta-learner (also optimized and adjusted using Bayesian methods) is as follows:
[0148] C: 0.5 (regularization strength, moderate regularization to prevent overfitting)
[0149] penalty: 'l2' (L2 regularization)
[0150] solver: 'lbfgs' (optimization algorithm)
[0151] max_iter: 2000
[0152] random_state: 42
[0153] 3. Stacking Integration Strategy
[0154] This invention uses StackingClassifier from the Scikit-learn library to implement the above integration strategy. The key parameter settings are as follows:
[0155] estimators: A list of five base learners, each element being a tuple of (name, model object).
[0156] final_estimator: Meta-learner for logistic regression.
[0157] cv: 5 (Using 5-fold cross-validation to generate secondary training data, that is, for each base learner, training is done using 4-fold data, predicting the remaining 1-fold data, and finally generating the prediction results of the base learner for each training sample, which are used as the input of the meta-learner. This method effectively prevents data leakage and ensures that the meta-learner is trained on independent data.)
[0158] passthrough: True (This allows the original 5 key features to also be used as input to the meta-learner, enabling the meta-learner to make decisions based on both the output of the base learner and the original features, thus enhancing the model's expressive power.)
[0159] n_jobs: -1 (Parallel computation, making full use of multi-core CPUs to accelerate training.)
[0160] Through the above design, the Stacking model can combine the advantages of different base learners: XGBoost and LightGBM capture complex nonlinear relationships between features; Random Forest provides robust ensemble output; Logistic Regression provides linear decision boundaries; and SVM handles nonlinear patterns under small sample sizes. The meta-learner then learns how to optimally combine these predictions to achieve better generalization performance than a single model.
[0161] 4. Training and Validation
[0162] The Stacking model is trained using a training set containing five key features after standardization and feature selection. During training, the base learner generates secondary features using 5-fold cross-validation, and the meta-learner fits these features to the original features.
[0163] S5. The model hyperparameters are automatically tuned through Bayesian optimization. The objective function of the optimization adopts the macro-average AUC with 5-fold hierarchical cross-validation. The value range and distribution type of each base learner and meta-learner hyperparameter are defined, and the optimization algorithm adopts the Bayesian optimization method.
[0164] Specifically, after constructing the Stacking ensemble learning model, the hyperparameters of each base learner and meta-learner have a significant impact on model performance. Traditional manual hyperparameter tuning or grid search is inefficient and struggles to find the globally optimal combination. This invention employs a Bayesian optimization method to automatically and efficiently search for the optimal hyperparameter combination to maximize the model's predictive performance under cross-validation. The objective function, search space, and specific steps of the optimization algorithm are as follows:
[0165] 1. Optimization objective function
[0166] The goal of hyperparameter optimization is to maximize the model's generalization ability on unseen data. This invention uses the macro-averaged AUC (Area Under the ROC Curve) with 5-fold hierarchical cross-validation as the objective function. The specific definition is as follows:
[0167] The training set is randomly divided into 5 subsets of similar size, while maintaining the same proportion of each category as the original training set (stratified sampling).
[0168] For each fold, four folds of data are used to train the model (including the current combination of hyperparameters to be evaluated), and the remaining fold is used for validation;
[0169] On the validation set, the area under the ROC curve (AUC) of the model for each class is calculated, and then the arithmetic mean of the AUCs of each class is taken, which is the macro average AUC.
[0170] Repeat 5 times to obtain 5 macro average AUC values, and take the average value as the performance index of the current hyperparameter combination.
[0171] The reasons for choosing macro average AUC instead of accuracy as the objective function are: (1) AUC is not sensitive to class imbalance and can more comprehensively reflect the model's ability to distinguish between different classes; (2) macro average treats each class equally and avoids the majority class dominating the optimization process.
[0172] 2. Definition of search space
[0173] The search space is fundamental to Bayesian optimization; it defines the range and distribution type of each hyperparameter. This invention defines the search space for each of the five base learners and one meta-learner, as follows:
[0174]
[0175]
[0176] For each hyperparameter, its distribution type (uniform distribution, log-uniform distribution, categorical distribution) is set according to industry conventions. For example, the learning rate and regularization coefficient are usually sampled uniformly on a logarithmic scale to better explore orders of magnitude variation.
[0177] 3. Specific steps of the Bayesian optimization algorithm
[0178] This invention employs the TPE (Tree-structured Parzen Estimator) algorithm from the Optuna framework as the core of Bayesian optimization. After optimization, the hyperparameter combination that maximizes the objective function value is selected from historical data as the final result. In this invention, the Optuna library is used to implement the optimization process. Through the Bayesian optimization process, this invention performs 100 iterative searches on the hyperparameters of the five base learners and the meta-learner, ultimately obtaining the optimal hyperparameter combination.
[0179] S6. Use SHAP to interpret the model and analyze the contribution of each feature to the prediction results.
[0180] Specifically, SHAP is used to interpret the model and analyze the contribution of each feature to the prediction results, including the calculation and interpretation methods of SHAP values.
[0181] 1. SHAP value calculation method
[0182] The SHAP value is based on the Shapley value in game theory, and its core idea is to fairly distribute the contribution of features to the prediction result. In the Stacking ensemble model constructed in this invention, directly calculating the exact Shapley value is computationally infeasible. Therefore, an efficient approximation method—PermutationExplainer (a permutation-based SHAP estimator)—is used to calculate the SHAP value. The specific steps are as follows:
[0183] Background dataset selection: A certain number of samples are randomly selected from the training set as the background dataset. The background dataset is used to simulate the model output when features are missing and is the basis for SHAP estimation.
[0184] Interpreter Construction: Using `shap.PermutationExplainer`, the model's prediction function (`predict_proba`) and the background dataset are passed in. This interpreter estimates the marginal contribution of each feature by repeatedly randomly shuffling the feature values and observing the changes in the model's output. Its core idea is to randomly shuffle the values of a feature on the background dataset, breaking the association between that feature and the target variable, and then calculate the change in the model's output to measure the importance of that feature.
[0185] SHAP value calculation: For each sample to be explained, the interpreter generates a SHAP value for that sample. During the calculation, for each feature, the PermutationExplainer randomly permutates the feature multiple times and takes the average change as an approximation of the SHAP value. Since this is a multi-class classification problem, the output is a three-dimensional array with the shape (n_samples, n_features, n_classes).
[0186] 2. Explanation Method
[0187] The model is explained from different dimensions primarily through six calculation results:
[0188] Overall feature importance: Displays the average absolute SHAP value of each feature. The larger the value, the stronger the feature's global influence on the prediction.
[0189] Heatmap of feature importance for each category: SHAP values are displayed by “feature × predicted category (low / medium / high)”, with color intensity representing contribution size (red = positive contribution, yellow = weak contribution, dark red = strong positive contribution).
[0190] SHAP value distribution: Shows the distribution of SHAP values for all samples, reflecting the positive or negative direction and concentration of the feature's influence;
[0191] Model prediction confidence distribution: This shows the distribution of the model's "confidence" (such as probability values) for the sample predictions, reflecting the stability of the model's predictions;
[0192] Feature correlation matrix: Displays the correlation between features (color represents correlation coefficient: -1 to 1, blue = negative correlation, red = positive correlation).
[0193] Total SHAP Contribution of Each Sample: Displays the total SHAP contribution of each sample (the sum of the absolute values of all feature SHAP values), reflecting the overall influence of the sample on the model's predictions.
[0194] The calculation results analyze the feature contribution logic of the model layer by layer from four dimensions: global importance, local contribution, interaction effect, and distribution pattern.
[0195] 3. Summary of the entire process of interpreting the SHAP model
[0196] Calculation phase: For the tree-based model, use "PermutationExplainer" to calculate the full sample SHAP value and determine the baseline value;
[0197] Global analysis: Core features are identified through a {feature importance bar chart}, and feature independence is verified by combining it with a {correlation matrix};
[0198] Contribution patterns: Use heatmaps to clarify the relationship between feature values and contribution directions, and use SHAP value distribution to verify the dominance of contributions;
[0199] Local implementation: Key samples are located through the {total contribution line chart}, and then the feature contribution details of individual samples are broken down using a waterfall chart;
[0200] Model optimization: Based on the conclusions, core features can be retained, abnormal samples can be optimized, or new feature engineering schemes can be designed for feature interactions.
[0201] This embodiment provides an NK cell culture quality prediction system, including a data acquisition module 21, a data processing module 22, a model module 23, and an interactive prediction module 24.
[0202] The data acquisition module 21 is configured to: input flow cytometry detection data with 5 key features, supporting single sample entry and batch import from Excel;
[0203] Data processing module 22 is configured to: standardize the input data using the normalizer saved during model building;
[0204] Model module 23 is configured to automatically load the Stacking ensemble learning model built and saved based on key features when the system starts.
[0205] The interactive prediction module 24 is configured to output the prediction level, probability distribution, confidence level, and targeted training suggestions for the sample.
[0206] This embodiment provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement a method for predicting the quality of NK cell culture.
[0207] The above description is merely a preferred embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent structural or procedural transformations made based on the content of the present invention's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of the present invention.
Claims
1. A method for predicting the quality of NK cell culture, characterized in that, Includes the following steps: S1. Obtain flow cytometry data at multiple time points during NK cell culture, including cell proportion and fluorescence intensity parameters. Based on the detection data, classify the NK cell culture quality into three levels: high, medium, and low, to form the original dataset. S2. Preprocess, standardize, and stratify the original dataset to divide it into training and test sets, while keeping the proportion of samples in the three levels in the training and test sets approximately the same as that in the original dataset. S3. Use LASSO regression to select features and identify 5 key features; S4. Construct a Stacking ensemble learning model based on key features. The base learners include XGBoost, Logistic Regression, Random Forest, Support Vector Machine, and LightGBM, and the meta-learner is Logistic Regression. S5. Automatically tune the model hyperparameters through Bayesian optimization; S6. Use SHAP to interpret the model and analyze the contribution of each feature to the prediction results.
2. The method for predicting the quality of NK cell culture as described in claim 1, characterized in that: The process involves acquiring flow cytometry data at multiple time points during NK cell culture, including data before inoculation, at the end of the activation phase, and at the time of the last fluid replenishment. Based on the data from the last fluid replenishment, the NK cell culture quality is categorized into three levels: high, medium, and low.
3. The method for predicting the quality of NK cell culture as described in claim 2, characterized in that: The original dataset is preprocessed, standardized, and stratified to divide into training and test sets in a 7:3 ratio. The RobustScaler method is used to standardize the features of the training set, and the standardizer parameters are saved. The same parameters are then used to standardize the test set and new samples.
4. The method for predicting the quality of NK cell culture as described in claim 3. Its characteristics are: The feature selection using LASSO regression achieves automatic feature filtering by introducing L1 regularization. The specific implementation process of feature selection includes data preparation, setting the candidate range of the regularization parameter α, cross-validation evaluation, and selecting the optimal α value.
5. The method for predicting the quality of NK cell culture as described in claim 4, characterized in that: The Stacking ensemble learning model constructed based on key features includes XGBoost, Logistic Regression, Random Forest, Support Vector Machine, and LightGBM as base learners and Logistic Regression as the meta-learner. Bayesian optimization is used to automatically tune the hyperparameters of each base learner and meta-learner, with cross-validation macro-average AUC as the optimization objective.
6. The method for predicting the quality of NK cell culture as described in claim 5, characterized in that: The model hyperparameters are automatically tuned through Bayesian optimization. The objective function of the optimization adopts the macro-average AUC with 5-fold hierarchical cross-validation. The value range and distribution type of the hyperparameters of each base learner and meta-learner are defined, and the optimization algorithm adopts the Bayesian optimization method.
7. The method for predicting the quality of NK cell culture as described in claim 6, characterized in that: The model is explained using SHAP, and the contribution of each feature to the prediction results is analyzed. The SHAP value is calculated using PermutationExplainer, and the interpretation methods include overall feature importance, heatmap of feature importance for each category, SHAP value distribution, model prediction confidence distribution, feature correlation matrix, and total SHAP contribution of each sample.
8. An NK cell culture quality prediction system, comprising a data acquisition module, a data processing module, a model module, and an interactive prediction module, characterized in that, The data acquisition module is configured to: input flow cytometry detection data with 5 key features, and support single sample entry and batch import from Excel; The data processing module is configured to standardize the input data using a normalizer saved during model construction. The model module is configured to automatically load the Stacking ensemble learning model built and saved based on key features when the system starts. The interactive prediction module is configured to output the prediction level, probability distribution, confidence level, and targeted training suggestions for the sample.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores program instructions that, when executed by a processor, implement the method as described in any one of claims 1 to 7.