White spirit grade identification method, controller and equipment
By using a final recognition model based on 17 key features and optimizing the identification of liquor grades using SVM, MLP, KNN and DT models, the problems of strong subjectivity and poor accuracy in existing technologies have been solved, and the objectivity and accuracy of liquor grade identification have been improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUIZHOU MOUTAI WINERY GRP XIJIU CO LTD
- Filing Date
- 2026-01-26
- Publication Date
- 2026-05-05
AI Technical Summary
The existing methods for classifying baijiu (Chinese liquor) rely mainly on subjective human evaluation, resulting in results that are highly subjective, lack objectivity, and have inconsistent standards, thus reducing the accuracy of baijiu classification.
The final identification model based on 17 key features is adopted. Through correlation analysis, ranking importance method and recursive feature elimination method, features with a correlation greater than the correlation threshold with the grade of baijiu are extracted from 36 basic features and 5 derived features of baijiu. The parameters are optimized by using support vector machine (SVM), multilayer perceptron (MLP), K-nearest neighbor (KNN) and decision tree (DT) models to output the grade of baijiu.
This improves the accuracy and objectivity of liquor grade identification, ensuring the reliability and consistency of the identification results.
Smart Images

Figure CN121980420A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of liquor technology, specifically to a liquor grade identification method, controller, and device. Background Technology
[0002] Baijiu (Chinese liquor) is classified into different grades based on its quality. Clearly defining the grades of baijiu helps to meet the diverse needs of different consumer groups and also allows staff to monitor the quality of baijiu and improve the stability of the baijiu production process.
[0003] The existing methods for classifying baijiu (Chinese liquor) rely mainly on subjective human evaluation, which leads to problems such as strong subjectivity, poor objectivity, and inconsistent standards, thus reducing the accuracy of baijiu classification results. Summary of the Invention
[0004] In view of this, this application provides a method, controller and device for identifying the grade of baijiu (Chinese liquor), which can improve the objectivity and accuracy of baijiu grade identification.
[0005] To solve the above problems, the technical solution provided in this application is as follows: This application provides a method for identifying the grade of baijiu (Chinese liquor), comprising: inputting 17 key features of the baijiu to be identified into a final identification model; wherein, the final identification model is obtained by optimizing the parameters of an initial identification model based on the 17 key features; the identification model includes a support vector machine (SVM) model, a multilayer perceptron (MLP) model, a K-nearest neighbor (KNN) model, and a decision tree (DT) model; the 17 key features are features with a correlation greater than a correlation threshold with the grade of baijiu extracted from 36 basic features and 5 derived features of baijiu based on correlation analysis, importance ranking method, and recursive feature elimination method, using the initial identification model; the 5 derived features are features generated based on the 36 basic features to characterize the overall content of organic acids, acidity balance, body stability, esterification potential, and metal element balance of baijiu; the final identification model outputs the grade of the baijiu to be identified; the 36 basic features include: the concentration of acetic acid, The concentrations of lactic acid, 12 organic acids, and 22 metallic elements were measured. The 12 organic acids included fumaric acid, tartaric acid, glyceric acid, malic acid, maleic acid, citric acid, succinic acid, 2-hydroxybutyric acid, 2-methylsuccinic acid, 2-hydroxy-3-methylbutyric acid, 3-phenyllactic acid, and azelaic acid. The 22 metallic elements included Na, Mg, Al, K, Ca, Ti, V, Cr, Mn, Fe, Co, Ni, Cu, Zn, Ga, As, and S. e, Sr, Cd, Sb, Ba, and Pb; the five derived characteristics include total organic acid concentration, acidity balance characteristics, total metal element concentration, esterification characteristics, and metal element balance characteristics; the 17 key characteristics include the concentrations of Na, Al, K, Ca, Co, Ti, lactic acid, acetic acid, tartaric acid, malic acid, glyceric acid, maleic acid, 2-methylsuccinic acid, 2-hydroxy-3-methylbutyric acid, and 3-phenyllactic acid, as well as the concentration of total organic acids and metal element balance characteristics.
[0006] One possible implementation involves the five derived features, generated based on the 36 basic features, to characterize the overall organic acid content, acidity balance, body stability, metal element balance, and esterification potential of baijiu. These features include: a total organic acid concentration, generated based on the sum of the concentrations of acetic acid, lactic acid, and the 12 organic acids, to characterize the overall organic acid content of baijiu; an acidity balance feature, generated based on the ratio of the concentrations of acetic acid to lactic acid, to characterize the acidity balance of baijiu; a total metal element concentration, generated based on the sum of the concentrations of the 22 metal elements, to characterize the body stability of baijiu; an esterification feature, generated based on the sum of the concentrations of Na, Mg, Al, K, Ca, and Fe, to characterize the esterification potential of baijiu; a higher esterification feature indicates a greater esterification potential of the baijiu; and a metal element balance feature, generated based on the ratio of the sum of the concentrations of Na and K to the sum of the concentrations of Ca and Mg, to characterize the metal element balance of baijiu.
[0007] One possible implementation involves using a correlation analysis, importance ranking method, and recursive feature elimination method to extract features with a correlation greater than a correlation threshold from the 36 basic features and 5 derived features of baijiu based on the initial identification model. This includes: obtaining baijiu samples categorized from highest to lowest as A, B, C, and D, with the same number of samples for each level; dividing the samples of each level into a training set and a test set according to a preset ratio; inputting the 36 basic features and 5 derived features of each sample in the training set; and, based on the correlation analysis, obtaining a first feature subset, which includes the basic features and derived features with a correlation coefficient greater than a certain threshold with the baijiu level. The relevance threshold features are defined as follows: Based on the importance ranking method and the initial identification model, a second feature subset, a third feature subset, a fourth feature subset, and a fifth feature subset are obtained; the second to fifth feature subsets are the features in the corresponding model whose importance is greater than the importance threshold among the basic features and the derived features; Based on the recursive feature elimination method and the initial identification model, a sixth feature subset, a seventh feature subset, an eighth feature subset, and a ninth feature subset are obtained; the sixth to ninth feature subsets are the features in the corresponding model whose impact on performance is greater than the impact threshold among the basic features and the derived features; 17 key features whose frequency of occurrence is greater than the frequency threshold are extracted from the first to ninth feature subsets.
[0008] One possible implementation involves optimizing the parameters of an initial recognition model based on the 17 key features. This includes: after extracting the 17 key features, inputting the 17 key features of each sample in the training set into the initial recognition model, using five-fold cross-validation to obtain training recognition results; if the training recognition results do not meet a result threshold, adjusting the parameters of the initial recognition model until the training recognition results meet the result threshold, thus determining the final recognition model; inputting the 17 key features of each sample in the test set into the final recognition model to obtain test recognition results; and if the test recognition results meet the result threshold, obtaining the final recognition model.
[0009] One possible implementation is to continue performing adjustment actions if the test recognition result does not meet the result threshold, until both the training recognition result and the test recognition result meet the result threshold, and then obtain the final recognition model.
[0010] One possible implementation, after extracting the 17 key features, further includes: inputting the 17 key features of each sample in the training set into the initial recognition model to obtain training recognition results; inputting the 36 basic features of each sample in the training set into the initial recognition model to obtain a first recognition result; inputting the 36 basic features and 5 derived features of each sample in the training set into the initial recognition model to obtain a second recognition result; inputting the concentrations of 22 metal elements of each sample in the training set into the initial recognition model to obtain a third recognition result; inputting the concentrations of acetic acid, lactic acid, and 12 organic acids of each sample in the training set into the initial recognition model to obtain a fourth recognition result; and comparing the training recognition result with the first to fourth recognition results, the training recognition result is optimal.
[0011] One possible implementation, after extracting the 17 key features, further includes: inputting the 17 key features of each sample in the training set into the initial recognition model, using five-fold cross-validation to obtain the training recognition result; inputting the features included in the first feature subset of each sample in the training set into the initial recognition model to obtain the fifth recognition result; the first feature subset includes the concentrations of Al, Co, Ti, Na, V, lactic acid, acetic acid, maleic acid, citric acid, 2-methylsuccinic acid, 2-hydroxybutyric acid, and azelaic acid, as well as the total organic acid concentration and the metal element balance characteristics; comparing the training recognition result and the fifth recognition result, the training recognition result is optimal.
[0012] This application also provides a controller for executing the liquor grade identification method described in any of the above claims.
[0013] This application also provides a liquor grade identification device, including a processor and a memory storing a computer program. When the computer program is run by the processor, the processor executes the liquor grade identification method described above.
[0014] This application also provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, it implements the liquor grade identification method described in any of the above claims.
[0015] The baijiu (Chinese liquor) grade identification method provided in this application includes inputting 17 key features of the baijiu to be identified into a final identification model. The final identification model outputs the grade of the baijiu. Since the 17 key features input into the final identification model are based on correlation analysis, importance ranking methods, and recursive feature elimination methods, and utilize the initial identification model, features with a correlation greater than the correlation threshold with the baijiu grade are extracted from 36 basic features and 5 derived features of baijiu. Furthermore, the 5 derived features, generated from the 36 basic features, better reflect the differences between different baijiu grades and characterize the overall organic acid content, acidity balance, body stability, esterification potential, and metal element balance of the baijiu. Therefore, these 17 key features can accurately represent the grade of the baijiu, enabling the final identification model to output an accurate grade. In addition, in the method provided in this application, the final identification model performs the identification action, thus improving the objectivity of baijiu grade identification. The baijiu grade identification method provided in this application can improve the accuracy and objectivity of baijiu grade identification. Attached Figure Description
[0016] Figure 1 A flowchart illustrating a method for identifying the grade of baijiu (Chinese liquor) provided in this application embodiment; Figure 2 A flowchart illustrating a method for extracting 17 key features according to an embodiment of this application; Figure 3 A flowchart illustrating a method for determining the impact of 17 key features on the identification results of liquor grades, provided in an embodiment of this application; Figure 4 A flowchart illustrating a training method for a final recognition model provided in an embodiment of this application; Figure 5 A schematic diagram of the confusion matrix of a final SVM model provided in an embodiment of this application; Figure 6 A schematic diagram of the confusion matrix of a final KNN model provided in an embodiment of this application; Figure 7A schematic diagram of the confusion matrix of a final DT model provided in an embodiment of this application; Figure 8 This is a schematic diagram of the confusion matrix of a final MLP model provided in an embodiment of this application. Detailed Implementation
[0017] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, the embodiments of this application will be further described in detail below with reference to the accompanying drawings and specific implementation methods.
[0018] In this application, the terms "first," "second," etc., are used to distinguish identical or similar items that have essentially the same function. It should be understood that there is no logical or temporal dependency between "first," "second," and "nth," nor does it limit the quantity or order of execution. It should also be understood that although the following description uses the terms "first," "second," etc., to describe various elements, these elements should not be limited by the terms. These terms are merely used to distinguish one element from another.
[0019] See Figure 1 The figure is a flowchart of a liquor grade identification method provided in an embodiment of this application.
[0020] The liquor grade identification method provided in this application includes: S101: Input the 17 key features of the liquor to be identified into the final identification model.
[0021] The recognition models include Support Vector Machine (SVM), Multilayer Perceptron (MLP), K-Nearest Neighbor (KNN), and Decision Tree (DT) models. The final recognition model is obtained by optimizing the parameters of the initial recognition model based on 17 key features.
[0022] S102: The final recognition model outputs the grade of the liquor to be identified.
[0023] The principle of the SVM model is to find the optimal hyperplane that separates different samples with the maximum margin. In this embodiment, the 17 key features have a non-linear and inseparable correlation with the grade of baijiu. This embodiment introduces a radial basis function (RBF) to perform dimensionality-upgrading mapping of the feature space, thereby constructing an optimal hyperplane in a high-dimensional space that can clearly distinguish different grades of baijiu. Specifically, after receiving the 17 key feature data of the baijiu to be identified, the final SVM model introduces the RBF function to map the features to a higher-dimensional feature space, calculates the distance from the sample point to the optimal classification hyperplane, and determines the grade of the baijiu to be identified based on the sign and magnitude of the distance, finally outputting the grade of the baijiu to be identified.
[0024] The underlying principle of the MLP model is to accurately uncover the complex nonlinear correlation between 17 key features and the grade of baijiu (Chinese liquor) through a multi-layered neural architecture consisting of an input layer, hidden layers, and an output layer, combined with activation functions. Specifically, the MLP model takes the 17 key features of the baijiu to be identified as input to the input layer. The activation functions of the hidden layer neurons then perform a nonlinear transformation, mapping the low-dimensional features to a high-dimensional feature space, thus uncovering the complex correlation between the 17 key features and the grade of the baijiu. The output layer outputs the probability values corresponding to different grades for each sample. The category with the highest probability value is selected as the final grade classification result, and the grade of the baijiu to be identified is then output.
[0025] The principle of the final KNN model is to calculate the feature similarity between the liquor to be identified and all samples in the training set pre-input into the final KNN model, and select the K nearest neighbor samples to predict the correct category of the liquor to be identified. Specifically, after the 17 key features of the liquor to be identified are input into the constructed feature space, the final KNN model uses Euclidean distance to calculate the similarity between the 17 key features and the feature vectors of all training samples in the feature space, and sorts them in descending order of similarity. Based on the number of nearest neighbors k in the KNN model, the top k samples are selected as core neighbors, the distribution of the grade labels of the k nearest neighbors is statistically analyzed, and the grade with the highest frequency of occurrence is selected as the final identification result of the liquor to be identified, and the grade of the liquor to be identified is finally output.
[0026] The principle of the final DT model is to recursively partition the feature space, dividing the dataset into multiple subsets. Each subset corresponds to a node in the tree, and the prediction result is given at the leaf node. Specifically, after receiving the 17 key feature data of the liquor to be identified through the input layer, the final DT model starts from the root node of the decision tree and traverses the classification tree path layer by layer according to the 17 key features of the liquor to be identified, finally falling into the corresponding leaf node. The level label of the leaf node is the final identification result of the liquor to be identified, and the final output is the level of the liquor to be identified.
[0027] Among them, 17 key features are features with a correlation greater than the correlation threshold between the liquor grade and the liquor grade, extracted from 36 basic features and 5 derived features of liquor using an initial identification model based on correlation analysis, ranking importance method and recursive feature elimination method.
[0028] The 36 basic characteristics include: the concentration of acetic acid, the concentration of lactic acid, the concentration of 12 organic acids, and the concentration of 22 metal elements; the 12 organic acids include fumaric acid, tartaric acid, glyceric acid, malic acid, maleic acid, citric acid, succinic acid, 2-hydroxybutyric acid, 2-methylsuccinic acid, 2-hydroxy-3-methylbutyric acid, 3-phenyllactic acid, and azelaic acid; the 22 metal elements include Na, Mg, Al, K, Ca, Ti, V, Cr, Mn, Fe, Co, Ni, Cu, Zn, Ga, As, Se, Sr, Cd, Sb, Ba, and Pb.
[0029] Five derived characteristics are generated based on 36 basic characteristics to characterize the overall organic acid content, acidity balance, body stability, esterification potential, and metal element balance of baijiu. These five derived characteristics include total organic acid concentration, acidity balance characteristic, total metal element concentration, esterification characteristic, and metal element balance characteristic.
[0030] The 17 key characteristics include the concentrations of Na, Al, K, Ca, Co, Ti, lactic acid, acetic acid, tartaric acid, malic acid, glyceric acid, maleic acid, 2-methylsuccinic acid, 2-hydroxy-3-methylbutyric acid and 3-phenyllactic acid, as well as the concentration of total organic acids and the balance of metal elements.
[0031] There are differences in the 36 basic characteristics between different grades of baijiu. Five derived characteristics can further reflect the differences between different grades of baijiu. The 17 key characteristics are those that are strongly correlated with the grade of baijiu as determined in the embodiments of this application. Therefore, they can accurately reflect the grade of baijiu. Determining the grade of baijiu to be identified based on the 17 key characteristics of the baijiu to be identified can effectively improve the accuracy of baijiu grade identification.
[0032] The baijiu (Chinese liquor) grade identification method provided in this application includes inputting 17 key features of the baijiu to be identified into a final identification model. The final identification model outputs the grade of the baijiu. Since the 17 key features input into the final identification model are based on correlation analysis, importance ranking methods, and recursive feature elimination methods, and utilize the initial identification model, features with a correlation greater than the correlation threshold with the baijiu grade are extracted from 36 basic features and 5 derived features of baijiu. Furthermore, the 5 derived features, generated from the 36 basic features, better reflect the differences between different baijiu grades and characterize the overall organic acid content, acidity balance, body stability, esterification potential, and metal element balance of the baijiu. Therefore, these 17 key features can accurately represent the grade of the baijiu, enabling the final identification model to output an accurate grade. In addition, in the method provided in this application, the final identification model performs the identification action, thus improving the objectivity of baijiu grade identification. The baijiu grade identification method provided in this application can improve the accuracy and objectivity of baijiu grade identification.
[0033] One possible implementation involves five derived features: total organic acid concentration, acidity balance feature, total metal element concentration, esterification feature, and metal element balance feature. Specifically, these include: The total organic acid concentration, used to characterize the overall organic acid content of baijiu, is calculated by summing the concentrations of acetic acid, lactic acid, and 12 other organic acids. The overall organic acid content of baijiu can influence its flavor and pH value.
[0034] An acidity balance characteristic is generated based on the ratio of acetic acid concentration to lactic acid concentration to characterize the acidity balance of baijiu.
[0035] The total metal element concentration used to characterize the stability of baijiu is generated based on the sum of the concentrations of 22 metal elements.
[0036] The esterification characteristics are generated based on the sum of the concentrations of Na, Mg, Al, K, Ca, and Fe, which are used to characterize the esterification potential of baijiu; the larger the esterification characteristics, the greater the esterification potential of baijiu.
[0037] The metal element balance characteristics used to characterize the metal element balance of baijiu are generated based on the ratio of the sum of the concentrations of Na and K to the sum of the concentrations of Ca and Mg.
[0038] The following description, in conjunction with the accompanying diagram, introduces the extraction method for 17 key features. It should be understood that the extraction method for 17 key features is an action performed during the training of the liquor grade recognition method, and is not included in the liquor grade recognition method itself.
[0039] See Figure 2The figure is a flowchart of a method for extracting 17 key features provided in an embodiment of this application.
[0040] One possible implementation, a method for extracting 17 key features, includes: S201: Obtain liquor samples with grades A, B, C, and D from high to low, with the same number of samples for each grade; divide the samples of each grade into training and test sets according to a preset ratio.
[0041] For example, grade A represents premium grade baijiu, grade B represents superior grade baijiu, grade C represents first grade baijiu, and grade D represents second grade baijiu.
[0042] One possible implementation is that the samples for each level can be divided into 70% training set and 30% test set.
[0043] S202: Input 36 basic features and 5 derived features for each sample in the training set.
[0044] One possible implementation method is that, in this embodiment of the application, high performance liquid chromatography can be used to detect the concentration of lactic acid and acetic acid in each sample, ultra-high performance liquid chromatography-mass spectrometry can be used to detect the concentration of 12 organic acids in each sample, and inductively coupled plasma mass spectrometry can be used to detect the concentration of 22 metal elements in each sample.
[0045] One possible implementation method for high-performance liquid chromatography (HPLC) detection conditions may include: using a Venusil ABSGold C18 column with a column length of 250 mm × column inner diameter of 4.6 mm and a packing particle size of 5 μm; controlling the column temperature within the range of 25℃ to 35℃; setting the flow rate to 0.8 mL / min to 1.2 mL / min; setting the injection volume to 8 μL to 12 μL; using a binary mobile phase, wherein phase A is a 0.05% to 0.15% potassium dihydrogen phosphate solution and phase B is methanol; maintaining the volume fraction of phase B at 10% for 0.0 min to 10.0 min; setting the detection wavelength to 210 nm and the peak elution time corresponding to the target component to 6.3 min.
[0046] Each sample can first be filtered through an organic filter membrane with a pore size of 0.22 μm, and then the filtered sample can be detected by high performance liquid chromatography.
[0047] One possible implementation method is that the ultra-high performance liquid chromatography-mass spectrometry detection conditions include chromatographic detection conditions and mass spectrometric detection conditions.
[0048] The chromatographic detection conditions may include: using Hypersic Gold A C18 chromatographic column with a length of 150 mm and an inner diameter of 2.1 mm, and a packing particle size of 1.9 μm; column temperature controlled within the range of 35℃ to 40℃; flow rate set between 0.1 mL / min and 0.3 mL / min; injection volume set between 1 μL and 3 μL; a binary mobile phase is used, where phase A is a 0.05% to 0.2% (w / w) aqueous formic acid solution and phase B is pure methanol; a gradient elution program is used, specifically: from 0 min to 1.0 min, maintain phase B at 5% (w / w); from 1.0 min to 4.0 min, maintain phase B at 5% to 30% (w / w); from 4.0 min to 9.0 min, maintain phase B at 30% to 100% (w / w); from 9.0 min to 13.0 min, maintain phase B at 100% (w / w); from 13.1 min to 16.0 min, restore phase B to 5% (w / w) and maintain this level.
[0049] Mass spectrometry detection conditions may include: using a heated electrospray ionization source in negative ion mode; employing a full scan / data-dependent two-stage scan mode; a primary scan resolution of 90,000; sheath gas flow rate controlled at 40 to 50 ab, and auxiliary gas flow rate controlled at 7 to 13 ab; ion source temperature of 350°C, capillary temperature of 300°C; spray voltage of -2.0 kV to -3.0 kV; primary scan mass range of 50.0 Da to 500.0 Da; secondary scan resolution of 30,000; and normalized collision energies set to 10 eV, 20 eV, and 30 eV, respectively.
[0050] In this embodiment, 1 mL of sample can be drawn from each sample and placed in a centrifuge tube. The sample is dried at 70°C until the remaining volume is 0.3 mL to 0.4 mL. Then, pure water is added to make up to 1 mL. After vortex mixing, the sample is filtered through a filter membrane with a pore size of 0.22 μm. The filtered sample is then detected by ultra-high performance liquid chromatography-mass spectrometry.
[0051] One possible implementation method for inductively coupled plasma mass spectrometry (ICP-MS) detection conditions may include: plasma gas flow rate controlled at 10 L / min to 20 L / min; auxiliary gas, carrier gas, and compensation / dilution gas flow rates all controlled at 0.8 L / min to 1.2 L / min; atomization chamber temperature controlled at 1 °C to 3 °C; and peristaltic pump speed set to 0.1 rps.
[0052] In this embodiment, 1 mL of sample is drawn from each sample and placed in a special sample vial for inductively coupled plasma mass spectrometry (ICP-MS). The sample is concentrated at 70°C until the remaining volume is 0.4 mL. Then, 20 μL of 2.5% nitric acid solution is added, and the sample is vortexed and mixed. The processed sample is then detected by ICP-MS.
[0053] The concentrations of acetic acid, lactic acid, and 12 organic acids are expressed in mg / L, while the concentrations of 22 metal elements are expressed in μg / L.
[0054] S203: Based on correlation analysis, obtain the first feature subset, which includes basic features and derived features whose correlation coefficient with the grade of liquor is greater than the correlation threshold.
[0055] The correlation analysis can be Spearman correlation analysis, a non-parametric statistical method used to measure the monotonic correlation between two variables. In the method provided in this application embodiment, correlation analysis is used to determine the correlation between the grade of baijiu and the characteristics of baijiu (including 36 basic characteristics and 5 derived characteristics), and to extract the characteristics that are strongly correlated with the grade of baijiu.
[0056] Specifically, the correlation analysis included: First, preprocessing was performed to remove missing or outlier values from the 36 basic features and 5 derived features of the four grades of baijiu samples. Then, the analysis parameters were set to bivariate correlation, using the Spearman correlation coefficient with a confidence interval of 95%. Finally, 14 features with a significance level less than 0.05 and a correlation coefficient greater than the correlation threshold with the baijiu grade were selected. For example, the correlation threshold could be 0.5. The 14 features included Al, Co, Ti, Na, V, lactic acid, acetic acid, maleic acid, citric acid, 2-methylsuccinic acid, 2-hydroxybutyric acid, and azelaic acid, as well as total organic acid concentration and metal element balance characteristics.
[0057] S204: Based on the importance ranking method and the initial identification model, obtain the second feature subset, the third feature subset, the fourth feature subset and the fifth feature subset; the second to fifth feature subsets are the features in the basic features and derived features of the corresponding model whose importance is greater than the importance threshold.
[0058] The permutation importance method is an analytical method that uses features randomly shuffled to predict the model and calculate the model's performance index. It compares the performance index of the model after shuffling with that of the model before shuffling to determine the degree of performance degradation, thereby calculating the contribution of features to the model's predictive ability.
[0059] Specifically, the importance ranking method includes the following steps: First, based on the 36 basic features and 5 derived features of each sample in the input training set, train an initial SVM model, an initial MLP model, an initial KNN model, and an initial DT model. Use five-fold cross-validation and calculate the performance metrics of the four models using a test set. Then, randomly shuffle the features and calculate the performance metrics of the four models again, calculating the importance score of each feature to the model. Repeat this process 50 times, then sort all features in descending order of importance score. Finally, select the features with importance greater than an importance threshold from the four models and output them. For example, the importance threshold can be the average importance score. The second feature subset obtained based on the importance ranking method and the initial SVM model includes 23 features; the third feature subset obtained based on the importance ranking method and the initial MLP model includes 21 features; the fourth feature subset obtained based on the importance ranking method and the initial KNN model includes 23 features; and the fifth feature subset obtained based on the importance ranking method and the initial DT model includes 8 features.
[0060] S205: Based on the recursive feature elimination method and the initial recognition model, obtain the sixth feature subset, the seventh feature subset, the eighth feature subset and the ninth feature subset; the sixth to ninth feature subsets are the features in the basic features and derived features of the corresponding model whose impact on performance is greater than the impact threshold.
[0061] Among them, recursive feature elimination is an analytical method that finds the optimal feature subset that has the greatest impact on model performance by recursively building the model and removing unimportant features.
[0062] Specifically, the recursive feature elimination method includes: First, based on the 36 basic features and 5 derived features of each sample in the input training set, an initial SVM model, an initial MLP model, an initial KNN model, and an initial DT model are trained. A five-fold cross-validation method is used to obtain the first feature importance ranking subset. At this point, the last 5 features in importance ranking are removed in descending order. This process is then iterated until the performance of the initial recognition model reaches its optimal condition, and the features that were not removed are output. Specifically, the sixth feature subset obtained based on the recursive feature elimination method and the initial SVM model includes 20 features; the seventh feature subset obtained based on the recursive feature elimination method and the initial MLP model includes 10 features; the eighth feature subset obtained based on the recursive feature elimination method and the initial KNN model includes 10 features; and the ninth feature subset obtained based on the recursive feature elimination method and the initial DT model includes 40 features.
[0063] The execution order of S203, S204 and S205 is not specifically limited in this application embodiment, and can be set according to actual application requirements.
[0064] S206: Extract 17 key features that appear more frequently than the frequency threshold from the first to ninth feature subsets.
[0065] For example, the frequency threshold can be 5.
[0066] The method for extracting 17 key features provided in this application embodiment is based on correlation analysis, importance ranking method, and recursive feature elimination method. Using an initial identification model, it extracts key features that are strongly correlated with the grade of baijiu from 36 basic features and 5 derived features of baijiu. Since these 17 key features are strongly correlated with the grade of baijiu, the baijiu grade identification method provided in this application embodiment can accurately identify the grade of baijiu to be identified based on the 17 key features of the baijiu to be identified, thus improving the accuracy of baijiu grade identification.
[0067] See Figure 3 The figure is a flowchart of a method for determining the influence of 17 key features on the identification results of liquor grades, provided in an embodiment of this application.
[0068] One possible implementation, in order to determine the impact of 17 key features on the liquor grade recognition result, after extracting the 17 key features, the training method for liquor grade recognition provided in this application embodiment further includes: S301: Input the 17 key features of each sample in the training set into the initial recognition model to obtain the training recognition results.
[0069] One possible implementation is that the recognition results can include the recognition accuracy, precision, recall, F1 score, and AUC.
[0070] Accuracy measures the overall correctness of the model's identification, and can be expressed as the proportion of samples whose predicted grade matches the true grade of the sample out of the total number of samples. A higher accuracy indicates a higher overall accuracy in identifying the four grades of baijiu.
[0071] Precision measures the reliability of a model's predictions. For a given grade, it can be expressed as the percentage of samples predicted as grade A by the model that actually belong to that grade. For example, if the initial SVM model predicts 50 samples as grade A, and the actual grade is grade A, then 48 samples would be grade A. A higher precision for a grade of baijiu indicates a higher proportion of samples correctly identified as that grade, reflecting errors such as misidentifying other grades (e.g., lower-grade baijiu) as that grade (e.g., higher-grade baijiu).
[0072] Recall measures a model's ability to cover samples of a target grade. For a given grade, it can be expressed as the percentage of samples correctly identified as belonging to that grade among those samples with a true grade. The F1 score is the harmonic mean of precision and recall, used to measure the model's overall recognition ability. AUC, the area under the receiver operating characteristic curve, measures the model's binary classification ability, reflecting its generalization ability and its ability to distinguish between different grades of liquor.
[0073] S302: Input the 36 basic features of each sample in the training set into the initial recognition model to obtain the first recognition result.
[0074] S303: Input the 36 basic features and 5 derived features of each sample in the training set into the initial recognition model to obtain the second recognition result.
[0075] S304: Input the concentrations of the 22 metal elements in each sample of the training set into the initial recognition model to obtain the third recognition result.
[0076] S305: Input the concentrations of acetic acid, lactic acid, and 12 organic acids of each sample in the training set into the initial recognition model to obtain the fourth recognition result.
[0077] S306: Input the features included in the first feature subset of each sample in the training set into the initial recognition model to obtain the fifth recognition result.
[0078] The execution order of S301 to S306 is not specifically limited in this application embodiment, and can be set according to actual application requirements.
[0079] S307: Comparing the training recognition results with the first to fifth recognition results, the training recognition results are the best.
[0080] See Table 1, which shows the recognition results of the initial recognition model under different feature variables. Through comprehensive comparison, the training recognition result is the best. The 17 key features can improve the recognition accuracy of the initial recognition model. That is, the initial recognition model has the best overall effect in recognizing the grade of liquor based on the 17 key features.
[0081] Table 1. Recognition results of the initial recognition model under different feature variables.
[0082] The training method for the final recognition model is described below with reference to the accompanying diagram.
[0083] See Figure 4 The figure is a flowchart of a training method for a final recognition model provided in an embodiment of this application.
[0084] One possible implementation, and the final training method for the recognition model, includes: S401: After extracting 17 key features, input the 17 key features of each sample in the training set into the initial recognition model, and use five-fold cross-validation to obtain the training recognition results.
[0085] One possible implementation is that the tuneLength parameter of the identification model can include 3.
[0086] S402: If the training recognition result does not meet the result threshold, adjust the parameters of the initial recognition model until the recognition result meets the result threshold, and determine the final recognition model.
[0087] S403: Input the 17 key features of each sample in the test set into the final recognition model to obtain the test recognition results.
[0088] S404: If the test recognition results meet the result threshold, obtain the final recognition model.
[0089] One possible implementation is that the parameters of the final recognition model may include: a penalty parameter of 5 for the final SVM model; a nearest neighbor number of 9 for the final KNN model; a minimum number of samples required for node splitting of the cp node in the final DT model of 5, a minimum number of samples for leaf nodes of 2, and a maximum tree depth of 10; and a hidden neuron number of 20, a weight decay parameter of 0.01, and a maximum weight limit of 3000 for the final MLP model.
[0090] To clearly demonstrate the recognition performance of the final recognition model, the following diagram compares the actual levels of the samples in the test set with the levels of the samples in the test set recognized by the final recognition model.
[0091] See Figure 5 The figure is a schematic diagram of the confusion matrix of a final SVM model provided in an embodiment of this application.
[0092] See Figure 6 The figure is a schematic diagram of the confusion matrix of a final KNN model provided in an embodiment of this application.
[0093] See Figure 7 The figure is a schematic diagram of the confusion matrix of a final DT model provided in an embodiment of this application.
[0094] See Figure 8 The figure is a schematic diagram of the confusion matrix of a final MLP model provided in an embodiment of this application.
[0095] Figures 5 to 8This is a confusion matrix of the recognition results (predicted category) and actual results (actual category) of the final recognition model provided in this application embodiment, which can clearly demonstrate the recognition accuracy of the final recognition model.
[0096] To clearly compare the recognition results of the initial recognition model and the final recognition model, in this embodiment of the application, after obtaining the final recognition model, 17 key features of each sample in the training set are input into the initial recognition model to obtain the recognition result of the initial recognition model, which is the aforementioned training recognition result; then, 17 key features of each sample in the training set are input into the final recognition model to obtain the recognition result of the final recognition model; comparing the recognition results of the two models, the recognition result of the final recognition model is superior.
[0097] See Table 2, which shows the recognition results of the recognition models with different parameters. After comprehensive comparison, the recognition results of the final recognition model are better. The final recognition model has the best overall effect in recognizing the grade of liquor based on 17 key features.
[0098] Table 2 Recognition results of recognition models with different parameters
[0099] The training method for the final recognition model provided in this application embodiment trains the recognition model based on 17 key features that are strongly correlated with the grade of baijiu. By optimizing the recognition model, the final recognition model deeply fits the mapping relationship between the 17 key features and the grade of baijiu, improving the accuracy of the final recognition model's response to the 17 key features and enhancing the adaptability of the 17 key features and the final recognition model. This enables the baijiu grade recognition method provided in this application embodiment to accurately identify the grade of the baijiu to be identified based on the 17 key features of the baijiu to be identified through the final recognition model, thereby improving the accuracy of the final recognition model in identifying the grade of baijiu based on the 17 key features.
[0100] One possible implementation method for training the final recognition model includes, after executing S304, the following: if the test recognition result does not meet the result threshold, continue to perform adjustment actions until both the training recognition result and the test recognition result meet the result threshold, and obtain the final recognition model.
[0101] Based on the liquor grade identification method described above, this application embodiment also provides a controller for executing the liquor grade identification method described above.
[0102] The controller provided in this application embodiment is also used to execute the training method for identifying the grade of liquor described above.
[0103] Based on the liquor grade identification method described above, this application embodiment also provides a liquor grade identification device, including a processor and a memory storing a computer program. When the computer program is run by the processor, the processor executes the liquor grade identification method described above.
[0104] Based on the liquor grade identification method described above, this application embodiment also provides a computer-readable storage medium storing a computer program thereon, wherein when the computer program is executed by a processor, it implements the liquor grade identification method described above.
[0105] It should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0106] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for identifying the grade of baijiu (Chinese liquor), characterized in that, include: Seventeen key features of the liquor to be identified were input into the final identification model; The final identification model is obtained by optimizing the parameters of the initial identification model based on the 17 key features. The identification model includes a Support Vector Machine (SVM) model, a Multilayer Perceptron (MLP) model, a K-Nearest Neighbor (KNN) model, and a Decision Tree (DT) model. The 17 key features are features with a correlation greater than the correlation threshold between the initial identification model and the 36 basic features and 5 derived features of baijiu. These features are generated based on the 36 basic features and are used to characterize the overall content of organic acids, acidity balance, body stability, esterification potential, and metal element balance of baijiu. The final identification model outputs the grade of the liquor to be identified; The 36 basic characteristics include: the concentration of acetic acid, the concentration of lactic acid, the concentration of 12 organic acids, and the concentration of 22 metal elements; the 12 organic acids include fumaric acid, tartaric acid, glyceric acid, malic acid, maleic acid, citric acid, succinic acid, 2-hydroxybutyric acid, 2-methylsuccinic acid, 2-hydroxy-3-methylbutyric acid, 3-phenyllactic acid, and azelaic acid; the 22 metal elements include Na, Mg, Al, K, Ca, Ti, V, Cr, Mn, Fe, Co, Ni, Cu, and Z. The five derived characteristics include total organic acid concentration, acidity balance characteristics, total metal element concentration, esterification characteristics, and metal element balance characteristics; the seventeen key characteristics include the concentrations of Na, Al, K, Ca, Co, Ti, lactic acid, acetic acid, tartaric acid, malic acid, glyceric acid, maleic acid, 2-methylsuccinic acid, 2-hydroxy-3-methylbutyric acid, and 3-phenyllactic acid, as well as the concentration of total organic acids and metal element balance characteristics.
2. The method according to claim 1, characterized in that, The five derived characteristics are generated based on the 36 basic characteristics to characterize the overall organic acid content, acidity balance, body stability, metal element balance, and esterification potential of baijiu, including: The total organic acid concentration, used to characterize the overall organic acid content of baijiu, is generated based on the sum of the concentrations of the acetic acid, the lactic acid, and the 12 organic acids. The acidity balance characteristic is generated based on the ratio of the concentration of acetic acid to the concentration of lactic acid, which is used to characterize the acidity balance of baijiu. The total metal element concentration, used to characterize the stability of baijiu, is generated based on the sum of the concentrations of the 22 metal elements. The esterification characteristic, used to characterize the esterification potential of baijiu, is generated based on the sum of the concentrations of Na, Mg, Al, K, Ca, and Fe; the larger the esterification characteristic, the greater the esterification potential of the baijiu. The metal element balance characteristic is generated based on the ratio of the sum of the concentrations of Na and K to the sum of the concentrations of Ca and Mg, which is used to characterize the metal element balance of baijiu.
3. The method according to claim 2, characterized in that, The 17 key features are based on correlation analysis, importance ranking, and recursive feature elimination. Using the initial identification model, these features, which have a correlation greater than a correlation threshold with the grade of baijiu (Chinese liquor), are extracted from the 36 basic features and 5 derived features of baijiu. These include: Collect samples of baijiu (Chinese liquor) of grades A, B, C, and D from highest to lowest, with the same number of samples for each grade; divide the samples of each grade into a training set and a test set according to a preset ratio. Input the 36 basic features and 5 derived features of each sample in the training set; Based on the correlation analysis, a first feature subset is obtained, which includes the basic features and the derived features whose correlation coefficient with the grade of liquor is greater than the correlation threshold. Based on the aforementioned importance ranking method and the initial identification model, a second feature subset, a third feature subset, a fourth feature subset, and a fifth feature subset are obtained; the second to fifth feature subsets are, respectively, features in the corresponding model whose importance is greater than the importance threshold among the basic features and the derived features. Based on the recursive feature elimination method and the initial recognition model, the sixth feature subset, the seventh feature subset, the eighth feature subset, and the ninth feature subset are obtained; the sixth to ninth feature subsets are the features in the basic features and the derived features in the corresponding models whose impact on performance is greater than the impact threshold. The 17 key features that appear more frequently than a frequency threshold are extracted from the first to ninth feature subsets.
4. The method according to claim 3, characterized in that, The final recognition model is obtained by optimizing the parameters of the initial recognition model based on the 17 key features, including: After extracting the 17 key features, the 17 key features of each sample in the training set are input into the initial recognition model, and five-fold cross-validation is used to obtain the training recognition results. If the training recognition result does not meet the result threshold, adjust the parameters of the initial recognition model until the training recognition result meets the result threshold, and determine the final recognition model; The 17 key features of each sample in the test set are input into the final recognition model to obtain the test recognition results; If the test recognition result meets the result threshold, the final recognition model is obtained.
5. The method according to claim 4, characterized in that, If the test recognition result does not meet the result threshold, the adjustment action continues until both the training recognition result and the test recognition result meet the result threshold, and the final recognition model is obtained.
6. The method according to any one of claims 3-5, characterized in that, After extracting the 17 key features, the following is also included: The 17 key features of each sample in the training set are input into the initial recognition model to obtain the training recognition results; The 36 basic features of each sample in the training set are input into the initial recognition model to obtain the first recognition result; The 36 basic features and 5 derived features of each sample in the training set are input into the initial recognition model to obtain the second recognition result; The concentrations of 22 metal elements in each sample of the training set are input into the initial recognition model to obtain the third recognition result; The concentrations of acetic acid, lactic acid, and 12 organic acids of each sample in the training set are input into the initial recognition model to obtain the fourth recognition result. Comparing the training recognition results with the first to fourth recognition results, the training recognition results are optimal.
7. The method according to claim 4 or 5, characterized in that, After extracting the 17 key features, the following is also included: The 17 key features of each sample in the training set are input into the initial recognition model, and five-fold cross-validation is used to obtain the training recognition results. The features included in the first feature subset of each sample in the training set are input into the initial recognition model to obtain the fifth recognition result; the first feature subset includes the concentrations of Al, Co, Ti, Na, V, lactic acid, acetic acid, maleic acid, citric acid, 2-methylsuccinic acid, 2-hydroxybutyric acid and azelaic acid, as well as the total organic acid concentration and the metal element balance characteristics; Comparing the training recognition result and the fifth recognition result, the training recognition result is the best.
8. A controller, characterized in that, Used to perform the liquor grade identification method according to any one of claims 1-7.
9. A liquor grade identification device, comprising a processor and a memory storing a computer program, characterized in that, When the computer program is run by the processor, the processor performs the liquor grade identification method as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, It stores a computer program, wherein when the computer program is executed by a processor, it implements the liquor grade identification method according to any one of claims 1-7.