CN117455066A - Corn planting accurate fertilizer distribution method based on multi-strategy optimization random forest, electronic equipment and storage medium - Google Patents
Corn planting accurate fertilizer distribution method based on multi-strategy optimization random forest, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN117455066A CN117455066A CN202311504289.6A CN202311504289A CN117455066A CN 117455066 A CN117455066 A CN 117455066A CN 202311504289 A CN202311504289 A CN 202311504289A CN 117455066 A CN117455066 A CN 117455066A
- Authority
- CN
- China
- Prior art keywords
- data
- random forest
- corn
- strategy
- decision
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000007637 random forest analysis Methods 0.000 title claims abstract description 57
- 240000008042 Zea mays Species 0.000 title claims abstract description 54
- 235000005824 Zea mays ssp. parviglumis Nutrition 0.000 title claims abstract description 54
- 235000002017 Zea mays subsp mays Nutrition 0.000 title claims abstract description 54
- 235000005822 corn Nutrition 0.000 title claims abstract description 54
- 239000003337 fertilizer Substances 0.000 title claims abstract description 50
- 238000000034 method Methods 0.000 title claims abstract description 45
- 238000009826 distribution Methods 0.000 title claims abstract description 24
- 238000005457 optimization Methods 0.000 title claims abstract description 22
- 238000003860 storage Methods 0.000 title claims abstract description 14
- 238000012549 training Methods 0.000 claims abstract description 49
- 238000003066 decision tree Methods 0.000 claims abstract description 34
- 238000004364 calculation method Methods 0.000 claims abstract description 23
- 239000002689 soil Substances 0.000 claims abstract description 22
- 230000004720 fertilization Effects 0.000 claims abstract description 21
- 238000010801 machine learning Methods 0.000 claims abstract description 21
- 235000015097 nutrients Nutrition 0.000 claims abstract description 16
- 238000002790 cross-validation Methods 0.000 claims abstract description 14
- 230000006870 function Effects 0.000 claims abstract description 11
- 235000021049 nutrient content Nutrition 0.000 claims abstract description 7
- 238000002360 preparation method Methods 0.000 claims description 24
- 238000004590 computer program Methods 0.000 claims description 18
- 230000008569 process Effects 0.000 claims description 10
- IJGRMHOSHXDMSA-UHFFFAOYSA-N Atomic nitrogen Chemical compound N#N IJGRMHOSHXDMSA-UHFFFAOYSA-N 0.000 claims description 8
- 238000012795 verification Methods 0.000 claims description 7
- 241000544061 Cuculus canorus Species 0.000 claims description 6
- 238000004458 analytical method Methods 0.000 claims description 6
- 238000005516 engineering process Methods 0.000 claims description 6
- 238000010845 search algorithm Methods 0.000 claims description 6
- OAICVXFJPJFONN-UHFFFAOYSA-N Phosphorus Chemical compound [P] OAICVXFJPJFONN-UHFFFAOYSA-N 0.000 claims description 4
- ZLMJMSJWJFRBEC-UHFFFAOYSA-N Potassium Chemical compound [K] ZLMJMSJWJFRBEC-UHFFFAOYSA-N 0.000 claims description 4
- 238000011156 evaluation Methods 0.000 claims description 4
- 229910052757 nitrogen Inorganic materials 0.000 claims description 4
- 239000005416 organic matter Substances 0.000 claims description 4
- 229910052698 phosphorus Inorganic materials 0.000 claims description 4
- 239000011574 phosphorus Substances 0.000 claims description 4
- 239000011591 potassium Substances 0.000 claims description 4
- 229910052700 potassium Inorganic materials 0.000 claims description 4
- 230000007246 mechanism Effects 0.000 claims description 3
- 238000010200 validation analysis Methods 0.000 claims description 3
- 230000005540 biological transmission Effects 0.000 claims 1
- 230000009471 action Effects 0.000 description 3
- 238000012545 processing Methods 0.000 description 3
- 238000005070 sampling Methods 0.000 description 3
- 230000000694 effects Effects 0.000 description 2
- 238000011160 research Methods 0.000 description 2
- 239000002881 soil fertilizer Substances 0.000 description 2
- 238000010521 absorption reaction Methods 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 238000013473 artificial intelligence Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004422 calculation algorithm Methods 0.000 description 1
- 238000012937 correction Methods 0.000 description 1
- 230000001419 dependent effect Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 235000016709 nutrition Nutrition 0.000 description 1
- 230000035764 nutrition Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000012827 research and development Methods 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q10/00—Administration; Management
- G06Q10/04—Forecasting or optimisation specially adapted for administrative or management purposes, e.g. linear programming or "cutting stock problem"
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/21—Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
- G06F18/214—Generating training patterns; Bootstrap methods, e.g. bagging or boosting
- G06F18/2148—Generating training patterns; Bootstrap methods, e.g. bagging or boosting characterised by the process organisation or structure, e.g. boosting cascade
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/24—Classification techniques
- G06F18/243—Classification techniques relating to the number of classes
- G06F18/24323—Tree-organised classifiers
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/27—Regression, e.g. linear or logistic regression
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N20/00—Machine learning
- G06N20/20—Ensemble learning
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N5/00—Computing arrangements using knowledge-based models
- G06N5/01—Dynamic search techniques; Heuristics; Dynamic trees; Branch-and-bound
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q10/00—Administration; Management
- G06Q10/06—Resources, workflows, human or project management; Enterprise or organisation planning; Enterprise or organisation modelling
- G06Q10/063—Operations research, analysis or management
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q50/00—Systems or methods specially adapted for specific business sectors, e.g. utilities or tourism
- G06Q50/02—Agriculture; Fishing; Mining
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02A—TECHNOLOGIES FOR ADAPTATION TO CLIMATE CHANGE
- Y02A40/00—Adaptation technologies in agriculture, forestry, livestock or agroalimentary production
- Y02A40/10—Adaptation technologies in agriculture, forestry, livestock or agroalimentary production in agriculture
Abstract
A corn planting accurate fertilizer distribution method based on multi-strategy optimization random forest, electronic equipment and storage medium belong to the technical field of intelligent agriculture. In order to improve the precision of agricultural fertilization, soil nutrient data, fertilization amount data and corn yield data are collected, and a multivariate decision data training set is constructed; establishing a decision tree, constructing a random forest machine learning model to predict the corn yield according to soil nutrient data and fertilizing amount data, analyzing based on the predicted corn yield, and establishing nonlinear relations of different soil nutrient contents, different fertilizing strategies and the predicted corn yield; performing parameter tuning on the random forest machine learning model by adopting a K-fold cross validation and Grid Search method to obtain an optimized random forest machine learning model; and (3) taking the optimal fertilizing amount as an objective function, inputting the optimal fertilizing amount into an optimized random forest machine learning model for optimization calculation, and obtaining a corn planting accurate fertilizing scheme based on the multi-strategy optimized random forest.
Description
Technical Field
The invention belongs to the technical field of intelligent agriculture, and particularly relates to a corn planting accurate fertilizer preparation method based on multi-strategy optimization random forest, electronic equipment and a storage medium.
Background
Along with the continuous development of intelligent agriculture, a precise fertilization technology is generated. The conventional corn fertilizer preparation is mainly carried out by a fertilizer preparation station or an agricultural scientific research institute through a fertilizer effect method and a nutrient balance method, wherein the fertilizer preparation amount is mainly determined by a method comprising a plurality of unitary quadratic equations, but a complex nonlinear relation often exists between the soil fertilizer preparation amount and a plurality of factors of soil; in the latter, the soil nutrients are mainly in a dynamic equilibrium state, so it is difficult to adjust the correction coefficient and reflect the interaction between the nutrients. Meanwhile, if the traditional mode is adopted to realize accurate fertilizer preparation, farmland and yield sample data are required to be accumulated for years, and repeated verification and analysis are carried out through a laboratory, so that labor cost and test cost are high, and the time consumed for monitoring is long.
The machine learning model has strong fault tolerance and calculation capability, is suitable for the fields of computers, automation, artificial intelligence and the like, and can solve the complex nonlinear problem which is difficult to process by the traditional method. In the field of precise fertilizer preparation, a machine learning model with high precision, short period and relatively easy solution is provided to realize crop yield prediction and fertilizer application strategy selection, which is a task to be solved urgently.
Disclosure of Invention
The invention aims to solve the problem of improving the precision of agricultural fertilization and provides a corn planting accurate fertilizer distribution method, electronic equipment and a storage medium based on multi-strategy optimization random forest.
In order to achieve the above purpose, the present invention is realized by the following technical scheme:
a corn planting accurate fertilizer distribution method based on multi-strategy optimization random forest comprises the following steps:
s1, collecting soil nutrient data, fertilizing amount data and corn yield data, obtaining a multivariate decision data training sample, and constructing a multivariate decision data training set;
s2, building a decision tree from the multivariate decision data training sample obtained in the step S1, building a random forest machine learning model to predict the corn yield according to soil nutrient data and fertilizing amount data, analyzing based on the predicted corn yield, and building nonlinear relations of different soil nutrient contents, different fertilizing strategies and the predicted corn yield;
s3, performing parameter tuning on the random forest machine learning model obtained in the step S2 by adopting a K-fold cross validation and Grid Search method to obtain an optimized random forest machine learning model;
s4, using a Cuckoo Search algorithm to take the optimal fertilizing amount as an objective function, inputting the optimal fertilizing amount into the random forest machine learning model optimized in the step S4 for optimization calculation, and obtaining a corn planting accurate fertilizing scheme based on the multi-strategy optimal random forest.
Further, the soil nutrient data in the step S1 comprises organic matter data, hydrolyzed nitrogen data, available phosphorus data, quick-acting potassium data and PH data, the fertilization amount data comprises N fertilization amount data, P fertilization amount data and K fertilization amount data, and the corn yield data is actual acre yield data.
Further, the specific implementation method of the step S2 includes the following steps:
s2.1, taking the multivariate decision data training sample obtained in the step S1 as a root node, and establishing a decision tree;
s2.2, defining an average absolute error to represent uncertainty of accurate fertilizer preparation, wherein a calculation expression is as follows:
wherein MAE (D) is the average absolute error of the multivariate decision data training set D, N is the number of samples, y i Training the actual observed regression values of the samples for the ith multivariate decision data,is a predicted regression value;
s2.3, calculating importance of features in the multivariate decision data training samples by using information gain, calculating information gain of the features in each multivariate decision data training sample, selecting the feature with the largest information gain as a split node, setting the split node of a decision tree, and calculating the information gain as follows:
wherein IG (D, A) represents the information gain on feature A, V is the total number of features A, D v Sample subset with value v for feature A in D, |D v The I is the absolute value of a sample subset with the value v of the feature A in the D;
s2.4, traversing the input samples along the branch nodes of the decision tree according to the characteristic values to finally reach leaf nodes, wherein the leaf nodes comprise a group of training samples, the regression values of the training samples are obtained by calculating the average value of the leaf nodes according to the corresponding training samples and the characteristics, and the regression value calculation formula of the decision tree is as follows:
wherein T is i (X) represents regression prediction of input sample X by ith decision tree, D i Representing a set of training samples at leaf nodes, |D i I represents the size of the collection, X j Is a training sample, y j Representing training sample X j A corresponding regression value;
s2.5, each decision tree carries out independent regression prediction on an input sample X, and the calculated average value of all decision tree regression values is taken as a final predicted value, wherein the calculation formula of the final predicted value is as follows:
wherein N represents the number of decision trees in the random forest, T i (X) represents the regression prediction value of the ith decision tree on the input sample X;
and carrying out target yield analysis according to the final predicted value, extracting an contour line according to the analysis result, and establishing nonlinear relations of different soil nutrient contents, different fertilization strategies and predicted yield according to a contour line set threshold.
Further, the specific implementation method of the step S3 includes the following steps:
s3.1, performing model evaluation by adopting a K-fold cross validation strategy, dividing a data set into K subsets, sequentially using each subset as a validation set, using the rest subsets for training, and validating K-fold cross in regression problems by calculating an average absolute error under K-fold cross validation, wherein the calculation expression is as follows:
wherein the MAE CV Represents the mean absolute error under K-fold cross validation, K is the number of folds cross validated, MAE (D k ) For the kth fold testAverage absolute error over the evidence set;
s3.2, defining a Grid in a super parameter space by using Grid Search technology, selecting the number n_optimizers and the maximum feature number max_features of single-family decision trees, performing Search optimization by using composition parameter pairs, designating the range of the number n_optimizers to be 100-500, and the range of the maximum feature number max_features to be 1-8, then training and verifying each combination, and selecting the parameter combination with the minimum MAE by calculating K-fold cross verification MAE under different parameter combinations to obtain the optimized random forest machine learning model.
Further, the specific implementation method of the step S4 includes the following steps:
s4.1, setting the optimal fertilizing amount as an objective function f (X), and randomly generating initial positions X of n search sets i I=1, 2, …, N, set population size N, problem dimension D, maximum discovery probability Pa, optimal position X best The optimal solution is f best And the maximum iteration number is Max iter Initializing;
s4.2, utilizing Laiwei flying to replace nest positionAnd updating the state, wherein the calculation expression is as follows:
wherein,representing the position of the ith search set in the mth generation, α represents the step control amount for controlling the step size, levy (ζ) represents the Levy random search path using the Levy flight mechanism, and the calculation expression of Levy distribution is:
μ=m -ξ
wherein mu represents a distribution position, m represents population algebra, and xi represents a random step length which is more than or equal to 1 and less than or equal to 3;
s4.3 by positioning the next generation nestAfter the position update, the random number r is compared with the maximum discovery probability Pa, 0<r<1, if r is more than Pa, randomly changing the position of the search set, otherwise, obtaining a current optimal position set +.>Finally updating the search set position which keeps the best currently +.>And (3) optimal solution->
S4.4, judging whether the maximum iteration times or the minimum error requirements are met, if not, returning to the step S4.2 for iterative optimization, if so, ending the searching process and outputting the global optimal position and the global optimal solution obtained in the step S4.3.
The electronic equipment comprises a memory and a processor, wherein the memory stores a computer program, and the processor realizes the steps of the corn planting accurate fertilizer preparation method based on the multi-strategy optimized random forest when executing the computer program.
The computer readable storage medium is stored with a computer program, and the computer program realizes the corn planting accurate fertilizer preparation method based on the multi-strategy optimized random forest when being executed by a processor.
The invention has the beneficial effects that:
according to the corn planting accurate fertilizer distribution method based on the multi-strategy optimized random forest, corn yield is simulated through a random forest algorithm optimized through K-fold cross verification and Grid Search technology, and then the constructed corn yield prediction model is coupled with a Cuckoo Search algorithm to construct an accurate fertilizer application decision model. Random forests reduce the risk of overfitting through random feature selection and sample sampling. However, the performance of random forests is highly dependent on the setting of parameters, so parameter tuning is required to obtain the best predicted performance. The accuracy and stability of yield prediction can be improved by carrying out model evaluation through K-fold cross validation and parameter tuning by utilizing Grid Search technology. The Cuckoo Search algorithm can adaptively adjust parameters to adapt to the characteristics of different problems, so that the convergence speed and the Search effect are improved. Optimizing the random forest based on multiple strategies can further improve the model performance, and particularly in the aspect of searching the optimal parameter configuration, the optimal parameter configuration is found through searching the parameter space so as to achieve the optimal performance of the random forest.
According to the corn planting accurate fertilizer distribution method based on the multi-strategy optimized random forest, through scientific decision of the corn base fertilizer accurate application method, optimal reference can be provided for optimal supply of cultivated land nutrients, accurate fertilization and on-demand fertilization are realized, and top-layer targets of cost saving and efficiency improvement, soil protection and grain safety are realized by assistance;
compared with the traditional fertilizer preparation method based on the traditional crop model and based on the soil fertilizer supply capacity, crop nutrition absorption capacity and the like, the precise corn planting fertilizer preparation method based on the multi-strategy optimized random forest can effectively reduce the pressure and cost of tracking continuous observation sampling, improve the fertilizer preparation efficiency and improve the area coverage of the fertilizer preparation model.
According to the corn planting accurate fertilizer distribution method based on the multi-strategy optimized random forest, which is provided by the invention, the agricultural measure of the fertilizer distribution process is separated from the traditional agricultural field, the current situation that the fertilizer distribution process must be operated by specialized farmers of a fertilizer distribution station or experts of an agricultural scientific research institute can be effectively improved, the specialized complexity of the fertilizer distribution process is reduced, and convenience is brought to the research and development of a follow-up intelligent fertilizer distribution system and variable fertilizer application equipment.
Drawings
FIG. 1 is a flow chart of a corn planting accurate fertilizer distribution method based on a multi-strategy optimized random forest, which is disclosed by the invention;
fig. 2 is an iteration result diagram of a method for obtaining the optimal fertilizer distribution of corn based on a multi-strategy optimization random forest model.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be further described in detail below with reference to the accompanying drawings and detailed description. It should be understood that the embodiments described herein are for purposes of illustration only and are not intended to limit the invention, i.e., the embodiments described are merely some, but not all, of the embodiments of the invention. The components of the embodiments of the present invention generally described and illustrated in the figures herein can be arranged and designed in a wide variety of different configurations, and the present invention can have other embodiments as well.
Thus, the following detailed description of the embodiments of the invention, as presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, are intended to fall within the scope of the present invention.
For further understanding of the invention, the following detailed description is presented in conjunction with the accompanying drawings 1 to provide a further understanding of the invention in its aspects, features and efficacy:
the first embodiment is as follows:
a corn planting accurate fertilizer distribution method based on multi-strategy optimization random forest comprises the following steps:
s1, collecting soil nutrient data, fertilizing amount data and corn yield data, obtaining a multivariate decision data training sample, and constructing a multivariate decision data training set;
further, the soil nutrient data in the step S1 comprises organic matter data, hydrolyzed nitrogen data, available phosphorus data, quick-acting potassium data and PH data, the fertilization amount data comprises N fertilization amount data, P fertilization amount data and K fertilization amount data, and the corn yield data is actual acre yield data;
the data set used in this embodiment is longitude, latitude, area, variety of 9000 sampling points of corn planting area in certain city of the black longjiang province, the soil nutrient data includes organic matter data, hydrolyzed nitrogen data, available phosphorus data, quick-acting potassium data and PH data, the fertilization amount data includes N fertilization amount data, P fertilization amount data and K fertilization amount data, and the actual acre yield data is shown in table 1:
table 1 predictive dataset information table
S2, building a decision tree from the multivariate decision data training sample obtained in the step S1, building a random forest machine learning model to predict the corn yield according to soil nutrient data and fertilizing amount data, analyzing based on the predicted corn yield, and building nonlinear relations of different soil nutrient contents, different fertilizing strategies and the predicted corn yield;
further, the specific implementation method of the step S2 includes the following steps:
s2.1, taking the multivariate decision data training sample obtained in the step S1 as a root node, and establishing a decision tree;
s2.2, defining an average absolute error to represent uncertainty of accurate fertilizer preparation, wherein a calculation expression is as follows:
wherein MAE (D) is the average absolute error of the multivariate decision data training set D, N is the number of samples, y i Training the actual observed regression values of the samples for the ith multivariate decision data,is a predicted regression value;
s2.3, calculating importance of features in the multivariate decision data training samples by using information gain, calculating information gain of the features in each multivariate decision data training sample, selecting the feature with the largest information gain as a split node, setting the split node of a decision tree, and calculating the information gain as follows:
wherein IG (D, A) represents the information gain on feature A, V is the total number of features A, D v Sample subset with value v for feature A in D, |D v The I is the absolute value of a sample subset with the value v of the feature A in the D;
s2.4, traversing the input samples along the branch nodes of the decision tree according to the characteristic values to finally reach leaf nodes, wherein the leaf nodes comprise a group of training samples, the regression values of the training samples are obtained by calculating the average value of the leaf nodes according to the corresponding training samples and the characteristics, and the regression value calculation formula of the decision tree is as follows:
wherein T is i (X) represents regression prediction of input sample X by ith decision tree, D i Representing a set of training samples at leaf nodes, |D i I represents the size of the collection, X j Is a training sample, y j Representing training sample X j A corresponding regression value;
s2.5, each decision tree carries out independent regression prediction on an input sample X, and the calculated average value of all decision tree regression values is taken as a final predicted value, wherein the calculation formula of the final predicted value is as follows:
wherein N represents the number of decision trees in the random forest, T i (X) represents the regression prediction value of the ith decision tree on the input sample X;
analyzing the target yield according to the final predicted value, extracting an contour line according to the analysis result, and establishing nonlinear relations of different soil nutrient contents, different fertilization strategies and predicted yield according to a contour line set threshold value;
s3, performing parameter tuning on the random forest machine learning model obtained in the step S2 by adopting a K-fold cross validation and Grid Search method to obtain an optimized random forest machine learning model;
further, the specific implementation method of the step S3 includes the following steps:
s3.1, performing model evaluation by adopting a K-fold cross validation strategy, dividing a data set into K subsets, sequentially using each subset as a validation set, using the rest subsets for training, and validating K-fold cross in regression problems by calculating an average absolute error under K-fold cross validation, wherein the calculation expression is as follows:
wherein the MAE CV Represents the mean absolute error under K-fold cross validation, K is the number of folds cross validated, MAE (D k ) Mean absolute error over the kth fold verification set;
s3.2, defining a Grid in a super parameter space by using Grid Search technology, selecting the number n_identifiers and the maximum feature number max_features of single-family decision trees, performing Search optimization by using composition parameter pairs, designating the range of the number n_identifiers to be 100-500 and the range of the maximum feature number max_features to be 1-8, then training and verifying each combination, and selecting a parameter combination with the minimum MAE by calculating K-fold cross verification MAE under different parameter combinations to obtain an optimized random forest machine learning model;
s4, using a Cuckoo Search algorithm to take the optimal fertilizing amount as an objective function, inputting the optimal fertilizing amount into the random forest machine learning model optimized in the step S4 for optimization calculation, and obtaining a corn planting accurate fertilizing scheme based on the multi-strategy optimal random forest.
Further, the specific implementation method of the step S4 includes the following steps:
s4.1, setting the optimal fertilizing amount as an objective function f (X), and randomly generating initial positions X of n search sets i I=1, 2, …, N, set population size N, problem dimension D, maximum discovery probability Pa, optimal position X best The optimal solution is f best And the maximum iteration number is Max iter Initializing;
s4.2, utilizing Laiwei flying to replace nest positionAnd updating the state, wherein the calculation expression is as follows:
wherein,representing the position of the ith search set in the mth generation, α represents the step control amount for controlling the step size, levy (ζ) represents the Levy random search path using the Levy flight mechanism, and the calculation expression of Levy distribution is:
μ=m -ξ
wherein mu represents a distribution position, m represents population algebra, and xi represents a random step length which is more than or equal to 1 and less than or equal to 3;
s4.3 by positioning the next generation nestAfter the position update, the random number r is compared with the maximum discovery probability Pa, 0<r<1, if r is more than Pa, randomly changing the position of the search set, otherwise, obtaining a current optimal position set +.>Finally updating the search set position which keeps the best currently +.>And (3) optimal solution->
S4.4, judging whether the maximum iteration times or the minimum error requirements are met, if not, returning to the step S4.2 for iterative optimization, if so, ending the searching process and outputting the global optimal position and the global optimal solution obtained in the step S4.3.
The information table of the constructed model dataset is shown in table 2 by using the Cuckoo Search algorithm and taking the optimal fertilizing amount as an objective function:
table 2 model dataset information table
The second embodiment is as follows:
the electronic equipment comprises a memory and a processor, wherein the memory stores a computer program, and the processor realizes the steps of the corn planting accurate fertilizer preparation method based on the multi-strategy optimized random forest when executing the computer program.
The computer device of the present invention may be a device including a processor and a memory, such as a single chip microcomputer including a central processing unit. And the processor is used for realizing the steps of the corn planting accurate fertilizer preparation method based on the multi-strategy optimized random forest when executing the computer program stored in the memory.
The processor may be a central processing unit (Central Processing Unit, CPU), other general purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), off-the-shelf programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program (such as a sound playing function, an image playing function, etc.) required for at least one function, and the like; the storage data area may store data (such as audio data, phonebook, etc.) created according to the use of the handset, etc. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as a hard disk, memory, plug-in hard disk, smart Media Card (SMC), secure Digital (SD) Card, flash Card (Flash Card), at least one disk storage device, flash memory device, or other volatile solid-state storage device.
And a third specific embodiment:
the computer readable storage medium is stored with a computer program, and the computer program realizes the corn planting accurate fertilizer preparation method based on the multi-strategy optimized random forest when being executed by a processor.
The computer readable storage medium of the present invention may be any form of storage medium that is read by a processor of a computer device, including but not limited to a nonvolatile memory, a volatile memory, a ferroelectric memory, etc., on which a computer program is stored, and when the processor of the computer device reads and executes the computer program stored in the memory, the steps of the above-mentioned corn planting precision fertilizing method based on multi-strategy optimization random forests can be implemented.
The computer program comprises computer program code which may be in source code form, object code form, executable file or in some intermediate form, etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), an electrical carrier signal, a telecommunications signal, a software distribution medium, and so forth. It should be noted that the computer readable medium contains content that can be appropriately scaled according to the requirements of jurisdictions in which such content is subject to legislation and patent practice, such as in certain jurisdictions in which such content is subject to legislation and patent practice, the computer readable medium does not include electrical carrier signals and telecommunication signals.
It is noted that relational terms such as "first" and "second", and the like, are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
Although the present application has been described hereinabove with reference to specific embodiments, various modifications thereof may be made and equivalents may be substituted for elements thereof without departing from the scope of the application. In particular, the features of the embodiments disclosed in this application may be combined with each other in any way as long as there is no structural conflict, and the exhaustive description of these combinations is not given in this specification merely for the sake of omitting the sake of brevity and saving resources. Therefore, it is intended that the present application not be limited to the particular embodiments disclosed, but that the present application include all embodiments falling within the scope of the appended claims.
Claims (7)
1. A corn planting accurate fertilizer distribution method based on multi-strategy optimization random forest is characterized by comprising the following steps:
s1, collecting soil nutrient data, fertilizing amount data and corn yield data, obtaining a multivariate decision data training sample, and constructing a multivariate decision data training set;
s2, building a decision tree from the multivariate decision data training sample obtained in the step S1, building a random forest machine learning model to predict the corn yield according to soil nutrient data and fertilizing amount data, analyzing based on the predicted corn yield, and building nonlinear relations of different soil nutrient contents, different fertilizing strategies and the predicted corn yield;
s3, performing parameter tuning on the random forest machine learning model obtained in the step S2 by adopting a K-fold cross validation and Grid Search method to obtain an optimized random forest machine learning model;
s4, using a Cuckoo Search algorithm to take the optimal fertilizing amount as an objective function, inputting the optimal fertilizing amount into the random forest machine learning model optimized in the step S4 for optimization calculation, and obtaining a corn planting accurate fertilizing scheme based on the multi-strategy optimal random forest.
2. The precise corn planting fertilizer preparation method based on the multi-strategy optimization random forest of claim 1, wherein the soil nutrient data in the step S1 comprises organic matter data, hydrolyzed nitrogen data, available phosphorus data, quick-acting potassium data and PH data, the fertilizer application amount data comprises N fertilizer amount data, P fertilizer amount data and K fertilizer amount data, and the corn yield data is actual acre yield data.
3. The corn planting accurate fertilizer preparation method based on the multi-strategy optimized random forest of claim 2, wherein the specific implementation method of the step S2 comprises the following steps:
s2.1, taking the multivariate decision data training sample obtained in the step S1 as a root node, and establishing a decision tree;
s2.2, defining an average absolute error to represent uncertainty of accurate fertilizer preparation, wherein a calculation expression is as follows:
wherein MAE (D) is a plurality ofAverage absolute error of variable decision data training set D, N is sample number, y i Training the actual observed regression values of the samples for the ith multivariate decision data,is a predicted regression value;
s2.3, calculating importance of features in the multivariate decision data training samples by using information gain, calculating information gain of the features in each multivariate decision data training sample, selecting the feature with the largest information gain as a split node, setting the split node of a decision tree, and calculating the information gain as follows:
wherein IG (D, A) represents the information gain on feature A, V is the total number of features A, D v Sample subset with value v for feature A in D, |D v The I is the absolute value of a sample subset with the value v of the feature A in the D;
s2.4, traversing the input samples along the branch nodes of the decision tree according to the characteristic values to finally reach leaf nodes, wherein the leaf nodes comprise a group of training samples, the regression values of the training samples are obtained by calculating the average value of the leaf nodes according to the corresponding training samples and the characteristics, and the regression value calculation formula of the decision tree is as follows:
wherein T is i (X) represents regression prediction of input sample X by ith decision tree, D i Representing a set of training samples at leaf nodes, |D i I represents the size of the collection, X j Is a training sample, y j Representing training sample X j A corresponding regression value;
s2.5, each decision tree carries out independent regression prediction on an input sample X, and the calculated average value of all decision tree regression values is taken as a final predicted value, wherein the calculation formula of the final predicted value is as follows:
wherein N represents the number of decision trees in the random forest, T i (X) represents the regression prediction value of the ith decision tree on the input sample X;
and carrying out target yield analysis according to the final predicted value, extracting an contour line according to the analysis result, and establishing nonlinear relations of different soil nutrient contents, different fertilization strategies and predicted yield according to a contour line set threshold.
4. The corn planting accurate fertilizer preparation method based on the multi-strategy optimization random forest of claim 3, wherein the specific implementation method of the step S3 comprises the following steps:
s3.1, performing model evaluation by adopting a K-fold cross validation strategy, dividing a data set into K subsets, sequentially using each subset as a validation set, using the rest subsets for training, and validating K-fold cross in regression problems by calculating an average absolute error under K-fold cross validation, wherein the calculation expression is as follows:
wherein the MAE CV Represents the mean absolute error under K-fold cross validation, K is the number of folds cross validated, MAE (D k ) Mean absolute error over the kth fold verification set;
s3.2, defining a Grid in a super parameter space by using Grid Search technology, selecting the number n_optimizers and the maximum feature number max_features of single-family decision trees, performing Search optimization by using composition parameter pairs, designating the range of the number n_optimizers to be 100-500, and the range of the maximum feature number max_features to be 1-8, then training and verifying each combination, and selecting the parameter combination with the minimum MAE by calculating K-fold cross verification MAE under different parameter combinations to obtain the optimized random forest machine learning model.
5. The corn planting accurate fertilizer preparation method based on the multi-strategy optimized random forest of claim 4, wherein the specific implementation method of the step S4 comprises the following steps:
s4.1, setting the optimal fertilizing amount as an objective function f (X), and randomly generating initial positions X of n search sets i I=1, 2, …, N, set population size N, problem dimension D, maximum discovery probability Pa, optimal position X best The optimal solution is f best And the maximum iteration number is Max iter Initializing;
s4.2, utilizing Laiwei flying to replace nest positionAnd updating the state, wherein the calculation expression is as follows:
wherein,representing the position of the ith search set in the mth generation, α represents the step control amount for controlling the step size, levy (ζ) represents the Levy random search path using the Levy flight mechanism, and the calculation expression of Levy distribution is:
μ=m -ξ
wherein mu represents a distribution position, m represents population algebra, and xi represents a random step length which is more than or equal to 1 and less than or equal to 3;
s4.3 by positioning the next generation nestAfter the position is updated, the random number r and the maximum transmission are usedThe probability of occurrence Pa is compared with 0<r<1, if r is more than Pa, randomly changing the position of the search set, otherwise, obtaining the current optimal position set without changingFinally updating the search set position which keeps the best currently +.>And (3) optimal solution->
S4.4, judging whether the maximum iteration times or the minimum error requirements are met, if not, returning to the step S4.2 for iterative optimization, if so, ending the searching process and outputting the global optimal position and the global optimal solution obtained in the step S4.3.
6. The electronic equipment is characterized by comprising a memory and a processor, wherein the memory stores a computer program, and the processor realizes the steps of the corn planting accurate fertilizer preparation method based on the multi-strategy optimized random forest according to any one of claims 1-5 when executing the computer program.
7. A computer readable storage medium having stored thereon a computer program, characterized in that the computer program when executed by a processor implements a multi-strategy optimized random forest based corn planting precision fertilizer distribution method according to any one of claims 1-5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311504289.6A CN117455066A (en) | 2023-11-13 | 2023-11-13 | Corn planting accurate fertilizer distribution method based on multi-strategy optimization random forest, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311504289.6A CN117455066A (en) | 2023-11-13 | 2023-11-13 | Corn planting accurate fertilizer distribution method based on multi-strategy optimization random forest, electronic equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117455066A true CN117455066A (en) | 2024-01-26 |
Family
ID=89594625
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311504289.6A Pending CN117455066A (en) | 2023-11-13 | 2023-11-13 | Corn planting accurate fertilizer distribution method based on multi-strategy optimization random forest, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117455066A (en) |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107316501A (en) * | 2017-06-28 | 2017-11-03 | 北京航空航天大学 | A kind of SVMs Travel Time Estimation Method based on grid search |
CN109374860A (en) * | 2018-11-13 | 2019-02-22 | 西北大学 | A kind of soil nutrient prediction and integrated evaluating method based on machine learning algorithm |
AU2020101453A4 (en) * | 2020-07-23 | 2020-08-27 | China Communications Construction Co., Ltd. | An Intelligent Optimization Method of Durable Concrete Mix Proportion Based on Data mining |
CN111738534A (en) * | 2020-08-21 | 2020-10-02 | 支付宝(杭州)信息技术有限公司 | Training of multi-task prediction model, and prediction method and device of event type |
WO2022111125A1 (en) * | 2020-11-27 | 2022-06-02 | 深圳先进技术研究院 | Random-forest-based automatic optimization method for graphic data processing framework |
CN116189796A (en) * | 2022-12-13 | 2023-05-30 | 大连大学 | Machine learning-based satellite-borne short wave infrared CO 2 Column concentration estimation method |
CN116258060A (en) * | 2022-12-30 | 2023-06-13 | 武汉大学 | Soil testing formula fertilization method based on machine learning |
-
2023
- 2023-11-13 CN CN202311504289.6A patent/CN117455066A/en active Pending
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107316501A (en) * | 2017-06-28 | 2017-11-03 | 北京航空航天大学 | A kind of SVMs Travel Time Estimation Method based on grid search |
CN109374860A (en) * | 2018-11-13 | 2019-02-22 | 西北大学 | A kind of soil nutrient prediction and integrated evaluating method based on machine learning algorithm |
AU2020101453A4 (en) * | 2020-07-23 | 2020-08-27 | China Communications Construction Co., Ltd. | An Intelligent Optimization Method of Durable Concrete Mix Proportion Based on Data mining |
CN111738534A (en) * | 2020-08-21 | 2020-10-02 | 支付宝(杭州)信息技术有限公司 | Training of multi-task prediction model, and prediction method and device of event type |
WO2022111125A1 (en) * | 2020-11-27 | 2022-06-02 | 深圳先进技术研究院 | Random-forest-based automatic optimization method for graphic data processing framework |
CN116189796A (en) * | 2022-12-13 | 2023-05-30 | 大连大学 | Machine learning-based satellite-borne short wave infrared CO 2 Column concentration estimation method |
CN116258060A (en) * | 2022-12-30 | 2023-06-13 | 武汉大学 | Soil testing formula fertilization method based on machine learning |
Non-Patent Citations (1)
Title |
---|
严家宝等: "《中国国际河流水资源评价与机器学习应用》", 31 July 2021, 湖北科技技术出版社, pages: 61 - 62 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Aworka et al. | Agricultural decision system based on advanced machine learning models for yield prediction: Case of East African countries | |
Srivastava et al. | Winter wheat yield prediction using convolutional neural networks from environmental and phenological data | |
CN109583301B (en) | Method and device for predicting optimal external planting conditions in crop growth process | |
Gosai et al. | Crop recommendation system using machine learning | |
CN112906298B (en) | Blueberry yield prediction method based on machine learning | |
Mohan et al. | Deep learning based weighted SOM to forecast weather and crop prediction for agriculture application | |
Sangeeta | Design and implementation of crop yield prediction model in agriculture | |
CN109558939B (en) | Crop growth model selection method and device based on neural network | |
Jopp et al. | Modelling complex ecological dynamics | |
Morales et al. | Using machine learning for crop yield prediction in the past or the future | |
CN116307191B (en) | Water resource configuration method, device and equipment based on artificial intelligence algorithm | |
Ranjani et al. | Crop yield prediction using machine learning algorithm | |
CN117322214A (en) | Crop fertilizer accurate application method and system based on neural network | |
Ravi et al. | Crop yield Prediction using XG Boost algorithm | |
Mahale et al. | Crop prediction system based on soil and weather characteristics | |
Dinh et al. | Nested leave-two-out cross-validation for the optimal crop yield model selection | |
Raman et al. | Enhanced reptile search optimization with convolutional autoencoder for soil nutrient classification model | |
CN117455066A (en) | Corn planting accurate fertilizer distribution method based on multi-strategy optimization random forest, electronic equipment and storage medium | |
Gautam et al. | Optimized high performance deep neural network for crop recommendation | |
Rao et al. | Crop yield prediction by using machine learning techniques | |
CN113139717B (en) | Crop seedling condition grading remote sensing monitoring method and device | |
Yadav et al. | Agricultural Crop Yield Prediction using Deep Learning Approach | |
Suriyakrishnaan et al. | Recommendation system for Agriculture using Machine learning and Deep learning | |
Parmar et al. | Crop Yield Prediction based on Feature Selection and Machine Learners: A Review | |
Iuchi et al. | Stabilizing the Predictive Performance for Ear Emergence in Rice Crops Across Cropping Regions |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |