Method for predicting brown sugar content in black tea by adopting random forest
The fluorescence intensity and concentration model of the black tea-brown sugar mixed solution was established through a random forest algorithm, which solved the problems of high cost and insufficient sensitivity of brown sugar detection methods in existing black tea, and achieved rapid and accurate brown sugar concentration detection, ensuring the detection of black tea quality Reliability and market order.
Patent Information
- Application Number
- CN202411017059.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-29
- Publication Date
- 2024-11-15
AI Technical Summary
The existing brown sugar detection methods in black tea have problems such as high cost, complex operation, limited sensitivity and poor detection effect on low-concentration substances. It is difficult to quickly and accurately detect the brown sugar content in black tea, affecting consumer trust and market order.
The relationship model between the fluorescence intensity and brown sugar concentration of black tea-brown sugar mixed solution was established by using a random forest algorithm. Through fluorescence spectroscopy data pretreatment and random forest quantitative modeling, the concentration of brown sugar in black tea solution was quickly and accurately predicted.
It realizes low-cost, fast and easy-to-operate brown sugar detection, with high stability and accuracy, simplifies the experimental process, improves the effect of low-concentration substance detection, and ensures the reliability of black tea quality detection.
Smart Images

Figure CN118961659A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of food quality detection, and particularly relates to a method for predicting the brown sugar content in black tea by using random forest. Background Art
[0002] Black tea is a fully fermented tea that originated in China and has a long history. Its production process includes withering, rolling, fermentation and drying. The fermentation process gives black tea its unique reddish-brown tea soup and rich aroma. Black tea is rich in polyphenol compounds, caffeine and a variety of antioxidants, and has the effects of refreshing the mind, promoting digestion and improving immunity. In addition, black tea is also believed to have the effects of warming the middle and dispelling cold, appetizing and strengthening the spleen in the field of traditional Chinese medicine. Different varieties of black tea have their own characteristics, forming a diverse black tea culture that meets the needs of different consumers.
[0003] With its unique flavor and cultural significance, black tea has always been favored by consumers around the world. However, with the intensification of market competition and the drive of profit, it is common to adulterate black tea to improve its color and taste, and to pass off inferior products as good ones. This damages the rights and interests of consumers and affects the healthy development of the entire black tea industry. These illegal acts not only reduce consumers' trust in the quality of black tea, but also undermine the market order, posing a potential threat to the reputation of high-quality black tea and consumer health. Therefore, finding a fast and non-destructive detection method is of great significance to ensure the quality of black tea, protect consumer rights and interests, and maintain market order.
[0004] At present, the common detection methods for brown sugar in food include near-infrared spectroscopy, chromatography, mass spectrometry, etc. These methods have their own advantages but also have many limitations. Near-infrared spectroscopy must undergo a complex data processing and analysis process, which is costly and has limited sensitivity for detecting low-concentration substances. The operation process of chromatography is cumbersome and requires professional skills and equipment. Some samples require complex pre-treatment steps and are costly. In addition, the identification of unknown substances requires further combination with other analytical methods. The disadvantages of mass spectrometry, such as high equipment cost, complex operation, and the need for professional skills and special equipment, also limit its widespread application, and have strict requirements on sample preparation and processing. Summary of the invention
[0005] In view of the above technical problems, the present technical scheme provides a method for predicting the brown sugar content in black tea using random forests. By establishing a relationship model between the fluorescence intensity of a black tea-brown sugar mixed solution and the brown sugar concentration, and using the model to predict the brown sugar content in a black tea-brown sugar mixed solution, the concentration of brown sugar in the black tea solution can be quickly and accurately predicted. The method is low in cost, fast and easy to operate, has high stability and accuracy, and has important practical significance in the field of food quality testing; it can effectively solve the above problems.
[0006] The present invention is achieved through the following technical solutions: A method for predicting the brown sugar content in black tea using random forest comprises the steps of: Step 1: prepare standard solutions of black tea and brown sugar, and add an appropriate amount of brown sugar solution to the black tea standard solution to prepare a black tea-brown sugar mixed solution sample; Step 2: measuring the fluorescence spectrum of the black tea-brown sugar mixed solution; Step 3: Preprocessing of spectral data: Preprocess the data obtained from the experiment to facilitate data analysis. The preprocessing process is: first perform minimum-maximum normalization processing to map the data to the [0,1] interval, and then denormalize the data after the training is completed; Step 4: Based on the fluorescence spectrum, random forest is used for quantitative modeling to establish a relationship model between the fluorescence intensity of the mixed solution and the concentration of brown sugar; the specific steps of random forest quantitative modeling are as follows: Step 4.1: Sample selection: Multiple sample subsets are randomly selected with replacement from the pre-treated black tea-brown sugar mixed solution fluorescence spectrum dataset, and the size of each subset is the same as the original dataset; Step 4.2: Decision tree construction: Build a decision tree for each sample subset; Step 4.3: Model training: 60 data sets were sampled, 45 of which were used as training sets. Decision trees were constructed for all sample subsets to form a forest with a minimum number of leaves of 5 and a number of decision trees of 100. Each tree grew independently, and finally a random forest quantitative model for predicting the concentration of brown sugar in a black tea-brown sugar mixed solution was formed. Step 4.4: Model prediction: For the newly input fluorescence spectrum data of black tea-brown sugar mixed solution, each decision tree in the random forest will make independent predictions; Step 4.5: Model evaluation: The remaining 15 groups of the 60 sampled data are used as test sets. This test data set is used to evaluate the random forest model, including multiple indicators such as mean square error, root mean square error and determination coefficient to evaluate the model's prediction performance and generalization ability; Step 5: Use the random forest model to predict the brown sugar content in the black tea solution. Import the fluorescence intensity of the black tea-brown sugar mixed solution corresponding to different brown sugar concentrations into the random forest model for concentration prediction. Step 6: Calculate the percentage of the predicted value to the true value to obtain the recovery rate and average recovery rate.
[0007] Furthermore, the specific operation method of step 4.2 is: Step 4.2.1: Node splitting: At each node, randomly select a feature subset, and among these feature subsets, select an optimal split feature and its splitting point; Step 4.2.2: Recursive splitting: Recursively perform the above splitting steps for each child node until the stopping condition is met; during the process of building the decision tree, the decision tree is not pruned; Further, the specific steps of step 4.4 are as follows: Step 4.4.1: Individual tree prediction: Each tree predicts the new data based on its structure and outputs a predicted brown sugar concentration value; Step 4.4.2: Result integration: Average the prediction results of all trees to obtain the final brown sugar concentration prediction value.
[0008] Furthermore, the specific operation method of preparing the standard solution of black tea and brown sugar in step 1 is as follows: first, weigh an appropriate amount of black tea leaves with an electronic scale, brew the tea with boiling water, and prepare a black tea standard solution with a concentration of 0.02 g / mL; then weigh an appropriate amount of brown sugar solid powder with an electronic scale, fully dissolve it with pure water, and prepare a brown sugar standard solution with a concentration of 0.1 g / mL.
[0009] Furthermore, the step of adding an appropriate amount of brown sugar solution to the black tea standard solution in step 1 is specifically performed by taking multiple appropriate amounts of black tea solutions, adding brown sugar solutions of different volumes thereto, and preparing black tea-brown sugar mixed solutions of different concentrations.
[0010] Furthermore, the measurement of the fluorescence spectrum of the black tea-brown sugar mixed solution in step 2 is performed using a spectrometer, and the scanning range of the emission wavelength is set to 300-700 nm, the slit width is 10.0 nm, the scanning speed is 1000 nm / min, and the excitation wavelength is 477 nm.
[0011] Furthermore, the spectrometer is a fluorescence spectrophotometer LS55. Beneficial Effects
[0012] The method for predicting the brown sugar content in black tea using random forest proposed in the present invention has the following beneficial effects compared with the prior art: The present invention uses random forests based on fluorescence spectroscopy for quantitative modeling. Compared with other detection methods, the fluorescence spectrometer used in this method has a simpler structure and requires fewer components, such as light sources, detectors, etc., compared with high-end analytical equipment such as chromatographs and mass spectrometers, and the equipment cost is lower. Compared with chromatography and mass spectrometry, the fluorescence spectroscopy used can directly measure liquid samples and does not require expensive reagents, complex sample preparation and processing processes. Samples can be directly subjected to fluorescence detection in situ or after simple treatment, and the substances are analyzed by the obtained spectral data without going through complex chemical treatment and analysis processes. This method does not require high sample pre-treatment, simplifies the experimental process, and has good detection effects on low-concentration substances, greatly improving experimental efficiency.
[0013] The present invention uses random forest to establish a relationship model between the fluorescence intensity of a black tea-brown sugar mixed solution and the concentration of brown sugar, which can quickly predict the concentration of brown sugar in a black tea solution, and the test set determination coefficient of the detection model reaches 0.98533, and the average recovery rate is 102.59%. Compared with other analytical methods, this method is more accurate and reliable, and is convenient for the calculation and analysis of subsequent black tea and brown sugar related experiments, and has important practical significance for ensuring the quality of tea. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] Figure 1 It is a specific schematic diagram of the present invention.
[0015] Figure 2 The fluorescence spectra of some black tea-brown sugar mixed solutions of different concentrations in the present invention are shown in FIG.
[0016] Figure 3 This is a graph showing the results of using the random forest model to predict the concentration of brown sugar in the present invention. DETAILED DESCRIPTION
[0017] The following will be combined with the accompanying drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. The described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Under the premise of not departing from the design concept of the present invention, various modifications and improvements made by ordinary persons in the art to the technical solutions of the present invention should all fall within the protection scope of the present invention. Example 1
[0018] like Figure 1 As shown, Figure 1 As shown, a method for predicting the concentration of brown sugar in a black tea solution using random forests, the specific operation steps include: Step 1: Prepare standard solutions of black tea and brown sugar, then add an appropriate amount of brown sugar solution to the black tea standard solution to prepare a black tea-brown sugar mixed solution sample.
[0019] First, weigh an appropriate amount of black tea leaves with an electronic scale, brew the tea with boiling water, and prepare a black tea standard solution with a concentration of 0.02g / mL. Then weigh an appropriate amount of brown sugar solid powder with an electronic scale, fully dissolve it with pure water, and prepare a brown sugar standard solution with a concentration of 0.1g / mL. Then take an appropriate amount of black tea solution, add different volumes of brown sugar solution to it, and prepare black tea-brown sugar mixed solutions with different concentrations.
[0020] Step 2: Measure the fluorescence spectrum of the black tea-brown sugar mixed solution.
[0021] The fluorescence spectrum of the black tea-brown sugar mixed solution was measured using a spectrometer, which was a fluorescence spectrophotometer LS55. The emission wavelength scanning range was set to 300-700 nm, the slit width was 10.0 nm, the scanning speed was 1000 nm / min, and the excitation wavelength was 477 nm.
[0022] Step 3: Preprocess the data obtained from the experiment to facilitate data analysis. The preprocessing process is: first perform minimum-maximum normalization processing to map the data to the [0,1] interval, and then denormalize the data after the training is completed.
[0023] Step 4: Based on the fluorescence spectrum, random forest was used for quantitative modeling to establish a relationship model between the fluorescence intensity of the black tea-brown sugar mixed solution and the brown sugar concentration; The specific steps of random forest quantitative modeling are: Step 4.1: Sample selection: Multiple sample subsets are randomly selected with replacement from the pre-treated black tea-brown sugar mixed solution fluorescence spectrum dataset, and the size of each subset is the same as the original dataset; Step 4.2: Decision tree construction: Build a decision tree for each sample subset; Step 4.2.1: Node splitting: At each node, randomly select a feature subset, and among these feature subsets, select an optimal split feature and its splitting point; Step 4.2.2: Recursive splitting: Recursively perform the above splitting steps for each child node until the stopping condition is met; during the process of building the decision tree, the decision tree is not pruned; Step 4.3: Model training: 60 data sets were sampled, 45 of which were used as training sets. Decision trees were constructed for all sample subsets to form a forest with a minimum number of leaves of 5 and a number of decision trees of 100. Each tree grew independently, and finally a random forest quantitative model for predicting the concentration of brown sugar in a black tea-brown sugar mixed solution was formed. Step 4.4: Model prediction: For the newly input fluorescence spectrum data of black tea-brown sugar mixed solution, each decision tree in the random forest will make independent predictions; Step 4.4.1: Individual tree prediction: Each tree predicts the new data based on its structure and outputs a predicted brown sugar concentration value; Step 4.4.2: Result integration: Average the prediction results of all trees to obtain the final brown sugar concentration prediction value.
[0024] Step 4.5: Model evaluation: The remaining 15 groups of the 60 sampled data are used as test sets. This test data set is used to evaluate the random forest model, including multiple indicators such as mean square error, root mean square error, and determination coefficient to evaluate the model's predictive performance and generalization ability.
[0025] Step 5: Use the random forest model to predict the brown sugar content in the black tea solution. Import the fluorescence intensity of the black tea-brown sugar mixed solution corresponding to different brown sugar concentrations into the random forest model for concentration prediction. Step 6: Calculate the percentage of the predicted value to the true value to obtain the recovery rate and average recovery rate.
[0026] Sample preparation: The black tea used was produced by Anxi Zuimei Tea Factory in Fujian Province, and its properties are black to golden yellow strip solids. Use an electronic scale to weigh an appropriate amount of black tea leaves and mix them with pure water to prepare a black tea standard solution with a concentration of 0.02g / mL. The brown sugar sample used was produced by Chaozhou Yuelong Food Co., Ltd., and its properties are reddish brown solid powder. Take brown sugar and pure water, shake them well, and prepare a brown sugar standard solution with a concentration of 0.1g / mL. Add different volumes of brown sugar standard solution to the black tea standard solution to prepare black tea-brown sugar mixed solutions of different concentrations.
[0027] Spectral data collection: Use a fluorescence spectrophotometer LS55 (Perkin Elmer, USA), set the emission wavelength scanning range to 300-700 nm, slit width to 10.0 nm, scanning speed to 1000 nm / min, and excitation wavelength to 477 nm. The fluorescence spectra of the black tea-brown sugar mixed solutions of various concentrations were measured by the LS55 fluorescence spectrophotometer, such as Figure 2 As shown, from curves 1 to 8, the concentrations of brown sugar are 0.00099, 0.004762, 0.009091, 0.013043, 0.016667, 0.02, 0.023077, 0.025926 g / mL, respectively. There is an obvious fluorescence peak at 546 nm, so the 546 nm fluorescence peak is the characteristic peak of the black tea-brown sugar mixed solution.
[0028] Establishment of the detection model: A total of 60 sets of data were taken in the concentration range of 0.00099g / mL to 0.0375g / mL, and the pre-processed data were used as modeling data. First, multiple sample subsets were randomly selected with replacement from the pre-processed fluorescence spectrum data set of black tea-brown sugar mixed solution, and the size of each subset was the same as the original data set. Secondly, a decision tree was constructed for each sample subset, and a feature subset was randomly selected at each node. Among these feature subsets, an optimal split feature and its split point were selected. Then the above splitting steps were recursively performed on each child node until the stop condition was met. In the process of building the decision tree, the decision tree was not pruned. Again, model training was carried out. 60 sets of data were sampled, and 45 of them were used as training sets. Decision trees were constructed for all sample subsets to form a forest with a minimum number of leaves of 5 and a number of decision trees of 100. Each tree grew independently, and finally formed a random forest quantitative model for predicting the concentration of brown sugar in black tea-brown sugar mixed solution. Next, model prediction was performed. For the newly input fluorescence spectrum data of the black tea-brown sugar mixed solution, each decision tree in the random forest will make an independent prediction. Each tree predicts the new data according to its structure and outputs a predicted brown sugar concentration value. Then the prediction results of all trees are averaged to obtain the final brown sugar concentration prediction value. Finally, the model is evaluated. The remaining 15 groups of the 60 sampled data are used as the test set, and this test data set is used to evaluate the random forest model, including multiple indicators such as mean square error, root mean square error and determination coefficient to evaluate the model's prediction performance and generalization ability.
[0029] Model reliability verification: The concentration of brown sugar added to black tea was predicted by the random forest algorithm, and the percentage ratio of the predicted value to the true value was calculated to obtain the recovery rate and the average recovery rate. The results are shown in Table 1. The results show that the prediction results of a small number of samples have relatively large errors, but the recovery rate of most samples is close to 100%, and the average recovery rate reaches 102.59%. In general, the random forest model is feasible for predicting the concentration of brown sugar added to black tea.
[0030] Table 1 Recovery rate of prediction results of brown sugar under random forest model
[0031] In this example, the fluorescence intensity of the black tea-brown sugar mixed solution corresponding to different brown sugar concentrations was introduced into the random forest model for concentration prediction. After simulation prediction, the determination coefficient of the test set was 0.98533, which was close to 1. Figure 3 As shown, this indicates that the prediction accuracy of this detection model is high, the method is reliable, and it has important practical significance for ensuring the quality of tea.
[0032] The above embodiments are only for illustrating the technical concept and features of the present invention, and their purpose is to enable people familiar with the technology to understand the content of the present invention and implement it accordingly, and they cannot be used to limit the protection scope of the present invention. Any equivalent transformation or modification made according to the spirit of the present invention should be included in the present invention.
Claims
1. A method for predicting the brown sugar content in black tea using random forest, Features: Includes steps: Step 1: prepare standard solutions of black tea and brown sugar, and add an appropriate amount of brown sugar solution to the black tea standard solution to prepare a black tea-brown sugar mixed solution sample; Step 2: measuring the fluorescence spectrum of the black tea-brown sugar mixed solution; Step 3: Preprocessing of spectral data; The data obtained from the experiment is preprocessed to facilitate data analysis. The preprocessing process is as follows: first, a minimum-maximum normalization process is performed to map the data to the interval [0,1], and then, after the training is completed, the data is denormalized; Step 4: Based on the fluorescence spectrum, random forest is used for quantitative modeling to establish a relationship model between the fluorescence intensity of the mixed solution and the concentration of brown sugar; the specific steps of random forest quantitative modeling are as follows: Step 4.1: Sample selection: Multiple sample subsets are randomly selected with replacement from the pre-treated black tea-brown sugar mixed solution fluorescence spectrum dataset, and the size of each subset is the same as the original dataset; Step 4.2: Decision tree construction: Build a decision tree for each sample subset; Step 4.3: Model training: 60 data sets were sampled, 45 of which were used as training sets. Decision trees were constructed for all sample subsets to form a forest with a minimum number of leaves of 5 and a number of decision trees of 100. Each tree grew independently, and finally a random forest quantitative model for predicting the concentration of brown sugar in a black tea-brown sugar mixed solution was formed. Step 4.4: Model prediction: For the newly input fluorescence spectrum data of black tea-brown sugar mixed solution, each decision tree in the random forest will make independent predictions; Step 4.5: Model evaluation: The remaining 15 groups of the 60 sampled data are used as test sets. This test data set is used to evaluate the random forest model, including multiple indicators such as mean square error, root mean square error and determination coefficient to evaluate the model's prediction performance and generalization ability; Step 5: Use the random forest model to predict the brown sugar content in the black tea solution. Import the fluorescence intensity of the black tea-brown sugar mixed solution corresponding to different brown sugar concentrations into the random forest model for concentration prediction. Step 6: Calculate the percentage of the predicted value to the true value to obtain the recovery rate and average recovery rate.
2. A method for predicting the brown sugar content in black tea using random forest according to claim 1, Features: The specific operation method of step 4.2 is: Step 4.2.1: Node splitting: At each node, randomly select a feature subset, and among these feature subsets, select an optimal split feature and its splitting point; Step 4.2.2: Recursive splitting: Recursively perform the above splitting steps for each child node until the stopping condition is met; during the process of building the decision tree, the decision tree is not pruned.
3. The method for predicting the brown sugar content in black tea using random forest according to claim 1, Features: The specific steps of step 4.4 are as follows: Step 4.4.1: Individual tree prediction: Each tree predicts the new data based on its structure and outputs a predicted brown sugar concentration value; Step 4.4.2: Result integration: Average the prediction results of all trees to obtain the final brown sugar concentration prediction value.
4. The method for predicting the brown sugar content in black tea using random forest according to claim 1, Features: The specific operation method of preparing the standard solution of black tea and brown sugar in step 1 is as follows: first, weigh an appropriate amount of black tea leaves with an electronic scale, brew the tea with boiling water, and prepare a black tea standard solution with a concentration of 0.02 g / mL; then weigh an appropriate amount of brown sugar solid powder with an electronic scale, fully dissolve it with pure water, and prepare a brown sugar standard solution with a concentration of 0.1 g / mL.
5. The method for predicting the brown sugar content in black tea using random forest according to claim 1, Features: The specific operation method of adding an appropriate amount of brown sugar solution to the black tea standard solution in step 1 is as follows: taking multiple appropriate amounts of black tea solutions, adding brown sugar solutions of different volumes thereto, and preparing black tea-brown sugar mixed solutions of different concentrations.
6. The method for predicting the brown sugar content in black tea using random forest according to claim 1, Features: The measurement of the fluorescence spectrum of the black tea-brown sugar mixed solution in step 2 is performed using a spectrometer, with the emission wavelength scanning range set to 300-700 nm, the slit width set to 10.0 nm, the scanning speed set to 1000 nm / min, and the excitation wavelength set to 477 nm.
7. A method for predicting the brown sugar content in black tea using random forest according to claim 6, Features: The spectrometer is a fluorescence spectrophotometer LS55.
