Tobacco leaf chemical component prediction method based on NW and iterative bandwidth calculation
Through the method based on NW and iterative bandwidth calculation, the problem of small data volume and unknown variable relationship in the chemical composition prediction of tobacco leaves is solved, the prediction accuracy is improved, and the control of tobacco leaves production quality is achieved.
Patent Information
- Application Number
- CN202411174774.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-26
- Publication Date
- 2024-12-10
AI Technical Summary
In the prediction of chemical composition of tobacco leaves, the data volume is small and the variable relationship is unknown, resulting in inaccurate prediction of parameter methods, and machine learning and deep learning methods require a large amount of data to support, resulting in the problems of underfitting and low prediction accuracy.
Using the method based on NW and iterative bandwidth calculation, the optimal prediction between meteorological variables and chemical composition is determined by obtaining historical meteorological data and tobacco leaf chemical composition data, and using Nadaraya-Watson estimation and iterative bandwidth training. Relationship, overcome the problem of data randomness and no obvious relationship between variables.
The accuracy of chemical composition prediction of tobacco leaves is improved, and the quality of tobacco leaves is controlled is achieved, and the problem of low prediction accuracy is solved due to small data volume and unknown variable relationship.
Smart Images

Figure CN119108041A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of tobacco leaf quality prediction, and in particular to a method for predicting tobacco leaf chemical components based on NW and iterative bandwidth calculation. Background Art
[0002] Tobacco is one of the most widely planted cash crops in my country. As the world's largest tobacco producer and consumer, the tobacco industry has an important economic position in my country. The stability of cigarette quality is the basis for the stable sales of tobacco, so how to control the quality of cigarettes is an important issue. Tobacco leaves are necessary raw materials for making cigarettes. The chemical content of tobacco leaves has an important relationship with the quality and taste of finished cigarettes. Predicting the content of chemical components and sensing the chemical composition data of tobacco leaves in advance are of great significance for stabilizing the quality and taste of finished cigarettes. Therefore, how to control the stability of the chemical composition of tobacco leaves is one of the means to control the stability of the quality of cigarettes. The chemical composition of tobacco leaves mainly includes total sugar, reducing sugar, total alkaloids, chlorine, potassium, total nitrogen, etc. Among them, total alkaloids, as the first factor affecting the quality of tobacco leaves and the acceptability of cigarettes, can help alleviate other irritating tastes in tobacco leaves, increase people's acceptability of cigarettes, and also provide physiological satisfaction for smokers, which has an important impact on cigarettes. Total sugar is also an important component to balance the various flavors of tobacco when it is burned. The sugar in tobacco becomes acidic after burning, so it can balance the choking and spicy feeling of the alkaline components brought by the burning of protein in tobacco. The reducing sugar in tobacco leaves can increase the aroma of smoke, increase comfort, and reduce the breakage rate of tobacco leaves, and improve the toughness and elasticity of tobacco leaves. Total nitrogen has the greatest impact on the yield of flue-cured tobacco, especially in the vigorous growth period, it has an important impact on the growth rate. The influence of potassium is distributed in various parts of the tobacco body, and the potassium content is closely related to the activity of enzymes and other physiological functions inside the tobacco body. Chlorine has an important influence on the combustibility of tobacco leaves and the irritation and smell after burning. The higher the chlorine content, the lower its combustibility, and the higher the irritation and smell. In summary, the content of chemical components such as total sugar, reducing sugar, total alkaloids, chlorine, potassium, and total nitrogen in tobacco leaves has an important impact on the quality of tobacco.
[0003] The ecological environment affects the quality of tobacco leaves, among which climate factors are one of the important ecological and environmental factors that affect the chemical composition and yield of tobacco leaves. Climate factors such as ambient temperature, precipitation, relative humidity, and daily sunshine duration will affect the growth and development of tobacco and the accumulation and transformation of its chemical components, which in turn determines the quality of tobacco leaves. Therefore, a more accurate analysis and prediction of the chemical composition of the main tobacco varieties in tobacco-growing areas based on climate factors is of great significance for guiding tobacco planting. If the content of each component in tobacco leaves can be effectively predicted based on the collected meteorological data, and then planting adjustments are made based on the predicted results, it will help to improve tobacco leaf yield and quality stability, and also help stabilize the income of tobacco farmers.
[0004] At present, the prediction methods of tobacco chemical composition include parameter-based, machine learning, deep learning and non-parametric methods. The parameter method is that the distribution type of data or the mathematical relationship between variables can be expressed in the form of finite parameters, so as to achieve parameter solution, prediction and other problems. Common linear prediction and nonlinear prediction are typical representatives of parameter methods, but the parameter method needs to clarify the parameter regression form between variables. If the parameter form is set unreasonably, it will have a significant impact on the prediction. In the prediction of tobacco chemical composition, the relationship between its variables is shown in the figure in the specification. Figure 1 As shown in the figure, it is found that there is no obvious functional trend relationship between meteorological variables and the content of tobacco chemical components. Therefore, it is difficult to obtain a good prediction effect through parameter methods. In the face of the above problems, when traditional regression methods are no longer used, machine learning and deep learning methods are generally considered. Machine learning or deep learning methods can extract features from the data to solve a series of problems such as classification and regression from the feature aspect. However, if machine learning or deep learning methods are to achieve better results, more data support is needed to more fully extract features between data and obtain ideal prediction effects. In the problem of tobacco chemical component prediction, the final amount of data is at a small level, so it is difficult to fully extract features, which may eventually lead to underfitting, low prediction accuracy and other problems, thus affecting the prediction. Therefore, how to achieve accurate prediction in the context of unknown data variable relationship and small data volume in tobacco chemical component prediction is a problem worth studying. Summary of the invention
[0005] In order to overcome the problems in the prior art, the present invention proposes a tobacco leaf chemical composition prediction method based on NW and iterative bandwidth calculation, and applies NW estimation to the tobacco leaf chemical composition prediction task to solve the problem of low prediction accuracy caused by random data and small data amount.
[0006] To achieve the above object, the present invention provides a method for predicting tobacco chemical components based on NW and iterative bandwidth calculation, comprising the following steps:
[0007] S1: Obtain historical meteorological data and tobacco leaf chemical composition data and process them, and use them as meteorological data X in the fitting data set. i And chemical composition data Y j , the meteorological data X i , Chemical composition data Y j The data are merged and divided into training set and test set;
[0008] S2: Input the training set and the test set into the NW estimation to obtain the prediction results, calculate the mean absolute percentage error between the prediction results and the test set, and continuously update the NW estimation internal bandwidth h according to the mean absolute percentage error to iteratively train and obtain the optimal bandwidth h;
[0009] S3: Based on the bandwidth h, the training set and the test set are input into the NW estimation cycle M times again, and the mean of the average absolute percentage error between the prediction results of M times and the test set is calculated to determine the optimal corresponding prediction relationship between the meteorological variable and the chemical composition variable, and obtain the meteorological variable X i For chemical composition variable Y j predicted NW estimates;
[0010] S4: Obtain new meteorological data, substitute the new meteorological data into the trained NW estimation, and the NW estimation completes the prediction of the chemical composition of tobacco leaves.
[0011] Furthermore, in step S1, the method for obtaining and processing meteorological data and chemical composition data of tobacco leaves is specifically as follows:
[0012] S11: Obtain various meteorological data of different counties and years, and obtain various chemical composition data of tobacco leaves of different counties, years and varieties;
[0013] S12: Construct grouping identifiers based on years and counties, calculate the mean of each meteorological data corresponding to each county in each year, and use it as the meteorological variable X in the chemical composition prediction i ,i=1,2,…,I;
[0014] Using varieties as distinction, we construct grouping identifiers by year and county within each variety, calculate the mean of various tobacco chemical components corresponding to each county in each year, and use it as the target chemical component variable Y j ,j=1,2,…,J;
[0015] S13: Select the tobacco variety to be predicted and obtain the processed meteorological data X i And the chemical composition data of the tobacco leaves of the variety Y j , using variety, year and district as identifier, merge the two sets of data to complete the fitting data preparation;
[0016] S14: Divide the data into training set and test set according to the proportion, denoted as: X train , Y train , X test , Y test .
[0017] Further, the method of step S2 is specifically as follows:
[0018] S21: Randomly select an initial bandwidth h0, define the update step size s, the number of cycles marked c = 1, and the loss upper bound B;
[0019] S22: Obtain the training set and test set from step S1, and Normalized processing to obtain Calculation based on test set meteorological data Chemical composition data of the test set The prediction results And according to and Calculate the mean absolute percentage error MAPE c ;
[0020] S23: Based on the MAPE of each cycle and the previous cycle c Compare and adjust bandwidth h c And determine whether to update the upper limit B of the loss, the number of cycles c = c + 1;
[0021] S24: Repeat steps S22-S23 until the upper limit of the loss B is no longer updated for L consecutive cycles, and record the corresponding bandwidth h when B and B reach the minimum value c ;
[0022] S25: Continue to repeat steps S21-S24 for N rounds, and record the upper limit B of the loss for each cycle N , select the minimum loss upper bound B N The corresponding bandwidth h c As the final bandwidth h.
[0023] Further, in step S22, the Normalized processing to obtain The formula is:
[0024]
[0025] in, for The maximum value, for The minimum value in .
[0026] Further, in step S22, the calculation is based on right The prediction results , the formula is expressed as:
[0027]
[0028] Among them, h crepresents the bandwidth of the current cycle, k(·) represents the kernel function, r is the rth sample in the training set, and l is the lth sample in the test set.
[0029] Furthermore, the k(·) kernel function is a Gaussian kernel function, and the formula is expressed as:
[0030]
[0031] Further, in the step S22, the and Calculate the mean absolute percentage error (MAPE) for each cycle c The specific method is:
[0032] Get the test set right The prediction results ,calculate and Mean absolute percentage error MAPE i,j , and get the MAPE matrix:
[0033]
[0034] Get the current loop bandwidth h c The minimum mean absolute percentage error of the meteorological variables for the chemical composition variables is MAPE. j :MAPE j =min(MAPE 1,j ,…,MAPE I,j );
[0035] Calculate the mean MAPE of the minimum mean absolute percentage error of meteorological variables for chemical composition variables under the current bandwidth c :
[0036]
[0037] Further, in step S23, the MAPE of each cycle and the previous cycle is c Compare and adjust bandwidth h c The method for determining whether to update the upper limit B of the loss is as follows:
[0038] S231: When c≤1, then h c =h c-1 +s;
[0039] When c>1, if MAPE c <MAPE c-1 , then h c =h c-1 +s; if MAPEc >MAPE c-1 , then h c =h c-1 -s;
[0040] S232: If MAPE c <B, then B = MAPE c , record this time h c .
[0041] Further, the step S3 is specifically as follows:
[0042] S31: Obtain the optimal bandwidth h in step S2 and substitute it into NW estimation;
[0043] S32: Obtain the training set and the test set from step S1, and perform the meteorological data of the training set Normalized processing to obtain Calculate the test set meteorological data Chemical composition data of the test set The prediction results The formula is:
[0044] S33: According to and Calculate the mean absolute percentage error MAPE c ;
[0045]
[0046] Among them, c is the number of cycles, I is the type of meteorological variable, and J is the type of chemical composition variable;
[0047] S34: Repeat steps S32-S33 for M rounds to calculate the minimum mean absolute percentage error (MAPE) of the meteorological variables for the chemical composition variables in the M rounds of cycles c The mean The formula is:
[0048]
[0049] Among them, c is the number of cycles, M is the total number of cycles, I is the type of meteorological variable, and J is the type of chemical composition variable;
[0050] S35: Select meteorological variable X i For chemical composition variable Y j Predicted The minimum value of the meteorological variable X i and chemical composition variable Y j Determined as the optimal corresponding prediction relationship, the formula is expressed as:
[0051] Y j =m i,j (x);
[0052] in, According to the bandwidth h and the meteorological variable X i For chemical composition variable Y j The corresponding relationship determines the final NW estimate;
[0053]
[0054] in, M i For X i The maximum value, m i For X i , h is the bandwidth, k(·) is the kernel function, and x is the newly acquired meteorological data.
[0055] The method for predicting the chemical composition of tobacco leaves based on NW and iterative bandwidth calculation proposed by the present invention can be driven by test data for iterative training, and finally obtain the bandwidth size that fits the actual data situation, and determine the predicted relationship between variables while determining the bandwidth. At the same time, the non-parametric estimation method NW estimation is adopted to overcome the deficiency that the parameter method needs to make assumptions about the data distribution or the relationship between variables, and at the same time, the problem of low prediction accuracy caused by factors such as random data between meteorological data and tobacco chemical composition, no obvious functional relationship between variables, and small amount of data is solved, and the accuracy of meteorological data in predicting tobacco chemical composition data is improved, so as to achieve the control of tobacco production quality. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Figure 1 A matrix scatter plot of meteorological variables and tobacco leaf chemical composition variables provided in the background technology of the present invention;
[0057] Figure 2 This is a flow chart of the method for predicting tobacco chemical components based on NW and iterative bandwidth of the present invention;
[0058] Figure 3 The data collection and processing flow chart provided by the present invention;
[0059] Figure 4 The bandwidth h iterative training flow chart provided by the present invention; DETAILED DESCRIPTION
[0060] The present invention provides a method for predicting tobacco chemical components based on NW and iterative bandwidth calculation, such as Figure 2 As shown, the following steps are included:
[0061] Step S1: Obtain historical meteorological data and tobacco leaf chemical composition data and process them, and use them as the meteorological data X in the fitting data set.i And chemical composition data Y j , the meteorological data X i , Chemical composition data Y j The data are merged and divided into training set and test set.
[0062] Specifically, Figure 3 As shown, the method for obtaining meteorological data and chemical composition data of tobacco leaves and processing them is specifically as follows:
[0063] Step S11: Obtain seven kinds of meteorological data, including average temperature, maximum temperature, minimum temperature, day-night temperature difference, average relative humidity, rainfall, and sunshine hours for different counties, years, etc.; obtain chemical composition data of six kinds of tobacco leaves, including total sugar, reducing sugar, total alkaloids, chlorine, potassium, and total nitrogen in different counties, years, and varieties.
[0064] Step S12: Construct grouping labels based on years and counties, calculate the mean of seven meteorological data corresponding to each county in each year, including average temperature, maximum temperature, minimum temperature, day-night temperature difference, average relative humidity, rainfall, and sunshine hours, and use them as meteorological variables X in chemical composition prediction. i ,i=1,2,…,7;
[0065] Using varieties as distinction, within each variety, grouping identifiers were constructed by year and county. The mean values of the six chemical components of tobacco leaves, including total sugar, reducing sugar, total alkaloids, chlorine, potassium, and total nitrogen, were calculated for each county in each year and used as the target chemical component variable Y. j ,j=1,2,…,6;
[0066] Step S13: Select the tobacco variety to be predicted and obtain the processed meteorological data X i And the chemical composition data of the tobacco leaves of the variety Y j , using the year and district as the mark, merge the two sets of data to complete the preparation of fitting data;
[0067] Specifically, select the tobacco variety to be predicted, obtain the meteorological data X processed in step S12 i , and the chemical composition data of the tobacco leaves of this variety Y j Then, the two sets of data are merged with reference to the year and district, thus completing the data preparation work necessary for fitting. There are n data in total, and the data can be expressed as:
[0068] X=(X1,X2,X3,X4,X5,X6,X7) n×7
[0069] Y=(Y1,Y2,Y3,Y4,Y5,Y6) n×6
[0070] Among them, X is the meteorological dataset, Y is the chemical composition dataset, and n is the sample size.
[0071] It can also be expressed as X i =(X i,1 ,X i,2 ,…,X i,k, …,X i,n ) T , Y j =(Y j,1 ,Y j,2 ,…,Y j,k ,…,Y j,n ) T ;
[0072] Where i = 1, 2, ..., 7, j = 1, 2, ..., 6, and T is the matrix transpose.
[0073] Step S14: Divide the data into a training set and a test set in a ratio of 4:1, denoted as: X train , Y train , X test , Y test . The X train , Y train , X test , Y test The representation structure is the same as the X and Y structure in step S13, with X train For example, it can be expressed as:
[0074]
[0075] Y train , X test , Y test Also like X train The structural form is the same.
[0076] Step S2: Figure 4 As shown, the training set and the test set are input into the NW estimation (Nadaraya-Watson estimation), the prediction results are calculated, and the mean absolute percentage error with the test set is calculated. The bandwidth h in the NW estimation is continuously updated and iteratively trained according to the mean absolute percentage error to obtain the optimal bandwidth h.
[0077] Step S21: randomly select an initial bandwidth h0, define the update step size s, the number of cycles mark c=1, the loss upper bound B, L=1, N=1.
[0078] Step S22: Get the training set and test set X from step S1 train , Y train , X test , Y test , for the meteorological data Xi train , X i test Normalized processing to obtain X i train,U , X i test,U , the formula is:
[0079]
[0080] in, for The maximum value, for The minimum value in .
[0081] Will Substituting into the NW estimate, the calculation is based on right The prediction results The formula is:
[0082]
[0083] Among them, h c is the bandwidth of the current cycle, k(·) is the kernel function, r is the rth sample in the training set, and l is the lth sample in the test set.
[0084] In this embodiment, the k(·) kernel function is a Gaussian kernel function, which is expressed as follows:
[0085]
[0086] according to and Calculate the mean absolute percentage error (MAPE) for each cycle c (MeanAbsolutePercentageError).
[0087] Get the test set right The prediction results calculate and Mean absolute percentage error MAPE i,j , and get the MAPE matrix:
[0088]
[0089] Get the current loop bandwidth h c The minimum mean absolute percentage error of the meteorological variables for the chemical composition variables is MAPE. j :MAPE j =min(MAPE1,j ,…,MAPE 7,j ).
[0090] Calculate the mean MAPE of the minimum mean absolute percentage error of meteorological variables for chemical composition variables under the current bandwidth c :
[0091]
[0092] Step S23: Based on the MAPE of each cycle and the previous cycle c Compare and adjust bandwidth h c And determine whether to update the upper limit B of the loss and continue the next cycle; the specific method is:
[0093] Step S231: When c≤1, then h c =h c-1 +s;
[0094] When c>1, if MAPE c <MAPE c-1 , then h c =h c-1 +s; if MAPE c >MAPE c-1 , then h c =h c-1 -s;
[0095] Step S232: If MAPE c <B, then B = MAPE c , L = 1, and record h at this time c ;
[0096] If MAPE c >B, then L = L + 1, record h at this time c ;
[0097] Step S233: c=c+1.
[0098] Step S24: Repeat steps S22-S23 until the upper limit of the loss B is no longer updated for 10 consecutive cycles, and record the corresponding bandwidth h when B and B reach the minimum value c .
[0099] Step S25: When N<100, continue to repeat steps S21-S24 for 100 rounds and record the upper limit B of the loss in each round. N , where N is the number of cycles of the steps, select the minimum B N The corresponding bandwidth h c As the final bandwidth h.
[0100] Step S3: Based on the bandwidth h, the training set and the test set are input into the NW estimation cycle again for 200 times, and the mean of the average absolute percentage error between the 200 prediction results and the test set is calculated to determine the optimal corresponding prediction relationship between the meteorological variable and the chemical composition variable, and obtain the meteorological variable X i For chemical composition variable Y j Predicted NW estimates.
[0101] S31: Obtain the optimal bandwidth h in step S2 and substitute it into NW estimation;
[0102] S32: Obtain the training set and the test set from step S1, and perform the meteorological data of the training set Normalized processing to obtain This process is consistent with the above step S22 and will not be repeated here.
[0103] Calculate the test set meteorological data Chemical composition data of the test set The prediction results The formula is:
[0104]
[0105] Wherein, h is the final bandwidth obtained in step S2, k(·) is the kernel function, r is the rth sample in the training set, and l is the lth sample in the test set.
[0106] S33: According to and Calculate the mean absolute percentage error MAPE c ;
[0107]
[0108] Among them, c is the current cycle number, I is the type of meteorological variable, and J is the type of chemical composition variable.
[0109] S34: Repeat steps S32-S33 for 200 rounds and calculate the minimum mean absolute percentage error (MAPE) of the meteorological variables for the chemical composition variables in the 200-round cycle. c The mean The formula is:
[0110]
[0111] in, c is the current cycle number, I is the type of meteorological variable, and J is the type of chemical composition variable.
[0112] S35: Select meteorological variable X i For chemical composition variable Y j Predicted The minimum value of the meteorological variable X i and chemical composition variable Y j Determined as the optimal corresponding prediction relationship, the formula is expressed as:
[0113] Y j =m i,j (x);
[0114] in, According to the bandwidth h and the meteorological variable X i For chemical composition variable Y j The corresponding prediction relationship determines the final NW estimate;
[0115]
[0116] in, M i For X i The maximum value, m i For X i , l is the lth sample in the existing data, h is the final bandwidth obtained in step S2, k(·) is the kernel function, and x is the newly acquired meteorological data.
[0117] S4: Obtain new meteorological data, substitute the new meteorological data into the trained NW estimation, and the NW estimation completes the prediction of the chemical composition of tobacco leaves.
[0118] Based on the final bandwidth h obtained in step S2 and the meteorological variables obtained in step S3, the chemical component content Y of tobacco leaves j The corresponding prediction relationship is obtained:
[0119]
[0120] in,
[0121] Get new weather data X new :
[0122]
[0123] Among them, m is the sample size of new meteorological data.
[0124] Get new weather data X new After that, we can expand X as follows new The corresponding tobacco chemical component content Y new The prediction formula is expressed as:
[0125]
[0126] Where i = 1, 2, ..., 7, j = 1, 2, ..., 6, p is the pth sample in the new meteorological data, h is the bandwidth, k(·) is the kernel function,
[0127] Finally, we get the meteorological data X new The corresponding tobacco chemical component content Y new Prediction:
[0128]
[0129] Among them, Y new Indicates Y new prediction results.
[0130] At this point, the prediction of the chemical composition of tobacco leaves can be achieved.
Claims
1. A method for predicting tobacco leaf chemical components based on NW and iterative bandwidth calculation, characterized in that: The following steps are involved: S1: Obtain historical meteorological data and tobacco leaf chemical composition data and process them, and use them as meteorological data X in the fitting data set. i And chemical composition data Y j , the meteorological data X i , Chemical composition data Y j The data are merged and divided into training set and test set; S2: Input the data of the training set and the test set into the NW estimation to obtain the prediction results Calculate the prediction results With the test set Mean absolute percentage error: the estimated internal bandwidth h of NW is continuously updated and iteratively trained based on the mean absolute percentage error to obtain the optimal bandwidth h; S3: Based on the bandwidth h, the training set and the test set are input into the NW estimation cycle M times again, and the mean of the average absolute percentage error between the prediction results of M times and the test set is calculated to determine the optimal corresponding prediction relationship between the meteorological variable and the chemical composition variable, and obtain the meteorological variable X i For chemical composition variable Y j predicted NW estimates; S4: Obtain new meteorological data, substitute the new meteorological data into the trained NW estimation, and the NW estimation completes the prediction of the chemical composition of tobacco leaves.
2. A method for predicting tobacco leaf chemical components based on NW and iterative bandwidth calculation as claimed in claim 1, characterized in that: In step S1, the method for obtaining and processing meteorological data and chemical composition data of tobacco leaves is specifically as follows: S11: Obtain various meteorological data of different counties and years, and obtain various chemical composition data of tobacco leaves of different counties, years and varieties; S12: Construct grouping identifiers based on years and counties, calculate the mean of each meteorological data corresponding to each county in each year, and use it as the meteorological variable X in the chemical composition prediction i ,i=1,2,…,I; Using varieties as distinction, we construct grouping identifiers by year and county within each variety, calculate the mean of various tobacco chemical components corresponding to each county in each year, and use it as the target chemical component variable Y j ,j=1,2,…,J; S13: Select the tobacco variety to be predicted and obtain the processed meteorological data X i And the chemical composition data of the tobacco leaves of the variety Y j , using variety, year and district as identifier, merge the two sets of data to complete the fitting data preparation; S14: Divide the data into training set and test set according to the proportion, denoted as: X train , Y train , X test , Y test .
3. The method for predicting tobacco leaf chemical components based on NW and iterative bandwidth calculation according to claim 1, characterized in that: The method of step S2 is specifically as follows: S21: Randomly select an initial bandwidth h0, define the update step size s, the number of cycles marked c = 1, and the upper limit of the loss B; S22: Obtain the training set and test set from step S1, and Normalized processing to obtain Calculation based on test set meteorological data Chemical composition data of the test set The prediction results And according to and Calculate the mean absolute percentage error MAPE c ; S23: Based on the MAPE of each cycle and the previous cycle c Compare and adjust bandwidth h c And determine whether to update the upper limit B of the loss, the number of cycles c = c + 1; S24: Repeat steps S22-S23 until the upper limit of the loss B is no longer updated for L consecutive cycles, and record the corresponding bandwidth h when B and B reach the minimum value c ; S25: Continue to repeat steps S21-S24 for N rounds, and record the upper limit B of the loss for each cycle N , select the minimum loss upper bound B N The corresponding bandwidth h c As the final bandwidth h.
4. A method for predicting tobacco leaf chemical components based on NW and iterative bandwidth calculation as claimed in claim 3, characterized in that: In step S22, the Normalized processing to obtain The formula is: in, for The maximum value, for The minimum value in .
5. A method for predicting tobacco leaf chemical components based on NW and iterative bandwidth calculation as claimed in claim 4, characterized in that: In step S22, the calculation is based on right The prediction results The formula is: Among them, h c represents the bandwidth of the current cycle, k(·) represents the kernel function, r is the rth sample in the training set, and l is the lth sample in the test set.
6. A method for predicting tobacco leaf chemical components based on NW and iterative bandwidth calculation as claimed in claim 5, characterized in that: The k(·) kernel function is a Gaussian kernel function, and the formula is expressed as:
7. The method for predicting tobacco chemical components based on NW and iterative bandwidth calculation as claimed in claim 3, characterized in that: In the step S22, the and Calculate the mean absolute percentage error (MAPE) for each cycle c The specific method is: Get the test set right The prediction results calculate and Mean absolute percentage error MAPE i,j , and get the MAPE matrix: Get the current loop bandwidth h c The minimum mean absolute percentage error of the meteorological variables for the chemical composition variables is MAPE. j :MAPE j =min(MAPE 1,j ,…,MAPE I,j ); Calculate the mean MAPE of the minimum mean absolute percentage error of meteorological variables for chemical composition variables under the current bandwidth c :
8. The method for predicting tobacco leaf chemical components based on NW and iterative bandwidth calculation as claimed in claim 3, characterized in that: In step S23, the MAPE of each cycle and the previous cycle is c Compare and adjust bandwidth h c The method for determining whether to update the upper limit B of the loss is as follows: S231: When c≤1, then h c =h c-1 +s; When c>1, if MAPE c <MAPE c-1 , then h c =h c-1 +s; if MAPE c >MAPE c-1 , then h c =h c-1 -s; S232: If MAPE c <B, then B = MAPE c , record this time h c .
9. The method for predicting tobacco leaf chemical components based on NW and iterative bandwidth calculation according to claim 1, characterized in that: The step S3 is specifically as follows: S31: Obtain the optimal bandwidth h in step S2 and substitute it into NW estimation; S32: Obtain the training set and the test set from step S1, and perform the meteorological data of the training set Normalized processing to obtain Calculate the test set meteorological data Chemical composition data of the test set The prediction results The formula is: S33: According to and Calculate the mean absolute percentage error MAPE c ; Among them, c is the number of cycles, I is the type of meteorological variable, and J is the type of chemical composition variable; S34: Repeat steps S32-S33 for M rounds to calculate the minimum mean absolute percentage error (MAPE) of the meteorological variables for the chemical composition variables in the M rounds of cycles c The mean The formula is: Among them, c is the number of cycles, M is the total number of cycles, I is the type of meteorological variable, and J is the type of chemical composition variable; S35: Select meteorological variable X i For chemical composition variable Y j Predicted minimum value of the meteorological variable X i and chemical composition variable Y j Determined as the optimal corresponding prediction relationship, the formula is expressed as: Y j =m i,j (x); in, j=1,2,…,J; According to the bandwidth h and the meteorological variable X i For chemical composition variable Y j The corresponding relationship determines the final NW estimate; in, M i For X i The maximum value, m i For X i , h is the bandwidth, k(·) is the kernel function, and x is the newly acquired meteorological data.
