Traditional Chinese medicine preparation quality detection method based on multi-dimensional data analysis
Through multi-dimensional data analysis, including feature selection, dimensionality reduction and model fusion, the problems of data fusion and model selection in quality testing of traditional Chinese medicine preparations are solved, comprehensive and accurate detection of the quality of traditional Chinese medicine preparations is achieved, and detection accuracy and adaptability are improved.
Patent Information
- Application Number
- CN202410751830.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-12
- Publication Date
- 2024-10-15
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing technology has deficiencies in data fusion, feature selection and dimensionality reduction, model selection and fusion, etc. in the quality inspection of traditional Chinese medicine preparations, making it difficult to achieve comprehensive and accurate quality inspection.
Multidimensional data analysis methods are used to select features through lasso regression, dimensionality reduction through principal component analysis or independent component analysis, build ridge regression, polynomial regression and deep learning models, and integrate multiple single models through ensemble learning methods. Real-time data for quality inspection.
It improves the accuracy and adaptability of quality testing of traditional Chinese medicine preparations, achieves comprehensive and accurate detection of the quality of traditional Chinese medicine preparations, reduces manual intervention, and improves detection efficiency and reliability.
Smart Images

Figure CN118782269A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of quality inspection, and in particular to a method for inspecting the quality of traditional Chinese medicine preparations based on multidimensional data analysis. Background Art
[0002] As an important part of traditional medicine, Chinese herbal preparations have received extensive attention and application around the world. However, due to the complexity of its ingredients and the diversity of its preparation processes, the quality control of Chinese herbal preparations has always been a technical challenge. Traditional quality control methods often rely on a single detection indicator, such as the determination of the content of the active ingredient. Although this method is simple and direct, it is difficult to fully reflect the overall quality of Chinese herbal preparations. Therefore, it is particularly important to develop a method that can comprehensively consider multidimensional data and achieve comprehensive and accurate quality detection.
[0003] In recent years, with the rapid development of data analysis technology, multidimensional data analysis methods have been widely used in various fields. In the field of quality control of traditional Chinese medicine preparations, researchers have also begun to try to use multidimensional data to improve the accuracy and comprehensiveness of quality inspection. However, the existing technology still has some shortcomings when applying multidimensional data analysis to the quality inspection of traditional Chinese medicine preparations:
[0004] Data fusion problem: The multidimensional data of Chinese medicine preparations include preparation ingredients, preparation process parameters and corresponding quality attributes. These data come from different sources and have different properties. How to effectively fuse these data and extract information useful for quality inspection is a technical challenge.
[0005] Feature selection and dimensionality reduction: The multidimensional data of traditional Chinese medicine preparations often contain a large number of redundant and irrelevant features, which not only increase the complexity of the model but also may reduce the accuracy of quality inspection. Therefore, how to perform effective feature selection and dimensionality reduction is another problem that needs to be solved.
[0006] Model selection and fusion: When building a prediction model, how to select a suitable model and how to effectively fuse multiple single models to improve the accuracy and stability of quality detection are also areas that need improvement in existing technologies.
[0007] Real-time and adaptability: A large amount of real-time data will be generated during the production process of Chinese medicine preparations. How to use this data for real-time quality testing and adjust the model in time to adapt to changes in the production process is a challenge faced by existing technologies.
[0008] In summary, although multidimensional data analysis has broad application prospects in the quality inspection of traditional Chinese medicine preparations, the existing technology still has many shortcomings. Therefore, this study proposes a quality inspection method for traditional Chinese medicine preparations based on multidimensional data analysis, aiming to solve the above problems. Summary of the invention
[0009] The present invention provides a method for detecting the quality of Chinese medicine preparations based on multidimensional data analysis. By comprehensively using technical means such as feature selection, dimensionality reduction processing, model construction and fusion, a comprehensive and accurate detection of the quality of Chinese medicine preparations is achieved, providing a new technical means for the quality control of Chinese medicine preparations.
[0010] The first aspect of the present invention provides a method for detecting the quality of Chinese medicine preparations based on multidimensional data analysis, the method comprising: collecting multidimensional data of Chinese medicine preparations, the multidimensional data of Chinese medicine preparations including preparation ingredients, preparation process parameters and corresponding quality attributes; performing feature selection based on the multidimensional data of Chinese medicine preparations in combination with lasso regression to obtain key influencing data on the quality of Chinese medicine preparations; performing dimensionality reduction processing based on the key influencing data on the quality of Chinese medicine preparations by principal component analysis or independent component analysis to extract the main features of the quality of Chinese medicine preparations; constructing a prediction model based on the main features of the quality of Chinese medicine preparations, and using ridge regression to establish a prediction model for quality attributes with obvious linear relationships. Prediction model, and / or use polynomial regression nonlinear model for quality attributes with obvious nonlinear relationship to obtain trained ridge regression prediction model, polynomial regression nonlinear model, build deep learning model according to the main quality characteristics of Chinese medicine preparation, and further improve the prediction accuracy according to the automatic feature extraction ability of deep learning model to obtain trained deep learning model; based on the trained ridge regression prediction model, polynomial regression nonlinear model, deep learning model, use integrated learning method to fuse multiple single models; based on the real-time data in the multidimensional data of Chinese medicine preparation, input it into the above-mentioned trained model, and obtain the quality detection result of Chinese medicine preparation by fusing multiple single models.
[0011] Optionally, in a first implementation method of the first aspect of the present invention, the multidimensional data of Chinese medicine preparations is collected, and the multidimensional data of Chinese medicine preparations includes preparation ingredients, preparation process parameters and corresponding quality attributes, including: using high performance liquid chromatography and gas chromatography to determine the content of active ingredients in the Chinese medicine preparations, and obtaining the fingerprint of the Chinese medicine preparations by chromatography-mass spectrometry; and / or using Raman spectroscopy or terahertz spectroscopy for non-destructive testing to quickly obtain the ingredient information of the Chinese medicine preparations, combining chemometric methods to analyze the spectral data and extract feature information; and / or using computer vision technology to perform defect detection on the appearance of the Chinese medicine preparations, analyzing the microscopic images through a deep learning model, and identifying the cell structure of the Chinese medicine preparations. and tissue characteristics; using a data fusion algorithm to fuse the obtained data, including chemical data, spectral data, and image data, to obtain multidimensional data of traditional Chinese medicine preparations; preprocessing the multidimensional data of traditional Chinese medicine preparations, including data cleaning, format conversion, and standardization, using mean, median, or mode filling for missing value processing for numerical data, and using interpolation methods for time series data, including linear interpolation and Lagrange interpolation for missing value processing, and using the IQR method to identify and process outliers; and / or applying anomaly detection algorithms based on machine learning, including isolation forest or DBSCAN clustering to identify outliers; using filters or smoothing techniques to reduce noise in the data; applying Min-Max to numerical data Scaling and Z-Score Standardization methods are used for normalization to eliminate the dimensional differences between different features; categorical data are one-hot encoded or label encoded so that machine learning models can process them; continuous variables are binned to convert continuous values into categorical values; the preprocessed data should maintain the same structure as the input data, and the output data includes a cleaned, non-missing, anomaly-free, uniformly formatted and standardized multidimensional data table, in which each column represents a feature and each row represents a sample.
[0012] Optionally, in a second implementation of the first aspect of the present invention, feature selection is performed based on the multidimensional data of the Chinese medicine preparation in combination with lasso regression to obtain key quality influencing data of the Chinese medicine preparation, and principal component analysis or independent component analysis is used to perform dimensionality reduction processing based on the key quality influencing data of the Chinese medicine preparation to extract the main quality features of the Chinese medicine preparation, including: receiving the multidimensional data of the Chinese medicine preparation as input, lasso regression is a linear regression method, feature selection is achieved by performing L1 regularization on the regression coefficient, quality indicators of the Chinese medicine preparation are used as dependent variables, the quality indicators include active ingredient content and dissolution rate, and multidimensional data are used as independent variables to construct a lasso regression model; The regularization parameter \lambda in lasso regression is determined by cross-validation, \lambda∈[\lambda_min,\lambda_max]. For each \lambda value, K training and validation are performed, and K-1 data sets are selected as training sets each time, and the remaining 1 set is used as validation sets. The average performance index of each \lambda value in K validations is calculated, and the best \lambda is selected. According to the evaluation index, the \lambda value with the best performance is selected as the regularization parameter of lasso regression; according to the size of the regression coefficient, the features that have a significant impact on the quality of traditional Chinese medicine preparations are selected, and the objective function formula of lasso regression is set as:
[0013] \min_{\beta}\left(\sum_{i=1}^{n}(y_i-\beta_0-\sum_{j=1}^{p}x_{ij}\beta_j)^2+\lambda\sum_{j=1}^{p}|\beta_j|\right); where \beta: a vector representing regression coefficients, including \beta_0 and \beta_j, \beta_0 is the intercept term, and \beta_j is the coefficient of the jth feature, where j=1,2,...,p; y_i: the target variable of the i-th observation; x_{ij}: the j-th feature of the i-th observation feature; n: the number of observations; p: the number of features; \lambda: regularization parameter, used to control the strength of the regularization term; the goal of the formula is to find a set of regression coefficients \beta, including \beta_0 and \beta_j, so that the above objective function reaches the minimum value, while minimizing the prediction error, the complexity of the model is controlled by L1 regularization, feature selection is achieved, and overfitting is prevented; the regularization parameter \lambda in lasso regression is determined by cross-validation, and the features that have a significant impact on the quality of traditional Chinese medicine preparations are selected according to the regression coefficients, and the key features selected by lasso regression are output to obtain the key influencing data of the quality of traditional Chinese medicine preparations; the traditional Chinese medicine preparations are The key influencing data of the drug quality are standardized, and the standardized data is set as z_{ij}, then z_{ij}=\frac{x_{ij}-\bar{x}_j}{s_j}; where x_{ij} is the original data, \bar{x}_j is the mean of the j-th column, and s_j is the standard deviation of the j-th column, eliminating the influence of dimension and order of magnitude; by calculating the covariance matrix of the data: Cov(X)=\frac{1}{n-1}\sum_{i=1}^{n}(x_i-\bar{x})(x_i-\bar{x})^T; where Cov(X) represents the covariance matrix of the data matrix X, x_ i is the ith observation (row vector), \bar{x} is the mean of all observations (row vector), and n is the number of observations; the eigenvalue \lambda and the corresponding eigenvector v are obtained by solving the equation Cov(X)v=\lambdav, the eigenvalues are sorted according to their sizes, the eigenvectors corresponding to the first k largest eigenvalues are selected as the principal components, and the data are projected onto the selected principal components, that is, y=XV, where X is the original data matrix, V is the selected principal component matrix, and y is the data after dimensionality reduction, to achieve dimensionality reduction; and / or these independent components are separated by an optimization algorithm to achieve the purpose of dimensionality reduction; the data after dimensionality reduction are output to obtain the main characteristics of the quality of Chinese medicine preparations.
[0014] Optionally, in a third implementation of the first aspect of the present invention, a prediction model is constructed based on the main characteristics of the quality of the Chinese medicine preparation, a prediction model is established by ridge regression for quality attributes with obvious linear relationships, and a polynomial regression nonlinear model is adopted for quality attributes with obvious nonlinear relationships, to obtain a trained ridge regression prediction model and a polynomial regression nonlinear model, and a deep learning model is constructed based on the main characteristics of the quality of the Chinese medicine preparation, and the prediction accuracy is further improved based on the automatic feature extraction capability of the deep learning model to obtain a trained deep learning model, including: obtaining a training set and a validation set based on the main characteristics of the quality of the Chinese medicine preparation; for quality attributes with obvious linear relationships, corresponding features are selected, a prediction model is established by using the ridge regression method, overfitting is prevented by introducing an L2 regularization term, and the ridge is determined by cross-validation and grid search methods. Regularization coefficient in regression, train the model on the training set, and evaluate its performance on the validation set to obtain the trained ridge regression prediction model; for quality attributes with obvious nonlinear relationships, capture the nonlinear relationship by constructing the polynomial form of the features, and establish a nonlinear prediction model using the polynomial regression method. Determine the optimal order of the polynomial through cross-validation, train the model on the training set, and evaluate the performance on the validation set to obtain the trained polynomial regression nonlinear model; design a deep learning network based on data characteristics, including a multi-layer perceptron (MLP) and a convolutional neural network; use the deep structure of the deep learning model to automatically extract high-level features, use back propagation and optimization algorithms to train the deep learning model, and apply early stopping and regularization techniques to prevent overfitting, evaluate the performance of the deep learning model on the validation set to obtain the trained deep learning model.
[0015] Optionally, in a fourth implementation of the first aspect of the present invention, the trained ridge regression prediction model, polynomial regression nonlinear model, and deep learning model are used to fuse multiple single models using an integrated learning method, including: using a stacking method to perform model fusion, assigning different weights to each base model, the base models include ridge regression, polynomial regression, and deep learning models; dividing the training set into two parts, D_1 is used to train the base model, and D_2 is used to generate training data for the meta-learner; using the first part of the training set data to train the ridge regression model, the polynomial regression model, and the deep learning model , then, use these trained models to predict the second part of the training set data; get the predicted values y_{\text{Ridge},i}, y_{\text{Poly},i}, y_{\text{DL},i}; use the predicted results as new features, together with the actual label y_i, to form the training data set of the meta-learner; use the decision tree model as the meta-learner, and use the new training data set generated in the previous step to train the meta-learner. The training data set of the meta-learner is expressed as: D_{\text{meta}}={(y_{\text{ Ridge},i},y_{\text{Poly},i},y_{\text{DL},i},y_i)|i=1,2,\ldots,|D_2|}; where: y_{\text{Ridge},i}, y_{\text{Poly},i}, y_{\text{DL},i} are the predicted values of sample x_i by ridge regression model, polynomial regression model and deep learning model respectively; y_i is the actual label of sample x_i; |D_2| represents the number of samples in data set D_2; the prediction function of meta-learner It can be expressed as: y_{\text{ensemble},i}=f_{\text{meta}}(y_{\text{Ridge},i},y_{\text{Poly},i},y_{\text{DL},i}); where: y_{\text{ensemble},i} is the final prediction result of the meta-learner for sample x_i; f_{\text{meta}} is the prediction function of the meta-learner; to obtain the final prediction result, the meta-learner dynamically adjusts the weights of each base model according to its prediction performance.
[0016] Optionally, in a fifth implementation of the first aspect of the present invention, the real-time data in the multidimensional data of the Chinese medicine preparation is input into the above-mentioned trained model, and the quality inspection result of the Chinese medicine preparation is obtained by fusing multiple single models, including: receiving the multidimensional real-time data of the Chinese medicine preparation, cleaning, standardizing and normalizing the data to ensure data quality and eliminate the dimensional differences between different features; inputting the preprocessed multidimensional real-time data into the trained ridge regression model, polynomial regression model and deep learning model respectively; each model generates a predicted value of the quality inspection result based on the input data; using an additional lightweight neural network to learn and dynamically adjust the weight of each model, the input of this neural network is the prediction results of each single model and the statistical characteristics of the input data, and the output is the weight of each model; by optimizing the parameters of this neural network on the verification set, it can dynamically allocate weights according to actual conditions, thereby improving the accuracy of the fusion result; according to the weights obtained by the dynamic weight allocation mechanism, the prediction results of the three single models are weighted averaged, and the fusion formula is expressed as:
[0017] Quality_Prediction=w1*Ridge_Prediction+w2*Poly_Prediction+w3*DL_Prediction; w1, w2 and w3 are weights obtained through the dynamic weight allocation mechanism; the fused prediction results are post-processed, including denormalization and threshold judgment, and the final quality inspection results of traditional Chinese medicine preparations are output, including specific values, grades or qualified / unqualified judgments.
[0018] Optionally, in the sixth implementation method of the first aspect of the present invention, it also includes: designing a continuous learning and optimization mechanism, regularly using newly collected data to fine-tune the single model and dynamic weight distribution network to maintain the accuracy and adaptability of the model; and / or establishing a real-time feedback mechanism to compare the quality inspection results obtained after model fusion with the quality control data in the actual production process, and continuously optimize and adjust the parameters or structure of the model by analyzing the difference between the model prediction and the actual results to improve the accuracy and reliability of the prediction; and / or developing a data visualization platform to display the multidimensional data and the prediction results of the model in an intuitive way. When the prediction results deviate from the normal range, the data visualization platform automatically triggers an early warning.
[0019] The second aspect of the present invention provides a Chinese medicine preparation quality detection device based on multidimensional data analysis, and the Chinese medicine preparation quality detection device based on multidimensional data analysis includes: an acquisition module, which is used to collect multidimensional data of Chinese medicine preparations, and the multidimensional data of Chinese medicine preparations includes preparation ingredients, preparation process parameters and corresponding quality attributes; a processing module, which is used to perform feature selection based on the multidimensional data of Chinese medicine preparations in combination with lasso regression to obtain key influencing data on the quality of Chinese medicine preparations, and to perform dimensionality reduction processing based on the key influencing data on the quality of Chinese medicine preparations by applying principal component analysis or independent component analysis to extract the main characteristics of the quality of Chinese medicine preparations; a setting module, which is used to construct a prediction model based on the main characteristics of the quality of Chinese medicine preparations, and to use ridge regression for quality attributes with obvious linear relationships. A prediction model is established, and / or a polynomial regression nonlinear model is used for quality attributes with obvious nonlinear relationships to obtain a trained ridge regression prediction model and a polynomial regression nonlinear model; a deep learning model is constructed according to the main quality characteristics of the Chinese medicine preparation, and the prediction accuracy is further improved according to the automatic feature extraction capability of the deep learning model to obtain a trained deep learning model; a fusion module is used to fuse multiple single models according to the trained ridge regression prediction model, the polynomial regression nonlinear model, and the deep learning model using an integrated learning method; an allocation module is used to input the real-time data in the multidimensional data of the Chinese medicine preparation into the above-mentioned trained model, and obtain the quality detection result of the Chinese medicine preparation by fusing multiple single models.
[0020] The third aspect of the present invention provides a Chinese medicine preparation quality inspection device based on multidimensional data analysis, comprising: a memory and at least one processor, wherein the memory stores instructions; the at least one processor calls the instructions in the memory so that the Chinese medicine preparation quality inspection device based on multidimensional data analysis executes the above-mentioned Chinese medicine preparation quality inspection method based on multidimensional data analysis.
[0021] A fourth aspect of the present invention provides a computer-readable storage medium, which stores instructions, and when the computer-readable storage medium is run on a computer, it enables the computer to execute the above-mentioned method for quality detection of traditional Chinese medicine preparations based on multidimensional data analysis.
[0022] In the technical solution provided by the present invention, a method for quality detection of Chinese medicine preparations based on multidimensional data analysis is proposed. First, multidimensional data including preparation ingredients, preparation process parameters and corresponding quality attributes are collected. Then, feature selection is performed using lasso regression to extract key influencing data, and dimension reduction is performed by principal component analysis or independent component analysis to obtain the main characteristics of the quality of Chinese medicine preparations. Then, according to the linear or nonlinear relationship of the data, a ridge regression prediction model, a polynomial regression nonlinear model and a deep learning model are constructed respectively, and multiple single models are fused by an integrated learning method to improve the prediction accuracy. Finally, real-time data is input into the trained model to obtain the quality detection results of the Chinese medicine preparations. In addition, the present invention also includes auxiliary mechanisms such as continuous learning and optimization, real-time feedback and data visualization.
[0023] Beneficial effects Benefits: Improve detection accuracy: Through the comprehensive analysis of multi-dimensional data and the integration of multiple models, it is possible to more comprehensively capture various factors affecting the quality of Chinese medicine preparations, thereby improving the accuracy and reliability of quality detection. Enhanced adaptability: This technology can handle the quality attributes of linear and nonlinear relationships, making the model more adaptable and able to cope with the quality detection needs of different types of Chinese medicine preparations. Continuous optimization capability: Through continuous learning and optimization mechanisms, the model can continuously use new data for fine-tuning, maintain its accuracy and adaptability, and extend the service life of the model. Real-time feedback and early warning: The real-time feedback mechanism can promptly discover the difference between the model prediction and the actual results, and make adjustments and optimizations. At the same time, when the predicted results deviate from the normal range, the data visualization platform can automatically trigger an early warning, which helps to promptly discover problems and take measures. Improve efficiency and reduce costs: Automated quality detection methods can greatly improve detection efficiency, reduce manual intervention and detection costs, and are of great significance to the mass production and quality control of Chinese medicine preparations. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 A schematic diagram of an embodiment of a method for detecting quality of a traditional Chinese medicine preparation based on multidimensional data analysis in an embodiment of the present invention;
[0025] Figure 2 Schematic diagram of another embodiment of the method for detecting the quality of traditional Chinese medicine preparations based on multidimensional data analysis in an embodiment of the present invention;
[0026] Figure 3 Schematic diagram of an embodiment of a Chinese medicine preparation quality detection device based on multidimensional data analysis in an embodiment of the present invention;
[0027] Figure 4 It is a schematic diagram of an embodiment of a Chinese medicine preparation quality inspection device based on multidimensional data analysis in an embodiment of the present invention. DETAILED DESCRIPTION
[0028] The embodiment of the present invention provides a method for detecting the quality of Chinese medicine preparations based on multidimensional data analysis. By comprehensively using technical means such as feature selection, dimensionality reduction processing, model construction and fusion, a comprehensive and accurate detection of the quality of Chinese medicine preparations is achieved, providing a new technical means for the quality control of Chinese medicine preparations. In addition, the terms "including" or "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0029] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 1 In one embodiment of the present invention, a method for detecting the quality of a Chinese medicine preparation based on multidimensional data analysis includes:
[0030] 101. Collect multidimensional data of traditional Chinese medicine preparations, wherein the multidimensional data of traditional Chinese medicine preparations includes preparation ingredients, preparation process parameters, and corresponding quality attributes;
[0031] It is understandable that the execution subject of the present invention may be a Chinese medicine preparation quality detection device based on multidimensional data analysis, or a terminal or a server, which is not specifically limited here. The embodiment of the present invention is described by taking a server as the execution subject as an example.
[0032] It should be noted that, taking a Chinese medicine preparation as an example, detailed information of all its medicinal materials is collected, including the name of the medicinal materials, dosage, origin, etc. For example, the preparation contains ginseng (produced in Jilin, dosage 10 grams), astragalus (produced in Gansu, dosage 15 grams), etc. Preparation process parameters: record the entire preparation process of the preparation, including key process parameters such as extraction method (such as water extraction, alcohol extraction, etc.), extraction time, extraction temperature, solvent type and ratio, drying method (such as spray drying, vacuum drying, etc.), drying temperature and time. For example, water extraction is used for extraction, the extraction time is 2 hours, the extraction temperature is 80°C, the solvent is water, and the subsequent spray drying method is used, the drying temperature is 60°C, and the drying time is 4 hours. Quality attribute data: collect the quality test results of the preparation, such as content determination, fingerprint spectrum, dissolution, stability data, etc. For example, the content of a certain active ingredient in the Chinese medicine preparation is 0.5 mg / g, the similarity between the fingerprint spectrum and the standard spectrum reaches 95%, and the dissolution reaches more than 80% within 30 minutes.
[0033] Integrate the collected multidimensional data into a database to ensure the integrity and accuracy of the data. The database should be designed with a reasonable table structure to store different types of data and support efficient data retrieval and analysis operations. Use multidimensional data analysis tools (such as OLAP tools) to slice, dice, rotate, and other operations on the data in the data warehouse to discover the associations and patterns between the data and obtain multidimensional data of traditional Chinese medicine preparations. For example, the impact of medicinal materials from different origins on the quality of preparations can be analyzed, or the correlation between preparation process parameters and preparation quality can be explored.
[0034] 102. Perform feature selection based on the multidimensional data of the Chinese medicine preparation in combination with lasso regression to obtain key quality influencing data of the Chinese medicine preparation, perform dimensionality reduction processing based on the key quality influencing data of the Chinese medicine preparation using principal component analysis or independent component analysis to extract the main quality characteristics of the Chinese medicine preparation;
[0035] It should be noted that data preparation, multidimensional data set of traditional Chinese medicine preparations: Preparation ingredients: including 10 kinds of medicinal materials such as ginseng, astragalus, and angelica, recording the origin, year, dosage and other data of each medicinal material. Preparation process parameters: extraction temperature (60-90℃), extraction time (1-4 hours), drying temperature (40-70℃), etc. Quality attributes: active ingredient content, dissolution rate, stability index, etc. We collected multidimensional data of 100 samples.
[0036] Feature selection - lasso regression: Data preprocessing: Standardize the data to eliminate the influence of dimension and order of magnitude. Construct a lasso regression model: Take the active ingredient content in the quality attribute as the dependent variable, and the formulation ingredients and preparation process parameters as the independent variables. Use lasso regression for feature selection, and determine which independent variables have a significant impact on the dependent variable by adjusting the regularization strength λ. Determine the key influencing data: After lasso regression, we determined that the origin of ginseng, the amount of astragalus, the extraction temperature and the extraction time are the key influencing factors.
[0037] Dimensionality reduction processing - principal component analysis (PCA): Data preparation: Use lasso regression to screen out key influencing data to construct a new data set. Principal component analysis: Perform principal component analysis on the new data set to extract the first few principal components, which can explain most of the variation in the data set. We extracted 2 principal components, which cumulatively explained 85% of the data variation. Extract the main features: According to the coefficients and scores of the principal components, we can determine the relationship between each principal component and the original features. The first principal component is mainly related to the origin of ginseng and the amount of astragalus, and the second principal component is mainly related to the extraction temperature and extraction time. Through the above analysis, we identified the key factors affecting the quality of Chinese medicine preparations and extracted the main features.
[0038] 103. Construct a prediction model based on the main quality characteristics of the Chinese medicine preparation, use ridge regression to establish a prediction model for quality attributes with obvious linear relationships, and / or use a polynomial regression nonlinear model for quality attributes with obvious nonlinear relationships, obtain a trained ridge regression prediction model and a polynomial regression nonlinear model, construct a deep learning model based on the main quality characteristics of the Chinese medicine preparation, and further improve the prediction accuracy based on the automatic feature extraction capability of the deep learning model to obtain a trained deep learning model;
[0039] It should be noted that we have obtained a data set containing 100 samples through the previous steps (feature selection and dimensionality reduction), each of which has 4 main features (F1, F2, F3, F4) and 1 target quality attribute (such as active ingredient content Y). The data set is divided into a training set (80 samples) and a test set (20 samples).
[0040] Build a ridge regression prediction model, data preprocessing: standardize the feature values to eliminate the dimensional differences between different features. Model training: Use the training set data and select ridge regression as the prediction model. Determine the regularization parameter λ of ridge regression through cross-validation. Train the ridge regression model using the determined λ value. Model evaluation: Use the test set data to evaluate the performance of the model, such as mean square error (MSE) or R 2 The obtained MSE is 0.05, R 2 It is 0.90, indicating that the model has a good prediction effect on quality attributes with obvious linear relationships.
[0041] Construct a polynomial regression nonlinear model. Data preprocessing: Standardization is also performed. Model training: For quality attributes with obvious nonlinear relationships, polynomial regression is selected as the prediction model. The optimal order of the polynomial (such as 2nd or 3rd order) is determined through experiments. The polynomial regression model is trained using the training set data. Model evaluation: The performance of the model is evaluated using the test set data. The MSE obtained is 0.04 and R 2 It is 0.92, indicating that the model also has good prediction ability for quality attributes of nonlinear relationships.
[0042] Build a deep learning model. Data preprocessing: Normalize the data to meet the input requirements of the deep learning model. Model construction: Select a suitable deep learning architecture, such as a multi-layer perceptron (MLP). Determine the number of layers and nodes in the hidden layer, as well as hyperparameters such as activation functions. Use the training set data to train the deep learning model. Model evaluation and optimization: Use the validation set to select the model during the training process to prevent overfitting. Use the test set data to evaluate the performance of the final model. The MSE obtained by the deep learning model is 0.03, and R 2 It is 0.94, indicating that the deep learning model further improves the prediction accuracy through automatic feature extraction.
[0043] 104. Based on the trained ridge regression prediction model, polynomial regression nonlinear model, and deep learning model, an integrated learning method is used to fuse multiple single models;
[0044] It should be noted that in the fusion of ensemble learning models, select an ensemble strategy: select an ensemble strategy, such as simple averaging, weighted averaging, or stacking. In this example, we use simple averaging as the ensemble strategy. Model fusion: For each test set sample, use the ridge regression model, polynomial regression model, and deep learning model for prediction. The prediction results of the three models are simply averaged to obtain the final ensemble prediction result. Performance evaluation: Use the test set data to evaluate the performance of the ensemble model. The performance of the ensemble model on the test set is MSE=0.035, R 2 =0.92.
[0045] By comparing the performance of a single model and an integrated model on the test set, it can be found that the integrated model can usually achieve better prediction accuracy and stability. In this case, the MSE of the integrated model is lower than that of any single model, and R 2 The value is higher, indicating that ensemble learning effectively improves the prediction performance. The trained ensemble model is applied to the actual quality inspection of traditional Chinese medicine preparations to assist quality control and decision support in the production process.
[0046] 105. The real-time data in the multi-dimensional data of traditional Chinese medicine preparations is input into the above-mentioned trained model, and the quality inspection results of traditional Chinese medicine preparations are obtained by fusing multiple single models.
[0047] It should be noted that in the method for quality inspection of Chinese medicine preparations based on multidimensional data analysis, multiple single models that have been trained are used and integrated through an integrated learning method to perform quality inspection on real-time multidimensional data of Chinese medicine preparations. The following is a specific embodiment showing how to input real-time data into the integrated model and obtain the quality inspection results of Chinese medicine preparations.
[0048] Real-time data: We have a batch of newly produced Chinese medicine preparations. Through the testing equipment, we have obtained the following real-time multi-dimensional data (for example only): the content of medicinal material A: 15.3%; the content of medicinal material B: 8.7%; the residual solvent: 0.05%; the preparation temperature: 75℃; the preparation time: 3 hours; other multi-dimensional data;
[0049] Trained model: We have trained and fused three single models through the previous steps: ridge regression model, polynomial regression model and deep learning model. Real-time data preprocessing, data standardization / normalization: Standardize or normalize the real-time data according to the statistical characteristics of the previous training data set (such as mean and standard deviation). For example, the content of medicinal material A can be converted to the z-score of the standard normal distribution. Data format conversion: Make sure that the format of the real-time data is consistent with the data format used when training the model. For example, if the model input requires a feature vector, then the real-time data needs to be converted into a corresponding one-dimensional array. Model prediction, input into a single model: the preprocessed real-time data is input into the ridge regression model, polynomial regression model and deep learning model respectively. Each model will output a prediction value, which represents the prediction of the quality of the Chinese medicine preparation. According to the previously determined integrated learning strategy (such as simple average, weighted average, etc.), the prediction results of the three single models are fused. If the simple average method is used, the prediction values of the three models are added and divided by 3 to obtain the final fusion prediction result; the prediction value output by the fusion model is 85.6 (this value represents a certain quality indicator of the preparation, such as the content of active ingredients, stability, etc.).
[0050] According to the preset quality standards, we can judge the quality level of this batch of Chinese medicine preparations. For example: if the predicted value is above 80, the quality is "excellent"; if the predicted value is between 70-80, the quality is "good"; if the predicted value is between 60-70, the quality is "medium"; if the predicted value is below 60, the quality is "poor". Therefore, according to the prediction results of the fusion model, the quality level of this batch of Chinese medicine preparations is "excellent".
[0051] In an embodiment of the present invention, first, multidimensional data such as preparation ingredients, preparation process parameters, and corresponding quality attributes are collected. Then, feature selection is performed using lasso regression to find out the key factors affecting the quality of Chinese medicine preparations, and dimensionality reduction is performed through principal component analysis or independent component analysis to extract the main features of the quality of Chinese medicine preparations. Then, a prediction model is constructed based on these features, including a ridge regression model, a polynomial regression nonlinear model, and a deep learning model, and these single models are fused through an integrated learning method to improve the prediction accuracy. Finally, real-time data is input into the trained fusion model to obtain the quality test results of the Chinese medicine preparations. By integrating multiple single models through ensemble learning methods, the advantages of each model can be combined, the deviation and variance of a single model can be reduced, and the prediction accuracy of quality inspection can be improved; multiple dimensional data of Chinese medicine preparations are taken into account, including preparation ingredients, preparation process parameters, and quality attributes, which can more comprehensively reflect the quality of Chinese medicine preparations and make the inspection results more accurate and reliable; by inputting real-time data into the trained model, the quality inspection results of Chinese medicine preparations can be quickly obtained, and real-time monitoring can be achieved, which helps to timely discover problems in the production process and make adjustments to ensure product quality; the quality inspection results provided can provide strong support for production decisions, help enterprises optimize production processes, control costs, and improve market competitiveness; combining linear models (ridge regression), nonlinear models (polynomial regression) and deep learning models, it can adapt to different types of quality attribute predictions and has strong flexibility and applicability; accurate quality inspection can reduce the production of unqualified products, avoid waste of resources, and improve production efficiency. At the same time, timely quality feedback can also help adjust the production process and further improve production efficiency.
[0052] See also Figure 2 Another embodiment of the method for detecting the quality of traditional Chinese medicine preparations based on multidimensional data analysis in the embodiment of the present invention includes:
[0053] 201. Collect multidimensional data of traditional Chinese medicine preparations, wherein the multidimensional data of traditional Chinese medicine preparations includes preparation ingredients, preparation process parameters, and corresponding quality attributes;
[0054] Specifically, high performance liquid chromatography and gas chromatography are used to determine the content of active ingredients in Chinese medicine preparations, and the fingerprint of Chinese medicine preparations is obtained by chromatography-mass spectrometry; and / or Raman spectroscopy or terahertz spectroscopy is used for non-destructive testing to quickly obtain the component information of Chinese medicine preparations, and the spectral data is analyzed in combination with chemometric methods to extract feature information; and / or computer vision technology is used to detect defects in the appearance of Chinese medicine preparations, and microscopic images are analyzed through deep learning models to identify the cell structure and tissue characteristics of Chinese medicine preparations; the obtained data, including chemical data, spectral data, and tissue characteristics, are fused using a data fusion algorithm. data, image data, to obtain multidimensional data of traditional Chinese medicine preparations; preprocessing the multidimensional data of traditional Chinese medicine preparations, including data cleaning, format conversion and standardization, using mean, median or mode filling for missing value processing for numerical data, and using interpolation methods for time series data, including linear interpolation and Lagrange interpolation for missing value processing, and using IQR method to identify and process outliers; and / or applying anomaly detection algorithms based on machine learning, including isolation forest or DBSCAN clustering to identify outliers; using filters or smoothing techniques to reduce noise in data; applying Min-Max Scaling and Z-Score Standardization methods to normalize numerical data to eliminate dimensional differences between different features; performing unique hot encoding or label encoding on categorical data so that machine learning models can process it; performing binning on continuous variables to convert continuous values into categorical values; the preprocessed data should maintain the same structure as the input data, and the output data includes a multidimensional data table with no missing, no anomalies, unified format and standardized after cleaning, in which each column represents a feature and each row represents a sample;
[0055] It should be noted that in the embodiment, we are testing a Chinese medicine preparation called "Qingxin Pills". First, we take 10 grams of the preparation and extract the active ingredient therein with an appropriate solvent. Analyzed by high performance liquid chromatograph, the mobile phase is methanol-water solution, gradient elution is adopted, and the detection wavelength is 280nm. It was found that an obvious peak appeared when the retention time was 5.2 minutes. After comparison with the standard product, it was confirmed to be the target active ingredient, and its peak area was 12000. The content of the component calculated according to the standard curve was 2.5%. Take another sample for gas chromatography analysis, using a hydrogen flame ionization detector, and the carrier gas was nitrogen. A peak was detected when the retention time was 3.8 minutes, which was confirmed to be another target active ingredient, and its peak height was 800mV. The content of the component converted by the standard curve was 1.2%.
[0056] Continue to use the "Qingxin Pills" sample and analyze it by chromatography-mass spectrometry. After liquid chromatography separation, the sample enters the mass spectrometer. Through the characteristic peaks of the mass spectrum and their relative abundance, we obtained the unique fingerprint of the traditional Chinese medicine preparation. Among them, we detected 5 main mass peaks, corresponding to 5 different compounds, and the mass-to-charge ratios (m / z) of these compounds were 285, 302, 319, 336 and 353, respectively. : The sample was irradiated with 785nm excitation light and the Raman scattered light signal was collected. In the Raman spectrum, we observed several obvious Raman peaks, located at 800, 1000, 1200 and 1600cm-1, respectively. By analyzing these data by chemometric methods, we successfully extracted the characteristic information of the sample, including the chemical bond type and structural information of the main components. The preparation was imaged using a high-resolution microscope to obtain clear microscopic images. These images are then analyzed by deep learning models (such as convolutional neural networks). After training, the model can accurately identify the cell structure and tissue characteristics in the preparation, such as cell walls, cell nuclei, etc. In this embodiment, the model successfully identified the main plant cell structures in the preparation, and no obvious appearance defects were found. The data obtained by high performance liquid chromatography, gas chromatography, chromatography-mass spectrometry, Raman spectroscopy and computer vision technology are fused. Chemical data (such as active ingredient content), spectral data (such as Raman spectral characteristic peaks) and image data (such as cell structure information in microscopic images) are fused using data fusion algorithms (such as weighted averaging, principal component analysis, etc.). The fused multidimensional data can more comprehensively and accurately reflect the quality characteristics of traditional Chinese medicine preparations, and obtain multidimensional data of traditional Chinese medicine preparations;
[0057] Following the previous example, we will now pre-process the acquired multi-dimensional data of traditional Chinese medicine preparations. The following is a specific example, including steps such as data cleaning, format conversion, and standardization, and is accompanied by specific data descriptions.
[0058] The multidimensional data we obtained includes the following sample data (only part of the data is shown as an example):
[0059] Sample ID Active ingredient A content (%) Raman spectrum peak 1 intensity Microscopic image Cell number
[0060]
[0061] Missing value processing: For missing values of numerical data (such as the content of active ingredient A in sample 002 and the intensity of Raman spectrum peak 1 in sample 003), we can use mean filling. The average content of active ingredient A is 2.6%, and the average intensity of Raman spectrum peak 1 is 800. The filled data is as follows:
[0062] Sample ID Active ingredient A content (%) Raman spectrum peak 1 intensity Microscopic image Cell number
[0063]
[0064] Outlier handling: Use the IQR (interquartile range) method to identify and handle outliers. The IQR of the active ingredient A content is 0.4%, so the upper and lower limits are 3.1% and 1.9%, respectively. The active ingredient A content of sample 005 is 10.0%, which is obviously an outlier and can be replaced with the upper limit value of 3.1%.
[0065] Sample ID Active ingredient A content (%) Raman spectrum peak 1 intensity Microscopic image Cell number 005 3.1790125
[0067] Format conversion and standardization, normalization: normalize the numerical data to eliminate the dimension difference. Take the content of active ingredient A as an example, use the Min-Max Scaling method to normalize it to the range of [0,1]. The minimum value of the content of active ingredient A is 1.9% and the maximum value is 3.1%. The normalized data is as follows:
[0068] Sample ID Active ingredient A content (normalized) Raman spectrum peak 1 intensity Microscopic image Cell number
[0069] 001(2.5-1.9) / (3.1-1.9)800120
[0070] 002(2.6-1.9) / (3.1-1.9)780130
[0071] 003(2.3-1.9) / (3.1-1.9)800110
[0072] 004(3.0-1.9) / (3.1-1.9)820NaN
[0073] 005(3.1-1.9) / (3.1-1.9)790125
[0074] Encoding categorical data: We also have a categorical feature "Preparation Type" whose values are "Pills" or "Powders". In order to facilitate the machine learning model to process it, we need to one-hot encode it.
[0075] The preprocessed data should maintain the same structure as the original input data, that is, each column represents a feature and each row represents a sample. In the above processing, we ensure that this structure of the data is maintained. The final output data is a cleaned multidimensional data table with no missing or abnormal data, unified format and standardized format, which can be directly used for subsequent machine learning or data analysis tasks.
[0076] 202. Perform feature selection based on the multidimensional data of the Chinese medicine preparation in combination with lasso regression to obtain key quality influencing data of the Chinese medicine preparation, perform dimensionality reduction processing based on the key quality influencing data of the Chinese medicine preparation using principal component analysis or independent component analysis to extract the main quality characteristics of the Chinese medicine preparation;
[0077] Specifically, the multidimensional data of the Chinese medicine preparation is received as input. Lasso regression is a linear regression method. Feature selection is achieved by performing L1 regularization on the regression coefficient. The quality index of the Chinese medicine preparation is used as the dependent variable. The quality index includes the content of the active ingredient and the dissolution rate. The multidimensional data is used as the independent variable to construct a lasso regression model. The regularization parameter \lambda in the lasso regression is determined by cross-validation, \lambda∈[\lambda_min,\lambda_max]. For each \lambda value, K training and verification are performed. K-1 data are selected as the training set each time, and the remaining 1 data is selected as the verification set. The average performance index of each \lambda value in the K verifications is calculated, and the best \lambda is selected. According to the evaluation index, The best performing \lambda value is selected as the regularization parameter of lasso regression. According to the size of the regression coefficient, the features that have a significant impact on the quality of Chinese medicine preparations are selected, and the objective function formula of lasso regression is set as: \min_{\beta}\left(\sum_{i=1}^{n}(y_i-\beta_0-\sum_{j=1}^{p}x_{ij}\beta_j)^2+\lambda\sum_{j=1}^{p}|\beta_j|\right); where \beta: represents the vector of regression coefficients, including \beta_0 and \beta_j, \beta_0 is the intercept term, and \beta_j is the coefficient of the jth feature, where j=1,2,...,p; y_i: target variable of the ith observation; x_{ij}: jth feature of the ith observation; n: number of observations; p: number of features; \lambda: regularization parameter, used to control the strength of the regularization term; the goal of the formula is to find a set of regression coefficients \beta, including \beta_0 and \beta_j, so that the above objective function reaches the minimum value, while minimizing the prediction error, the complexity of the model is controlled by L1 regularization, feature selection is achieved, and overfitting is prevented; the regularization parameter \lambda in lasso regression is determined by cross-validation, and features that have a significant impact on the quality of Chinese medicine preparations are selected according to the regression coefficients, and the key features selected by lasso regression are output to obtain the key influencing data of the quality of Chinese medicine preparations; the key influencing data of the quality of Chinese medicine preparations are standardized, and the standardized data is set as z_{ij}, then z_{ij}=\frac{x_{ij}-\bar{x}_j}{s_j}; where x_{ij} is the original data, \bar{x}_j is The mean of the j-th column, s_j is the standard deviation of the j-th column, eliminating the influence of dimension and order of magnitude; by calculating the covariance matrix of the data: Cov(X)=\frac{1}{n-1}\sum_{i=1}^{n}(x_i-\bar{x})(x_i-\bar{x})^T; where Cov(X) represents the covariance matrix of the data matrix X, x_i is the i-th observation (row vector), \bar{x} is the mean of all observations (row vector), and n is the number of observations; by solving The equation Cov(X)v=\lambdav obtains the eigenvalue \lambda and the corresponding eigenvector v, sorts the eigenvalues, selects the eigenvectors corresponding to the first k largest eigenvalues as the principal components, and projects the data onto the selected principal components, i.e. y=XV, where X is the original data matrix, V is the selected principal component matrix, and y is the data after dimensionality reduction, to achieve dimensionality reduction; and / or separates these independent components through an optimization algorithm to achieve the purpose of dimensionality reduction; outputs the data after dimensionality reduction to obtain the main quality characteristics of traditional Chinese medicine preparations;.
[0078] It should be noted that in the method for quality detection of traditional Chinese medicine preparations based on multidimensional data analysis, the specific embodiment of using the lasso regression model for feature selection and quality prediction is as follows: We have obtained multidimensional data of traditional Chinese medicine preparations and performed necessary preprocessing. The data set contains the following features (independent variables) and quality indicators (dependent variables): Features (independent variables): X1: active ingredient content measured by high performance liquid chromatography; X2: active ingredient content measured by gas chromatography; X3: intensity of Raman spectrum characteristic peak 1; X4: intensity of Raman spectrum characteristic peak 2; X5: number of cell structures in microscopic images...Xn: other related features;
[0079] Quality indicators (dependent variables): Y1: active ingredient content; Y2: dissolution rate; To simplify the explanation, we set the data set to contain 100 samples, each with the above n features and 2 quality indicators. We use lasso regression to predict the quality indicators Y1 and Y2. The objective function of lasso regression is as described above, including the sum of squares of prediction errors and L1 regularization terms. Set a range of λ, such as [0.01,1], and perform grid search within this range to find the best λ value. For each λ value, we perform K-fold cross validation (for example, K=5). Divide the data set into 5 parts, select 4 parts as training sets each time, and the remaining 1 part as validation set. For each λ value, train the lasso regression model on the training set and evaluate the performance on the validation set. Repeat the above process 5 times to ensure that each data is used as a validation set. Calculate the average performance indicator (such as mean square error MSE) of each λ value in 5 validations. Select the λ value with the best average performance indicator as the optimal regularization parameter. After cross validation, we found that the best λ value is 0.1.
[0080] The lasso regression model is trained using the entire data set and the optimal regularization parameter λ=0.1. After the model training is completed, we can view the regression coefficients: intercept term β0; coefficient β1 of X1; coefficient β2 of X2; coefficient βn of Xn; Based on the size of the regression coefficient, we can select features that have a significant impact on the quality of Chinese medicine preparations. For example, we can select features whose absolute value of the coefficient is greater than a certain threshold as key features.
[0081] After selecting the lasso regression model, we determined that the following key features have a significant impact on the quality of TCM preparations: X1: active ingredient content determined by HPLC; X3: intensity of characteristic peak 1 of Raman spectrum; X5: number of cell structures in microscopic images; these key features will be used in the subsequent quality control and optimization of TCM preparations.
[0082] The dataset contains these three feature values for 10 samples as follows:
[0083]
[0084] We first standardize these data to eliminate the impact of dimension and order of magnitude. The standardization formula is: (z_{ij}=\frac{x_{ij}-\bar{x}_j}{s_j}); where (\bar{x}_j) is the mean of the jth column, and (s_j) is the standard deviation of the jth column. Taking X1 as an example, set (\bar{x}_1=14), (s_1=2), then the first sample X1 is standardized as: (z_{11}=\frac{10-14}{2}=-2); perform the same processing on all data to obtain the standardized data set.
[0085] Next, we calculate the covariance matrix of the standardized data. The formula for calculating the covariance matrix is: (Cov(X)=\frac{1}{n-1}\sum_{i=1}^{n}(x_i-\bar{x})(x_i-\bar{x})^T) But since the data has been standardized, (\bar{x}) is a zero vector, so the covariance matrix is simplified to: (Cov(X)=\frac{1}{n-1}XX^T); where X is the standardized data matrix. The covariance matrix is calculated.
[0086] By solving the equation (Cov(X)v=\lambdav), we get the eigenvalue (\lambda) and the corresponding eigenvector (v). We get the following eigenvalues and eigenvectors: (\lambda_1=2.5), (v_1=[0.6,0.7,0.3]^T); (\lambda_2=1.5), (v_2=[-0.2,0.3,0.9]^T); (\lambda_3=0.5), (v_3=[0.7,-0.6,0.3]^T); Select the eigenvectors corresponding to the first k largest eigenvalues as the principal components. In this example, for simplicity, we select the first two principal components (k=2). Project the data onto the selected principal components, that is, (y=XV), where X is the original data matrix (here it is the standardized data matrix), and V is the selected principal component matrix, consisting of (v_1) and (v_2). Calculate the reduced-dimensional data y. The data after dimensionality reduction will contain the projection values of each sample on the first two principal components, which represent the main characteristics of the quality of Chinese medicine preparations.
[0087] 203. Construct a prediction model based on the main quality characteristics of the Chinese medicine preparation, use ridge regression to establish a prediction model for quality attributes with obvious linear relationships, and / or use a polynomial regression nonlinear model for quality attributes with obvious nonlinear relationships, obtain a trained ridge regression prediction model and a polynomial regression nonlinear model, construct a deep learning model based on the main quality characteristics of the Chinese medicine preparation, and further improve the prediction accuracy based on the automatic feature extraction capability of the deep learning model to obtain a trained deep learning model;
[0088] Specifically, a training set and a validation set are obtained according to the main quality characteristics of the Chinese medicine preparation; for quality attributes with obvious linear relationships, corresponding features are selected, and a prediction model is established using a ridge regression method, and an L2 regularization term is introduced to prevent overfitting. The regularization coefficient in the ridge regression is determined by cross-validation and grid search methods, and the model is trained on the training set, and its performance is evaluated on the validation set to obtain a trained ridge regression prediction model; for quality attributes with obvious nonlinear relationships, the nonlinear relationship is captured by constructing a polynomial form of the feature, and a nonlinear prediction model is established using a polynomial regression method, and the optimal order of the polynomial is determined by cross-validation. The model is also trained on the training set, and the performance is evaluated on the validation set to obtain a trained polynomial regression nonlinear model; a deep learning network is designed according to data characteristics, including a multilayer perceptron (MLP) and a convolutional neural network; the deep structure of the deep learning model is used to automatically extract high-level features, and the deep learning model is trained using back propagation and optimization algorithms, and early stopping and regularization techniques are applied to prevent overfitting, and the performance of the deep learning model is evaluated on the validation set to obtain a trained deep learning model;
[0089] It should be noted that in the method for quality detection of traditional Chinese medicine preparations based on multidimensional data analysis, the specific implementation examples of establishing different prediction models for different types of quality attributes are as follows: We divide the training set and the validation set according to the main characteristics of the quality of traditional Chinese medicine preparations (data after PCA dimensionality reduction). We already have a data set containing 100 samples, of which 80 samples will be used as training sets and 20 samples will be used as validation sets.
[0090] For quality attributes with obvious linear relationships (such as certain dissolution rate indicators), we select features with high correlation, such as the first two principal components after PCA dimensionality reduction. We use the ridge regression method to establish a prediction model, which prevents overfitting by introducing an L2 regularization term. The objective function of ridge regression can be expressed as: (\min_{\beta}\left(\sum_{i=1}^{n}(y_i-\beta_0-\sum_{j=1}^{p}x_{ij}\beta_j)^2+\lambda\sum_{j=1}^{p}\beta_j^2\right)); where (\lambda) is the regularization coefficient. We determine the regularization coefficient (\lambda) in ridge regression through cross-validation and grid search methods. After searching, we find the optimal regularization coefficient (\lambda=0.5); train the model on the training set and evaluate its performance on the validation set. For example, the mean squared error (MSE) on the training set is 0.05, and the MSE on the validation set is 0.06.
[0091] For quality attributes with obvious nonlinear relationships (such as certain active ingredient content indicators), we capture nonlinear relationships by constructing polynomial forms of features. For example, we can expand the first two principal components after PCA dimensionality reduction into quadratic or cubic polynomials; use polynomial regression methods to establish nonlinear prediction models. Polynomial regression can fit more complex nonlinear relationships; determine the optimal order of the polynomial through cross-validation. After verification, we found that the quadratic polynomial performs best; train the model on the training set, and evaluate its performance on the validation set. For example, the MSE on the training set is 0.04, and the MSE on the validation set is 0.05.
[0092] According to the characteristics of the data, we can design a multi-layer perceptron (MLP) or a convolutional neural network (if the data has spatial structure characteristics). Here, we design an MLP network with two hidden layers; the deep structure of the deep learning model is used to automatically extract high-level features. The deep learning model is trained using backpropagation and optimization algorithms (such as Adam optimizer). At the same time, early stopping and regularization techniques (such as Dropout) are applied to prevent overfitting; the performance of the deep learning model is evaluated on the validation set. For example, the MSE of the trained MLP model on the validation set is 0.03.
[0093] The trained ridge regression prediction model, polynomial regression nonlinear model, and deep learning model are obtained.
[0094] 204. Based on the trained ridge regression prediction model, polynomial regression nonlinear model and deep learning model, an integrated learning method is used to fuse multiple single models;
[0095] Specifically, the stacking method is used for model fusion, and different weights are assigned to each base model, including ridge regression, polynomial regression, and deep learning model; the training set is divided into two parts, D_1 is used to train the base model, and D_2 is used to generate training data for the meta-learner; the first part of the training set is used to train the ridge regression model, the polynomial regression model, and the deep learning model, and then these trained models are used to predict the second part of the training set; the predicted values y_{\text{Ridge},i}, y_{\text{Poly},i}, y_{\text{DL},i} are obtained; the predicted results are used as new features, together with the actual label y_i, to form a training data set for the meta-learner; the decision tree model is used as the meta-learner, and the new training data set generated in the previous step is used to train the meta-learner. The training data set of the meta-learner is expressed as: D_{\text{meta}}={(y_{\text{Ridge},i},y_{\text{Poly},i},y_{\text{DL},i} L},i},y_i)|i=1,2,\ldots,|D_2|}; where: y_{\text{Ridge},i}, y_{\text{Poly},i}, y_{\text{DL},i} are the prediction values of the ridge regression model, polynomial regression model and deep learning model for sample x_i respectively; y_i is the actual label of sample x_i; |D_2| represents the number of samples in the dataset D_2; the prediction function of the meta-learner is expressed as: y_{\text{ensemb le},i}=f_{\text{meta}}(y_{\text{Ridge},i},y_{\text{Poly},i},y_{\text{DL},i}); where: y_{\text{ensemble},i} is the final prediction result of the meta-learner for sample x_i; f_{\text{meta}} is the prediction function of the meta-learner; to obtain the final prediction result, the meta-learner dynamically adjusts the weights of each base model according to its prediction performance;
[0096] It should be noted that we have a dataset containing 200 samples, each of which has 10 features (the main features after PCA or other dimensionality reduction methods). We divide this dataset into two parts: training set (160 samples) and test set (40 samples). The training set is further divided into two parts: D_1 (120 samples) is used to train the base model, and D_2 (40 samples) is used to generate training data for the meta-learner.
[0097] Use the D_1 dataset to train three base models: ridge regression model, polynomial regression model, and deep learning model. Ridge regression model: select an appropriate regularization coefficient, such as 0.1 determined by cross-validation, and then train the model on D_1. Polynomial regression model: determine the optimal order of the polynomial, such as a quadratic polynomial, and train the model on D_1. Deep learning model: design an MLP network with two hidden layers, and use backpropagation and optimization algorithms to train the model on D_1.
[0098] Use the trained base model to predict the samples in the D_2 dataset and obtain the prediction value of each model: the prediction value of the ridge regression model: (y_{\text{Ridge},i}), (i=1,2,\ldots,40); the prediction value of the polynomial regression model: (y_{\text{Poly},i}), (i=1,2,\ldots,40); the prediction value of the deep learning model: (y_{\text{DL},i}), (i=1,2,\ldots,40); these prediction values together with the actual label (y_i) constitute the training dataset D_meta of the meta-learner.
[0099] Use the decision tree model as a meta-learner and train it on D_meta. The task of the meta-learner is to learn how to get the final prediction result based on the prediction values of the three base models. After the training is completed, we can use the meta-learner to get the final prediction result based on the prediction values of the base models. For each sample in the test set, first use the trained base model to make a prediction, and then input the predicted value into the meta-learner to get the final prediction result (y_{\text{ensemble},i}). Finally, we can use the test set to evaluate the performance of the fusion model. For example, the mean square error (MSE) on the test set or other evaluation indicators can be calculated to measure the predictive ability of the model.
[0100] Specific data example: In the D_2 dataset, the actual label of a sample is (y_i=10.5), and the predicted values of the ridge regression, polynomial regression and deep learning models are (y_{\text{Ridge},i}=10.2), (y_{\text{Poly},i}=10.8), (y_{\text{DL},i}=10.6). These predicted values and actual labels will constitute a piece of training data for the meta-learner. After training, the meta-learner will learn how to get the final prediction results that are closer to the actual labels based on these predicted values.
[0101] 205. According to the real-time data in the multidimensional data of the traditional Chinese medicine preparation, the data is input into the above-mentioned trained model, and the quality inspection result of the traditional Chinese medicine preparation is obtained by fusing multiple single models;
[0102] Specifically, the multidimensional real-time data of Chinese medicine preparations is received, and the data is cleaned, standardized and normalized to ensure data quality and eliminate dimensional differences between different features; the pre-processed multidimensional real-time data is input into the trained ridge regression model, polynomial regression model and deep learning model respectively; each model generates a predicted value of the quality inspection result according to the input data; an additional lightweight neural network is used to learn and dynamically adjust the weight of each model. The input of this neural network is the prediction results of each single model and the statistical characteristics of the input data, and the output is the weight of each model; by optimizing the parameters of this neural network on the validation set, it can dynamically allocate weights according to actual conditions, thereby improving the accuracy of the fusion result; according to the weights obtained by the dynamic weight allocation mechanism, the prediction results of the three single models are weighted averaged, and the fusion formula is expressed as: Quality_Prediction=w1*Ridge_Prediction+w2*Poly_Prediction+w3*DL_Predictio n; where w1, w2 and w3 are weights obtained through a dynamic weight allocation mechanism; the fused prediction results are post-processed, including denormalization and threshold judgment, and the final quality test results of traditional Chinese medicine preparations are output, including specific values, grades or qualified / unqualified judgments;
[0103] It should be noted that we received a batch of multi-dimensional real-time data of traditional Chinese medicine preparations, including 10 different quality indicators (such as ingredient content, dissolution time, etc.). First, we cleaned the data to remove outliers and missing values. Then, we standardized and normalized the data to ensure that all data were in the same dimension and eliminate the dimensional differences between features.
[0104] The real-time data received is as follows (only part of the data is shown):
[0105]
[0106] After preprocessing, the data will be converted into a standard normal distribution for easy model processing; the preprocessed data will be input into the previously trained ridge regression model, polynomial regression model and deep learning model respectively, and each model will generate a predicted value of the quality inspection result.
[0107] Example of prediction results:
[0108]
[0109] An additional lightweight neural network is used to learn and dynamically adjust the weight of each model. The input of this neural network is the prediction results of each model and the statistical characteristics of the input data (such as mean, standard deviation, etc.), and the output is the weight of each model.
[0110] Weight distribution example:
[0111] For sample 1, the neural network outputs the following weights:
[0112] Ridge regression weight (w1): 0.35
[0113] Polynomial regression weight (w2): 0.30
[0114] Deep learning weight (w3): 0.35
[0115] According to the weights obtained by the dynamic weight allocation mechanism, the prediction results of the three models are weighted averaged. Example of fusion result:
[0116] For sample 1, the fused prediction result is:
[0117] Quality_Prediction=0.35*85.0+0.30*86.5+0.35*84.2=85.02
[0118] The fused prediction results are denormalized and converted back to the original dimension. Then, the final quality test results of traditional Chinese medicine preparations are output based on the preset threshold.
[0119] Example of the resulting output:
[0120] Sample 1: The quality test result is 85.02 (this is set as the percentage value of a certain quality indicator), and is judged as "qualified".
[0121] Sample 2: ...(similar processing)
[0122] 206. Design a continuous learning and optimization mechanism to regularly use newly collected data to fine-tune the single model and dynamic weight allocation network to maintain the accuracy and adaptability of the model; and / or establish a real-time feedback mechanism to compare the quality inspection results obtained after model fusion with the quality control data in the actual production process, and continuously optimize and adjust the parameters or structure of the model by analyzing the difference between the model prediction and the actual results to improve the accuracy and reliability of the prediction; and / or develop a data visualization platform to display multidimensional data and the prediction results of the model in an intuitive way. When the prediction results deviate from the normal range, the data visualization platform automatically triggers an early warning;
[0123] It should be noted that 100 new sample data of Chinese medicine preparations are collected every month, including their multidimensional quality indicators and actual quality test results. These data are added to the historical data set to form an updated data set. Using the newly collected data, the ridge regression model, polynomial regression model and deep learning model are fine-tuned. Taking the ridge regression model as an example, the model can be refitted with the new data and the regularization parameters can be adjusted to optimize the model performance. For the deep learning model, the new data can be used to train for several epochs to update the model weights. The dynamic weight assignment network is retrained with the new data set to enable it to better learn how to assign weights based on the prediction results of a single model. The optimal parameters of the network, such as learning rate, batch size, etc., are determined by cross-validation.
[0124] Real-time feedback mechanism, quality control data comparison model fusion, quality inspection results and quality control data in the actual production process are as follows:
[0125]
[0126] Calculate the difference between the model prediction value and the actual detection value, such as absolute error or relative error. Analyze samples with large prediction errors to find out the reasons, such as data anomalies, model overfitting, etc. Adjust the model parameters or structure based on the analysis results, such as increasing the number of hidden layer nodes in the deep learning model, adjusting the order of polynomial regression, etc. The retrained and optimized model will be used for the next round of predictions.
[0127] Data visualization platform, data visualization display, develop a Web-based data visualization platform, use charts (such as bar charts, scatter plots, line charts, etc.) to display multidimensional data and model prediction results. Update data in real time to ensure that the displayed information is latest and accurate. Early warning mechanism, set the normal range of quality indicators, for example, the content of a certain ingredient should be between 80-100. When the model prediction results deviate from the normal range, the data visualization platform automatically triggers an early warning, such as notifying the quality management personnel by email or SMS. The early warning information includes the ID, predicted value, actual value and cause analysis of the abnormal sample. Interactive analysis, providing an interactive interface that allows users to customize queries and filter data for more in-depth analysis. Integrate statistical analysis and data mining tools to help users discover potential patterns and trends in the data.
[0128] In the embodiment of the present invention, the whole process from data collection and preprocessing, feature selection and dimensionality reduction, model construction and training, model fusion, to continuous learning and optimization, real-time feedback and data visualization is covered. First, the multidimensional data of Chinese medicine preparations are collected by various technical means, and preprocessing is performed to ensure data quality. Then, lasso regression is used for feature selection, and principal component analysis or independent component analysis is used for dimensionality reduction to extract key quality features. Then, according to the linear or nonlinear relationship of the data, ridge regression, polynomial regression and deep learning models are constructed respectively, and these models are fused by ensemble learning methods to improve prediction accuracy. Finally, through continuous learning and optimization mechanism, real-time feedback mechanism and data visualization platform, the model is continuously optimized and its accuracy and adaptability are maintained; by integrating multiple models and combining dynamic weight distribution mechanism, the technology can more accurately predict the quality of Chinese medicine preparations and reduce misjudgment and missed judgment; the continuous learning and optimization mechanism enables the model to be constantly fine-tuned as new data is collected, thereby maintaining the timeliness and adaptability of the model; through the real-time feedback mechanism, the difference between the model prediction and the actual quality control data can be discovered in time, and adjustments can be made quickly to ensure that the model is always in the best state; the data visualization platform displays complex multidimensional data and model prediction results in an intuitive way, helping decision makers to quickly understand the data and make accurate judgments. At the same time, the introduction of the early warning system can detect abnormal situations in time and reduce potential risks; accurate quality testing can reduce the production of unqualified products, thereby reducing production costs and market risks caused by product quality problems; it provides a scientific and objective method for the quality control of Chinese medicine preparations, which helps to promote the modernization and internationalization of Chinese medicine and enhance the overall competitiveness of Chinese medicine.
[0129] The above describes the method for detecting the quality of Chinese medicine preparations based on multidimensional data analysis in an embodiment of the present invention. The following describes the device for detecting the quality of Chinese medicine preparations based on multidimensional data analysis in an embodiment of the present invention. Figure 3, an embodiment of the Chinese medicine preparation quality detection device based on multidimensional data analysis in the embodiment of the present invention includes: an acquisition module 301, which is used to collect multidimensional data of Chinese medicine preparations, and the multidimensional data of Chinese medicine preparations includes preparation ingredients, preparation process parameters and corresponding quality attributes; a processing module 302, which is used to perform feature selection based on the multidimensional data of Chinese medicine preparations in combination with lasso regression to obtain key influencing data of Chinese medicine preparation quality, and apply principal component analysis or independent component analysis to perform dimensionality reduction processing based on the key influencing data of Chinese medicine preparation quality to extract the main characteristics of Chinese medicine preparation quality; a setting module 303, which is used to construct a prediction model based on the main characteristics of Chinese medicine preparation quality, and use ridge regression to establish a prediction model for quality attributes with obvious linear relationships, and / or for quality attributes with obvious nonlinear relationships, a polynomial regression nonlinear model is used to obtain a trained ridge regression prediction model and a polynomial regression nonlinear model, and a deep learning model is constructed based on the main quality characteristics of the Chinese medicine preparation. Based on the automatic feature extraction capability of the deep learning model, the prediction accuracy is further improved to obtain a trained deep learning model; a fusion module 304 is used to fuse multiple single models using an integrated learning method based on the trained ridge regression prediction model, the polynomial regression nonlinear model, and the deep learning model; an allocation module 305 is used to input the real-time data in the multidimensional data of the Chinese medicine preparation into the above-mentioned trained model, and obtain the quality detection result of the Chinese medicine preparation by fusing multiple single models.
[0130] In an embodiment of the present invention, data collection, feature selection, dimensionality reduction processing, prediction model construction and model fusion are included. First, multidimensional data including preparation ingredients, preparation processes and quality attributes are collected through an acquisition module. Next, the processing module uses lasso regression to screen out key data that affect the quality of Chinese medicine preparations, and performs dimensionality reduction through principal component analysis or independent component analysis to extract the main quality features. Then, based on these features, for quality attributes with obvious linear relationships, a prediction model is established using ridge regression; for attributes with obvious nonlinear relationships, a polynomial regression nonlinear model is used. In addition, the automatic feature extraction capability of the deep learning model is used to improve prediction accuracy. Finally, multiple single models are integrated and learned through the fusion module to obtain more accurate quality inspection results of Chinese medicine preparations; through multidimensional data analysis, this technology can more comprehensively consider the various factors affecting the quality of Chinese medicine preparations, thereby improving the accuracy and reliability of quality inspection; utilizing the automatic feature extraction capability of the deep learning model, this technology can automatically identify and extract key features that affect the quality of Chinese medicine preparations, reducing the need for manual intervention and improving the automation and intelligence level of the inspection process; by fusing multiple single models through an integrated learning method, it can not only combine the advantages of each model, but also offset the deviation of a single model to a certain extent, making the quality inspection results more robust and reliable; it can handle quality attributes with obvious linear and nonlinear relationships, showing strong data adaptability, and can be widely used in different types of quality inspection scenarios for Chinese medicine preparations; through precise quality inspection, this technology helps to control the quality of Chinese medicine preparations in the production process, thereby improving the safety and effectiveness of Chinese medicine preparations and providing support for the standardization and modernization of the Chinese medicine industry.
[0131] above Figure 3 The Chinese medicine preparation quality inspection device based on multidimensional data analysis in the embodiment of the present invention is described in detail from the perspective of modular functional entities. The Chinese medicine preparation quality inspection device based on multidimensional data analysis in the embodiment of the present invention is described in detail from the perspective of hardware processing.
[0132] Figure 44 is a schematic diagram of the structure of a Chinese medicine preparation quality detection device based on multidimensional data analysis provided by an embodiment of the present invention. The Chinese medicine preparation quality detection device 400 based on multidimensional data analysis may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 410 (for example, one or more processors) and a memory 420, and one or more storage media 430 (for example, one or more mass storage devices) storing application programs 433 or data 432. Among them, the memory 420 and the storage medium 430 can be short-term storage or permanent storage. The program stored in the storage medium 430 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the Chinese medicine preparation quality detection device 400 based on multidimensional data analysis. Furthermore, the processor 410 may be configured to communicate with the storage medium 430 to execute a series of instruction operations in the storage medium 430 on the Chinese medicine preparation quality detection device 400 based on multidimensional data analysis.
[0133] The Chinese medicine preparation quality inspection device 400 based on multidimensional data analysis may also include one or more power supplies 440, one or more wired or wireless network interfaces 450, one or more input and output interfaces 460, and / or one or more operating systems 431, such as Windows Serve, Mac OS X, Unix, Linux, FreeBSD, etc. It can be understood by those skilled in the art that Figure 4 The structure of the Chinese medicine preparation quality inspection equipment based on multidimensional data analysis shown does not constitute a limitation of the Chinese medicine preparation quality inspection equipment based on multidimensional data analysis, and may include more or fewer components than shown in the figure, or a combination of certain components, or a different arrangement of components.
[0134] The present invention also provides a Chinese medicine preparation quality detection device based on multidimensional data analysis, the Chinese medicine preparation quality detection device based on multidimensional data analysis includes a memory and a processor, the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the processor executes the steps of the Chinese medicine preparation quality detection method based on multidimensional data analysis in the above-mentioned embodiments.
[0135] The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. Instructions are stored in the computer-readable storage medium. When the instructions are executed on a computer, the computer executes the steps of the method for quality detection of traditional Chinese medicine preparations based on multidimensional data analysis.
[0136] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0137] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc., various media that can store program codes.
[0138] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for detecting the quality of traditional Chinese medicine preparations based on multidimensional data analysis, characterized in that: The traditional Chinese medicine preparation quality detection method based on multidimensional data analysis includes: Collecting multidimensional data of traditional Chinese medicine preparations, wherein the multidimensional data of traditional Chinese medicine preparations includes preparation ingredients, preparation process parameters and corresponding quality attributes; Based on the multidimensional data of the Chinese medicine preparation combined with lasso regression, feature selection is performed to obtain key data affecting the quality of the Chinese medicine preparation, and principal component analysis or independent component analysis is applied to perform dimensionality reduction processing based on the key data affecting the quality of the Chinese medicine preparation to extract the main features of the quality of the Chinese medicine preparation; Constructing a prediction model based on the main quality characteristics of the Chinese medicine preparation, using ridge regression to establish a prediction model for quality attributes with obvious linear relationships, and / or using a polynomial regression nonlinear model for quality attributes with obvious nonlinear relationships, to obtain a trained ridge regression prediction model and a polynomial regression nonlinear model, constructing a deep learning model based on the main quality characteristics of the Chinese medicine preparation, and further improving the prediction accuracy based on the automatic feature extraction capability of the deep learning model to obtain a trained deep learning model; Based on the trained ridge regression prediction model, polynomial regression nonlinear model, and deep learning model, an integrated learning method is used to fuse multiple single models; The real-time data in the multidimensional data of traditional Chinese medicine preparations is input into the above-mentioned trained model, and the quality inspection results of traditional Chinese medicine preparations are obtained by fusing multiple single models.
2. The method for detecting the quality of Chinese medicine preparations based on multidimensional data analysis according to claim 1, characterized in that: The multi-dimensional data of traditional Chinese medicine preparations are collected, and the multi-dimensional data of traditional Chinese medicine preparations include preparation ingredients, preparation process parameters and corresponding quality attributes, including: Use high performance liquid chromatography and gas chromatography to determine the content of active ingredients in traditional Chinese medicine preparations, and obtain the fingerprint of traditional Chinese medicine preparations through chromatography-mass spectrometry technology; and / or use Raman spectroscopy or terahertz spectroscopy for non-destructive testing to quickly obtain the composition information of traditional Chinese medicine preparations, and use chemometric methods to analyze spectral data and extract characteristic information; and / or using computer vision technology to detect defects in the appearance of TCM preparations, and analyzing microscopic images through deep learning models to identify the cell structure and tissue characteristics of TCM preparations; The obtained data are fused using data fusion algorithm, including chemical data, spectral data, and image data, to obtain multi-dimensional data of traditional Chinese medicine preparations; Preprocessing the multidimensional data of the Chinese medicine preparation, including data cleaning, format conversion and standardization, using mean, median or mode filling for missing value processing for numerical data, using interpolation methods for time series data, including linear interpolation and Lagrange interpolation for missing value processing, using IQR method to identify and process outliers; and / or applying anomaly detection algorithms based on machine learning, including isolation forest or DBSCAN clustering to identify outliers; using filters or smoothing techniques to reduce noise in the data; Normalize the numerical data using Min-Max Scaling and Z-Score Standardization methods to eliminate the dimensional differences between different features; perform one-hot encoding or label encoding on categorical data so that the machine learning model can process it; bin the continuous variables and convert the continuous values into categorical values; the preprocessed data should maintain the same structure as the input data, and the output data includes a cleaned, non-missing, anomaly-free, uniformly formatted and standardized multidimensional data table, in which each column represents a feature and each row represents a sample.
3. The method for detecting the quality of Chinese medicine preparations based on multidimensional data analysis according to claim 1, characterized in that: The method of performing feature selection based on the multidimensional data of the Chinese medicine preparation in combination with lasso regression to obtain key data affecting the quality of the Chinese medicine preparation, and performing dimensionality reduction processing based on the key data affecting the quality of the Chinese medicine preparation using principal component analysis or independent component analysis to extract the main features of the quality of the Chinese medicine preparation, including: The multidimensional data of the traditional Chinese medicine preparation is received as input. Lasso regression is a linear regression method that implements feature selection by performing L1 regularization on the regression coefficient. The quality index of the traditional Chinese medicine preparation is used as the dependent variable. The quality index includes the content of the active ingredient and the dissolution rate. The multidimensional data is used as the independent variable to construct a lasso regression model. The regularization parameter \lambda in lasso regression is determined by cross-validation, \lambda∈[\lambda_min,\lambda_max]. For each \lambda value, K training and validation are performed, and K-1 data sets are selected as training sets each time, and the remaining 1 set is used as validation sets. The average performance index of each \lambda value in K validations is calculated, and the best \lambda is selected. According to the evaluation index, the \lambda value with the best performance is selected as the regularization parameter of lasso regression; according to the size of the regression coefficient, the features that have a significant impact on the quality of traditional Chinese medicine preparations are selected, and the objective function formula of lasso regression is set as: \min_{\beta}\left(\sum_{i=1}^{n}(y_i-\beta_0-\sum_{j=1}^{p}x_{ij}\beta_j)^2+\lambda\sum_{j=1}^{p}|\beta_j|\right); Where, \beta: a vector representing the regression coefficients, including \beta_0 and \beta_j, \beta_0 is the intercept term, \beta_j is the coefficient of the jth feature, where j = 1, 2, ..., p; y_i: the target variable of the i-th observation; x_{ij}: the j-th feature of the i-th observation; n: the number of observations; p: the number of features; \lambda: regularization parameter, used to control the strength of the regularization term; The goal of the formula is to find a set of regression coefficients \beta, including \beta_0 and \beta_j, so that the above objective function reaches the minimum value. While minimizing the prediction error, the complexity of the model is controlled by L1 regularization to achieve feature selection and prevent overfitting. The regularization parameter \lambda in lasso regression is determined by cross-validation, and features that have a significant impact on the quality of traditional Chinese medicine preparations are selected based on the regression coefficients. The key features selected by lasso regression are output to obtain the key influencing data on the quality of traditional Chinese medicine preparations. The key influencing data of the quality of the traditional Chinese medicine preparation is standardized, and the standardized data is set as z_{ij}, then: z_{ij}=\frac{x_{ij}-\bar{x}_j}{s_j}; Among them, x_{ij} is the original data, \bar{x}_j is the mean of the j-th column, and s_j is the standard deviation of the j-th column, eliminating the influence of dimension and order of magnitude; By calculating the covariance matrix of the data: Cov(X)=\frac{1}{n-1}\sum_{i=1}^{n}(x_i-\bar{x})(x_i-\bar{x})^T; Where Cov(X) represents the covariance matrix of the data matrix X, x_i is the i-th observation (row vector), \bar{x} is the mean of all observations (row vector), and n is the number of observations; By solving the equation Cov(X)v=\lambdav, we get the eigenvalue \lambda and the corresponding eigenvector v, sort them according to the size of the eigenvalues, select the eigenvectors corresponding to the first k largest eigenvalues as the principal components, and project the data onto the selected principal components, that is, y=XV, where X is the original data matrix, V is the selected principal component matrix, and y is the data after dimensionality reduction, thus achieving dimensionality reduction; and / or separating these independent components through optimization algorithms to achieve the purpose of dimensionality reduction; Output the reduced-dimensional data to obtain the main quality characteristics of Chinese medicine preparations.
4. The method for detecting quality of Chinese medicine preparations based on multidimensional data analysis according to claim 1, characterized in that: The prediction model is constructed based on the main characteristics of the quality of the traditional Chinese medicine preparation, and the prediction model is established by using ridge regression for the quality attributes with obvious linear relationship, and the polynomial regression nonlinear model is used for the quality attributes with obvious nonlinear relationship, so as to obtain the trained ridge regression prediction model and polynomial regression nonlinear model, and the deep learning model is constructed based on the main characteristics of the quality of the traditional Chinese medicine preparation, and the prediction accuracy is further improved based on the automatic feature extraction capability of the deep learning model, so as to obtain the trained deep learning model, including: A training set and a validation set are obtained based on the main quality characteristics of the traditional Chinese medicine preparation; For quality attributes with obvious linear relationships, corresponding features are selected and a prediction model is established using the ridge regression method. The L2 regularization term is introduced to prevent overfitting. The regularization coefficient in the ridge regression is determined through cross-validation and grid search methods. The model is trained on the training set and its performance is evaluated on the validation set to obtain the trained ridge regression prediction model. For quality attributes with obvious nonlinear relationships, the nonlinear relationships are captured by constructing polynomial forms of features, and a nonlinear prediction model is established using the polynomial regression method. The optimal order of the polynomial is determined through cross-validation. The model is also trained on the training set, and the performance is evaluated on the validation set to obtain the trained polynomial regression nonlinear model. Design a deep learning network based on data characteristics, including multi-layer perceptron (MLP) and convolutional neural network; use the deep structure of the deep learning model to automatically extract high-level features, use backpropagation and optimization algorithms to train the deep learning model, and apply early stopping and regularization techniques to prevent overfitting. Evaluate the performance of the deep learning model on the validation set to obtain the trained deep learning model.
5. The method for detecting the quality of Chinese medicine preparations based on multidimensional data analysis according to claim 4, characterized in that: The trained ridge regression prediction model, polynomial regression nonlinear model, and deep learning model are integrated by using an integrated learning method to fuse multiple single models, including: The stacking method is used to perform model fusion, and different weights are assigned to each base model, including ridge regression, polynomial regression, and deep learning models; The training set is divided into two parts, D_1 is used to train the base model, and D_2 is used to generate training data for the meta-learner; Use the first part of the training set to train a ridge regression model, a polynomial regression model, and a deep learning model. Then, use these trained models to make predictions on the second part of the training set. Get the predicted values y_{\text{Ridge},i},y_{\text{Poly},i},y_{\text{DL},i}; The prediction results are used as new features and together with the actual labels y_i, they form the training data set of the meta-learner. Use the decision tree model as a meta-learner and use the new training data set generated in the previous step to train the meta-learner. The training data set of the meta-learner is expressed as: D_{\text{meta}}={(y_{\text{Ridge},i},y_{\text{Poly},i},y_{\text{DL},i},y_i)|i=1,2,\ldots,|D_2|} Where: y_{\text{Ridge},i}, y_{\text{Poly},i}, y_{\text{DL},i} are the predicted values of sample x_i by the ridge regression model, polynomial regression model and deep learning model respectively; y_i is the actual label of sample x_i; |D_2| represents the number of samples in data set D_2; The prediction function of the meta-learner is expressed as: y_{\text{ensemble},i}=f_{\text{meta}}(y_{\text{Ridge},i},y_{\text{Poly},i},y_{\text{DL},i}); Where: y_{\text{ensemble},i} is the final prediction result of the meta-learner for sample x_i; f_{\text{meta}} is the prediction function of the meta-learner; To obtain the final prediction result, the meta-learner dynamically adjusts the weights of each base model according to their prediction performance.
6. The method for detecting the quality of Chinese medicine preparations based on multidimensional data analysis according to claim 1 or 5, characterized in that: The real-time data in the multi-dimensional data of traditional Chinese medicine preparations is input into the above-mentioned trained model, and the quality inspection results of traditional Chinese medicine preparations are obtained by fusing multiple single models, including: Receive multi-dimensional real-time data of traditional Chinese medicine preparations, clean, standardize and normalize the data to ensure data quality and eliminate dimensional differences between different features; The pre-processed multi-dimensional real-time data is input into the trained ridge regression model, polynomial regression model and deep learning model respectively; each model generates a predicted value of the quality inspection result based on the input data; An additional lightweight neural network is used to learn and dynamically adjust the weight of each model. The input of this neural network is the prediction results of each single model and the statistical characteristics of the input data, and the output is the weight of each model. By optimizing the parameters of this neural network on the validation set, it can dynamically allocate weights according to actual conditions, thereby improving the accuracy of the fusion results. According to the weights obtained by the dynamic weight allocation mechanism, the prediction results of the three single models are weighted averaged, and the fusion formula is expressed as: Quality_Prediction=w1*Ridge_Prediction+w2*Poly_Prediction+w3*DL_Prediction; Among them, w1, w2 and w3 are weights obtained through the dynamic weight allocation mechanism; The fused prediction results are post-processed, including denormalization and threshold judgment, to output the final quality inspection results of Chinese medicine preparations, including specific values, grades, or qualified / unqualified judgments.
7. The method for detecting the quality of Chinese medicine preparations based on multidimensional data analysis according to claim 1, characterized in that: Also includes: Design a continuous learning and optimization mechanism to regularly fine-tune the single model and dynamic weight distribution network using newly collected data to maintain the accuracy and adaptability of the model; And / or establish a real-time feedback mechanism to compare the quality inspection results obtained after model fusion with the quality control data in the actual production process, and continuously optimize and adjust the parameters or structure of the model by analyzing the difference between the model prediction and the actual results to improve the accuracy and reliability of the prediction; And / or develop a data visualization platform to display multidimensional data and the prediction results of the model in an intuitive way. When the prediction results deviate from the normal range, the data visualization platform automatically triggers an early warning.
8. A Chinese medicine preparation quality detection device based on multidimensional data analysis, characterized in that: The Chinese medicine preparation quality detection device based on multidimensional data analysis includes: An acquisition module is used to collect multidimensional data of traditional Chinese medicine preparations, wherein the multidimensional data of traditional Chinese medicine preparations includes preparation ingredients, preparation process parameters and corresponding quality attributes; A processing module is used to perform feature selection based on the multidimensional data of the Chinese medicine preparation in combination with lasso regression to obtain key quality influencing data of the Chinese medicine preparation, and perform dimensionality reduction processing based on the key quality influencing data of the Chinese medicine preparation using principal component analysis or independent component analysis to extract the main quality features of the Chinese medicine preparation; A module is set up, which is used to construct a prediction model based on the main quality characteristics of the traditional Chinese medicine preparation, use ridge regression to establish a prediction model for quality attributes with obvious linear relationships, and / or use a polynomial regression nonlinear model for quality attributes with obvious nonlinear relationships, to obtain a trained ridge regression prediction model and a polynomial regression nonlinear model, and to construct a deep learning model based on the main quality characteristics of the traditional Chinese medicine preparation, and further improve the prediction accuracy based on the automatic feature extraction capability of the deep learning model to obtain a trained deep learning model; The fusion module is used to fuse multiple single models using an integrated learning method based on the trained ridge regression prediction model, polynomial regression nonlinear model, and deep learning model; The allocation module is used to input the real-time data in the multi-dimensional data of traditional Chinese medicine preparations into the above-mentioned trained model, and obtain the quality inspection results of traditional Chinese medicine preparations by fusing multiple single models.
9. A Chinese medicine preparation quality inspection device based on multidimensional data analysis, characterized in that: The Chinese medicine preparation quality inspection device based on multidimensional data analysis comprises: a memory and at least one processor, wherein instructions are stored in the memory; The at least one processor calls the instructions in the memory so that the Chinese medicine preparation quality detection device based on multidimensional data analysis executes the Chinese medicine preparation quality detection method based on multidimensional data analysis as described in any one of claims 1-7.
10. A computer-readable storage medium having instructions stored thereon, characterized in that: When the instructions are executed by the processor, the method for detecting the quality of traditional Chinese medicine preparations based on multidimensional data analysis as described in any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Method for evaluating quality of traditional Chinese medicine
CN106990214A
On-line detection method and device in traditional Chinese medicine extraction process
CN108593863A
Application of intelligent manufacturing multi-source information fusion method in quality evaluation of traditional Chinese medicine large honeyed boluses
CN113052437A
Tobacco leaf quality grade classification prediction method based on principal component analysis and super learning
CN113657452A
Data fusion-based Chinese and Tibetan medicinal material component quality evaluation method
CN114662858A
Cited By
Self-adaptive correction pharmaceutical process quality detection method and robot
CN119104505A
Traditional Chinese medicine formula granule quality tracing system based on data fusion
CN119204835A
Intelligent quality detecting and sorting system for water level sensor
CN119359161A
Water level sensor intelligent quality detection and sorting system
CN119359161B
Mass spectrum detection method and system based on data twinning
CN119538016A
