Method and device for distinguishing aging years and key metals based on metal concentration
Through the neural network model based on metal concentration and SHAP algorithm, the aging year prediction model is established, which solves the problem of lack of scientific discrimination methods in the existing technology, and achieves higher accuracy aging year evaluation and determination of key metal elements, improving the brewing process optimization and wine quality.
Patent Information
- Application Number
- CN202510365140.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-26
- Publication Date
- 2025-07-08
AI Technical Summary
The existing technology lacks scientific and standardized methods to determine the aging years, and fails to fully explore the complex relationship between polymetallic elements and years, which affects the optimization of brewing process and the improvement of wine quality.
Aging year prediction model is established based on metal concentration, and a neural network model is used to train and embed metal element contribution modules, and key metals are determined through SHAP algorithm, and the model effectiveness is maintained in combination with an abnormal alarm module.
提高了陈酿年份评估的准确性,能够更准确地确定关键金属元素,提供科学指导以优化酿酒工艺和提升酒品质。
Smart Images

Figure CN120280041A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of wine brewing, and specifically to a method and device for discriminating aging years and key metals based on metal concentrations. Background Art
[0002] The aging year is an important indicator for measuring the quality of wine, directly affecting consumers' purchase decisions and market pricing. However, since the aging year is difficult to be discriminated by intuitive senses, the current industry mainly relies on empirical judgments or subjective evaluations, lacking scientific and standardized discrimination methods. In recent years, with the development of analytical techniques, research has shown that there is a certain correlation between the concentrations of metal elements in aging and their aging years. However, existing research is mainly based on single elements or simple statistical models, failing to fully explore the combined characteristics of multiple metal elements and the complex relationship with years. At the same time, the influencing mechanism of key metal elements is still unclear, making it difficult to provide scientific guidance for optimizing brewing processes and improving wine quality. Summary of the Invention
[0003] In order to improve the accuracy of aging year assessment and obtain the metal elements that play a key role in the aging year, the present application provides a method and device for discriminating aging years and key metals based on metal concentrations.
[0004] The technical solution adopted by the present invention to solve the above problems is as follows:
[0005] A method for discriminating aging years and key metals based on metal concentrations, comprising:
[0006] Step 1, create a metal element - aging year database, including metal element concentrations and corresponding aging years;
[0007] Step 2, based on a neural network model, with metal element concentrations as inputs and aging years as outputs, create an aging year prediction model, and train the aging year prediction model based on the metal element - aging year database;
[0008] Step 3, embed a metal element contribution module for analyzing the contribution degree of each metal element into the trained aging year prediction model;
[0009] Step 4, obtain the metal element concentrations in the aging to be predicted, predict the aging year based on the aging year prediction model, and determine the key metals according to the contribution degree of each metal element.
[0010] Further, the metal elements include: Be, Na, Mg, Al, K, Ca, Cr, Fe, Cu, As, Ag, Cd, and Ba.
[0011] Further, the specific steps for training the aging year prediction model based on the metal element - aging year database are:
[0012] Divide the data in the metal element - aging year database into a training set and a test set;
[0013] Take the aging year in the metal element - aging year database as the true output label;
[0014] Train a neural network model with the training set. During the training process, compare the predicted value of the neural network model with the corresponding true output label, calculate the corresponding loss function, and optimize the model through the backpropagation of the neural network;
[0015] Validate the neural network model with the test set. When the corresponding loss function is less than the loss function threshold and the accuracy of the test set is greater than the accuracy threshold, take the corresponding neural network model as the aging year prediction model.
[0016] Further, when initially training the model, determine the initial weights according to the statistical characteristics of the metal element concentration; the initial weight calculation formula is:
[0017]
[0018] In the formula, is the initialization weight of the i-th metal element, N is the total number of metal elements; φ i is the variance value of the concentration of the i-th metal element;
[0019] During the model training process, adjust the allocation of each feature weight in real time through the attention mechanism, and the calculation formula is:
[0020]
[0021] In the formula, w i is the weight of the i-th metal element, x i is the concentration feature of the i-th metal element, f(x i ) is the importance score of the i-th metal element, and N is the total number of metal elements.
[0022] Further, it also includes regularly updating the metal element - aging year database and adjusting the aging year prediction model according to the updated data.
[0023] Further, the processing steps of the metal element contribution module are:
[0024] Calculate the SHAP value of each metal element on the prediction result through the SHAP algorithm;
[0025] Evaluate the contribution degree of each metal element according to the calculated SHAP value;
[0026] Sort the contribution degrees of all metal elements, and select the top A metal elements with the highest contribution degrees as the key metals.
[0027] Furthermore, when creating the metal element - aging year database, it also includes: preprocessing the data.
[0028] The aging year and key metal discrimination device based on metal concentration includes:
[0029] Data collection module: Obtain the metal element concentrations and corresponding aging years of aging sample data, and form a metal element - aging year database;
[0030] Model construction module: Based on the neural network model, use the metal element concentration as the input and the aging year data as the output to create an aging year prediction model, and train the aging year prediction model based on the metal element - aging year database;
[0031] Feature contribution calculation module: Analyze the contribution degrees of each metal element based on the aging year prediction model;
[0032] Feature acquisition module: Obtain the metal element concentrations of the aging to be predicted;
[0033] Prediction and identification module: Obtain the aging year prediction result of the aging to be predicted based on the aging year prediction model, and determine the key metals based on the contribution degrees of each metal element.
[0034] Furthermore, it also includes:
[0035] Abnormal alarm module: Used to regularly obtain the actual year of aging. When the ratio of the year predicted by the aging year prediction model to the actual year is higher than the preset threshold, trigger an alarm, and update the metal element - aging year database and the aging year prediction model.
[0036] The beneficial effects of the present invention compared with the prior art are: Creating an aging year prediction model based on the metal element concentration and the corresponding aging year, and completing the determination of the aging year based on the aging year prediction model, with higher accuracy; Introducing the metal element contribution degree based on the aging year prediction model, and determining the metal elements that play a key role in the aging year by calculating the metal element contribution degree, which is more convenient to use; Regularly checking the reliability of the model through the abnormal alarm module, regularly updating the metal element - aging year database, and adjusting the aging year prediction model according to the updated data to maintain the real - time effectiveness of the aging year prediction model, which is more reliable to use; By determining the metal elements that play a key role in the aging year, it can provide a reference for the optimization of subsequent brewing processes and quality improvement. Brief Description of the Drawings
[0037] Figure 1Flow chart of the method for discriminating the aging years and key metals based on metal concentration;
[0038] Figure 2 Schematic diagram of the change of the loss function in the training process of the aging year prediction model;
[0039] Figure 3 Schematic diagram of the confusion matrix of the discrimination results of the aging years;
[0040] Figure 4 Schematic diagram of the mean value ranking of the SHAP values of the metal elements corresponding to a certain aging year;
[0041] Figure 5 Schematic diagram of the scatter plot of the SHAP values of the metal elements corresponding to a certain aging year;
[0042] Figure 6 Schematic diagram of the structure of the device for discriminating the aging years and key metals based on metal concentration. Detailed implementation manners
[0043] In order to make the objectives, technical solutions and advantages of the present invention clearer and more understandable, the present invention will be further described in detail below in conjunction with embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0044] As Figure 1 shown, the method for discriminating the aging years and key metals based on metal concentration includes:
[0045] Step 1: Create a metal element - aging year database, including the metal element concentrations and the corresponding aging years. Among them, the metal elements include: Be, Na, Mg, Al, K, Ca, Cr, Fe, Cu, As, Ag, Cd, Ba, etc. In this embodiment, a total of 26 metal elements are considered, which are represented by metal 1, metal 2,..., metal 26 respectively. In this embodiment, the data considers 5 aging years of Baijiu, which are 0 year, 1 year, 3 years, 5 years, and 10 years respectively.
[0046] In order to improve the data accuracy, when creating the metal element - aging year database, this embodiment also pre - processes the data, such as removing the missing values or abnormal values in the metal element - aging year dataset.
[0047] Step 2: Based on the neural network model, using the metal element concentration as the input and the aging year as the output, create an aging year prediction model, and train the aging year prediction model based on the metal element - aging year database.
[0048] Neural network models such as MLP, LSTM, RNN, CNN, Transformer, etc., or combined models of the above models can also be used. In this embodiment, the aging year prediction model is constructed based on LSTM.
[0049] To eliminate the influence of different compound magnitudes, the metal element data can also be normalized before being input into the model. The sklearn.preprocessing.StandardScaler function can be used to standardize the data into a normal distribution with a mean of 0 and a standard deviation of 1.
[0050] The specific steps for training the aging year prediction model based on the metal element - aging year database are as follows: Divide the data in the metal element - aging year database into a training set and a test set; Use the aging years in the metal element - aging year database as the true output labels; Train the neural network model with the training set. During the training process, compare the predicted values of the neural network model with the corresponding true output labels, calculate the corresponding loss function, and optimize the model through the backpropagation of the neural network; Verify the neural network model with the test set. When the corresponding loss function is less than the loss function threshold and the test set accuracy is greater than the accuracy threshold, use the corresponding neural network model as the aging year prediction model.
[0051] The metal element concentrations in the training set of the metal element - aging year database can also be data - augmented in the form of small - range data fluctuations. Specifically:
[0052] Fluctuate the metal concentrations in the training set data within the range of ±5% without changing the corresponding aging years to achieve data augmentation. In this embodiment, the loss function uses the cross - entropy loss function, and its expression is: In the formula, M is the number of wine samples, C is the number of stages, p ij is the true aging year label of the i - th wine sample corresponding to the j - th aging year, is the probability that the i - th wine sample is predicted to be aging year j. Other loss functions such as mean squared error and mean absolute error can also be used, which are not limited here. The schematic diagram of the change of the loss function during the training process is as Figure 2 shown. In addition, the model in this embodiment can achieve 100% accuracy in aging year discrimination for all test set data, as Figure 3 shown.
[0053] In addition, the aging year prediction model of this embodiment optimizes the response to different metal elements through an adaptive weight allocation mechanism, specifically including:
[0054] When the model is initially trained, the initial weights are determined according to the statistical characteristics of metal elements; when the model is periodically fine-tuned and updated based on the transfer learning method, the initial weights are determined according to the contribution degrees of each metal element; the formula for the initial weights is:
[0055]
[0056] In the formula, is the initial weight of the i-th metal element, and N is the total number of metal elements; when determining the initial weights according to the statistical characteristics of metal elements, φ i is the variance value of the concentration of the i-th metal element, and when determining the initial weights according to the contribution degrees of each metal element, φ i is the mean value of the SHAP values of the i-th metal element;
[0057] During the model training process, the weight allocation of each feature is adjusted in real time through the attention mechanism, and the calculation formula is:
[0058]
[0059] In the formula, w i is the weight of the i-th metal element, x i is the concentration feature of the i-th metal element, f(x i ) is the importance score of the i-th metal element, which is usually calculated by the attention layer neural network, and N is the total number of metal elements.
[0060] The model is periodically fine-tuned and updated based on the transfer learning method means that: the aging year prediction model is updated as the metal element-aging year database is periodically updated, specifically including: after accumulating new data, retraining specific layers of the model to maintain the stability of historical data; using transfer learning technology to perform incremental updates on the existing model to reduce computational costs; ensuring the model performance through the validation set of the metal element-aging year database after the update is completed.
[0061] Step 3. In order to facilitate knowing the metal elements that play a key role in the determination of the aging year, in this embodiment, a metal element contribution module for analyzing the contribution degrees of each metal element is embedded in the trained aging year prediction model. The processing steps of the metal element contribution module are:
[0062] Step 31. Calculate the SHAP value of each metal element on the prediction result through the SHAP algorithm;
[0063] Step 32. Evaluate the contribution degree of each metal element according to the calculated SHAP value;
[0064] Step 33: Sort the contribution degrees of all metal elements, and select the top A metal elements with the highest contribution degrees as key metals, where A can be determined according to actual needs.
[0065] Among them, the SHAP algorithm can be expressed as:
[0066]
[0067] In the formula, φ j is the SHAP value of metal element j; N is the set of all metal elements; S is a subset of metal elements excluding metal element j; v(S) is the output value of the model when only subset S is included; v(S∪{j}) is the output value of the model when subset S and metal element j are included; |S| is the size of subset S; |N| is the total number of metal elements.
[0068] Step 4: Obtain the metal element concentrations in the to-be-predicted aging wine, predict the aging year based on the aging year prediction model, and determine the key metals according to the contribution degrees of each metal element.
[0069] In this embodiment, taking the aging year of 5 years as an example, the schematic diagram of the average SHAP values of different metal elements is as Figure 4 shown. Among them, Metal 13, Metal 6, Metal 18, Metal 2, Metal 16, and Metal 11 are the 6 metals with the highest SHAP values, and can be considered as the key metals corresponding to the aging year of 5 years. Figure 5 The scatter plot of the SHAP values of metal elements is shown. Generally speaking, for Metal 13, Metal 6, and Metal 18, as the eigenvalue increases, the SHAP value increases, which can be considered to play a positive role in the discrimination of the aging year of 5 years.
[0070] This embodiment also provides an aging year and key metal discrimination device based on metal concentration, as Figure 6 shown, including:
[0071] Data collection module: Obtain the metal element concentrations and the corresponding aging years of aging wine samples, and form a metal element - aging year database;
[0072] Model construction module: Based on a neural network model, use the metal element concentration as the input and the aging year data as the output to create an aging year prediction model, and train the aging year prediction model based on the metal element - aging year database;
[0073] Feature contribution calculation module: Analyze the contribution degrees of each metal element based on the aging year prediction model;
[0074] Feature acquisition module: Obtain the metal element concentrations of the to-be-predicted aging wine;
[0075] Prediction and recognition module: Obtain the predicted aging year result of the aging to be predicted based on the aging year prediction model, and determine the key metals based on the contribution degree of each metal element.
[0076] Furthermore, it is used to regularly obtain the actual year of the aging. When the proportion of the inconsistent years predicted by the aging year prediction model and the actual year is higher than the preset threshold, an alarm is triggered, and the metal element-aging year database and the aging year prediction model are updated. The abnormal alarm module facilitates the monitoring of the prediction accuracy of the aging year prediction model, so as to adjust the aging year prediction model in a timely manner.
Claims
1. A method for determining the aging years and key metals based on metal concentration, characterized in that, Including: Step 1: Create a metal element - aging year database, including the metal element concentration and the corresponding aging year; Step 2: Based on the neural network model, with the metal element concentration as the input and the aging year as the output, create an aging year prediction model, and train the aging year prediction model based on the metal element - aging year database; Step 3: Embed a metal element contribution module for analyzing the contribution degree of each metal element into the trained aging year prediction model; Step 4: Obtain the metal element concentration in the aging to be predicted, predict the aging year based on the aging year prediction model, and determine the key metals according to the contribution degree of each metal element.
2. The method for discriminating the aging year and key metals based on metal concentration according to claim 1, wherein The metal elements include: Be, Na, Mg, Al, K, Ca, Cr, Fe, Cu, As, Ag, Cd, and Ba.
3. The method for discriminating the aging year and key metals based on the metal concentration according to claim 1, wherein The specific steps for training the aging year prediction model based on the metal element - aging year database are: Divide the data in the metal element - aging year database into a training set and a test set; Take the aging year in the metal element - aging year database as the true output label; Use the training set to train the neural network model. During the training process, compare the predicted value of the neural network model with the corresponding true output label, calculate the corresponding loss function, and optimize the model through the backpropagation of the neural network; Use the test set to verify the neural network model. When the corresponding loss function is less than the loss function threshold and the accuracy of the test set is greater than the accuracy threshold, take the corresponding neural network model as the aging year prediction model.
4. The method for discriminating the aging year and key metals based on metal concentration according to claim 3, wherein, When the model is initially trained, determine the initial weights according to the statistical characteristics of the metal element concentration; The calculation formula for the initial weights is: In the formula, is the initial weight of the i-th metal element, and N is the total number of metal elements; φ i is the variance value of the concentration of the i-th metal element; During the model training process, adjust the distribution of each feature weight in real time through the attention mechanism. The calculation formula is: where w i is the weight of the i-th metal element, x i is the concentration characteristic of the i-th metal element, f(x i ) is the importance score of the i-th metal element, and N is the total number of metal elements.
5. The method for discriminating the aging year and key metals based on metal concentration according to claim 1, wherein It also includes regularly updating the metal element - aging year database and adjusting the aging year prediction model according to the updated data.
6. The method for discriminating the aging year and key metals based on metal concentration according to claim 1, wherein The processing steps of the metal element contribution module are: Calculate the SHAP value of each metal element for the prediction result through the SHAP algorithm; Evaluate the contribution degree of each metal element according to the calculated SHAP value; Sort the contribution degrees of all metal elements, and select the top A metal elements with the highest contribution degrees as the key metals.
7. The method for discriminating the aging year and key metals based on metal concentration according to any one of claims 1-6, characterized in that, When creating the metal element - aging year database, it also includes: preprocessing the data.
8. Aging year and key metal discrimination device based on metal concentration, characterized in that Including: Data collection module: Obtain the metal element concentration of the aging sample data and the corresponding aging year, and form a metal element - aging year database; Model construction module: Based on the neural network model, with the metal element concentration as the input and the aging year data as the output, create an aging year prediction model, and train the aging year prediction model based on the metal element - aging year database; Feature contribution calculation module: Analyze the contribution degree of each metal element based on the aging year prediction model; Feature acquisition module: Obtain the metal element concentration of the aging to be predicted; Prediction and identification module: Obtain the aging year prediction result of the aging to be predicted based on the aging year prediction model, and determine the key metals based on the contribution degree of each metal element.
9. The device for discriminating the aging years and key metals based on metal concentration according to claim 8, wherein It also includes: Abnormal alarm module: used to regularly obtain the actual age of the aged wine. When the proportion of the inconsistent years predicted by the aged wine age prediction model and the actual age is higher than the preset threshold, an alarm is triggered, and the metal element-aged wine age database and the aged wine age prediction model are updated.