Intelligent Agricultural Modelling of Soil Nutrients and pH Classiﬁcation Using Ensemble Deep Learning Techniques

: Soil nutrients are a vital part of soil fertility and other environmental factors. Soil testing is an efﬁcient tool used to evaluate the existing nutrient levels of soil and aid to compute the appropriate quantity of soil nutrients depending upon the fertility level and crop requirements. Since the conventional soil nutrient testing models are not feasible in real time applications, an efﬁcient soil nutrient, and potential of hydrogen (pH) prediction models are essential to improve overall crop productivity. In this aspect, this paper aims to design an intelligent soil nutrient and pH classiﬁcation using weighted voting ensemble deep learning (ISNpHC-WVE) technique. The proposed ISNpHC-WVE technique aims to classify the existence of nutrients and pH levels exist in the soil. In addition, three deep learning (DL) models namely gated recurrent unit (GRU), deep belief network (DBN), and bidirectional long short term memory (BiLSTM) were used for the predictive analysis. Moreover, a weighted voting ensemble model was employed which allows a weight vector on every DL model of the ensemble depending upon the attained accuracy on every class. Furthermore, the hyperparameter optimization of the three DL models was performed using manta ray foraging optimization (MRFO) algorithm. For investigating the enhanced predictive performance of the ISNpHC-WVE technique, a comprehensive simulation analysis takes place to examine the pH and soil nutrient classiﬁcation performance. The experimental results showcased the better performance of the ISNpHC-WVE technique over the recent techniques with accuracy of 0.9281 and 0.9497 on soil nutrient and soil pH classiﬁcation. The proposed model can be utilized as an effective tool to improve productivity in agriculture by proper soil nutrient and pH classiﬁcation.


Introduction
The primary objective of soil management in agriculture is to enhance crops' productivity via the improvement and maintenance of dynamic soil parameters [1]. Population stress, terrestrial limitation, and weakening of conventional soil management approaches have led to a deterioration in soil fertility, particularly in developing countries such as India. Crop health is an essential component in the high productivity systems of current agriculture [2]. Significant growth in crop productions could be achieved through adopting the appropriate crop health management system. Improved productivity can be attained by efficient soil resources management as well as corrective measures to employ micronutrients [3]. Accurate and rapid detection of problems related to the crop enables

Literature Review
In Suchithra and Pai [10], five classification issues have been resolved by means of faster learning classification techniques called extreme learning machine (ELM) using distinct functions such as sine-squared, hard limit, hyperbolic tangent, triangular, and Gaussian radial basis. Afterward, in the efficiency analysis of ELM using distinct activation functions for this soil parameter classification, the Gaussian radial basis functions (RBF) attained better performances. Chambers [11] proposed a study on the basis of hypotheses that the ML approaches increase the precision of soil properties predictions. The relation attained in this work is significant to understand the whole strategies for soil property predictions with an optical spectroscopy sensor. Various ML models such as RF, decision tree (DT), Naïve Bayes (NB), SVM, least squares SVM (LSSVM), and artificial neural network (ANN) are investigated in [11]. Wu et al. [12] used ML methods to make a sequence of complete and new models from which to estimate soil nutrient contents. Soil nutrient estimation method was made with six SVM models and four ANN models. The generalized recurrent neural network (RNN) models were the best ANN estimation models using mean square prediction error, least root mean square error, and mean error. The precision rate of integrated k-nearest neighbor (KNN) local SVM models (viz., KNNSVM) for soil nutrient estimation was higher than another five partial SVM methods. In Rose et al. [13], research was conducted on distinct parameters employed to define the features of the soil and how they are employed as an input to ML analysis or algorithms for forecasting soil fertility. According to this, it can be noted that predictive methods can be effectively used on enhanced soil parameters for soil fertility predictions using less human intervention and more accuracy.
Rajamanickam [14] presents distinct Supervised ML models such as DT, KNN, and SVM for predicting the soil fertility according to micro and macro nutrients status establish in the datasets. A supervised ML algorithm is used on the training datasets and verified by test datasets, and the execution of this algorithm is made by R Tools. Rajamanickam and Mani [15] proposed a technique by integrating uncertainty quantification using the fisher ratio pre-processing models and Kullback divergent chi-square FS to predict the fertility of the soil. Then, Gustafson-Kessel probabilistic NN classifications use the soil fertility prediction models for producing the likelihood distribution as output and the distinct kinds of soil fertility levels rather than an individual value.
Sirsat et al. [16] developed fertility index predictions for soil organic carbons and 4 significant soil nutrients (zinc, manganese, phosphorus pentoxide, and iron) with the most accessible regression method, especially a group of seventy-six regressors belonging to twenty families, involving boosting NN, DL, SVM, RF, bagging, Bayesian models, lasso and ridge regression, etc. The optimal result is attained using the extraTrees that attain satisfactory predictive results. In Ning et al. [17], near infrared spectroscopy integrated to chemometric method was used for determining the total nitrogen content and organic matter as well as calculate fertility of tea plantation soil. Firstly, subtractive spectroscopy and photometric precision are employed as indicators in finding optimum sample preparation conditions. Next, the combination of partial least square methods was compared using three distinct characteristics: GA, wavelength extraction methods, and competitive adoptive reweighted sampling quantitative discrimination model is defined to be optimum for overall nitrogen contents as well as organic matter. Then, classification models for soil fertility levels with LDA, SVM, and ELM were determined according to successive projection and full spectrum algorithms individually.
Only few works have addressed both pH classification and soil nutrient classification process. However, there is still a room for improvement to accomplish enhanced classification performance. Furthermore, it is desirable to improve the decision maker's countermeasures and offer them an effortless method with a collection of common rules which assist complex decision-making processes. Thus, the proposed work varies from earlier works in the design of weighted voting ensemble model with MRFO based hyperparameter tuning strategy for soil pH and nutrient classification. The use of ISNpHC-WVE model offers more insights and attained better performance than the state-of-art techniques.

Materials and Methods
In this study, a novel ISNpHC-WVE technique is derived to classify the level of soil nutrients and pH level in the soil. The ISNpHC-WVE technique involves three DL models for predictive process. In addition, the ISNpHC-WVE technique has derived a weighted voting ensemble DL model with MRFO based hyperparameter tuning process. The use of MRFO algorithm assists to boost the overall predictive performance of the DL models. Figure 1 illustrates the overall process of ISNpHC-WVE model. The processes involved in these modules are elaborated in the following sections.
MRFO algorithm assists to boost the overall predictive performance of the DL models. Figure 1 illustrates the overall process of ISNpHC-WVE model. The processes involved in these modules are elaborated in the following sections.

Data Collection
Samples of soil were gathered from individual farmers by the soil testing laboratory. The soil samples were examined for different parameters of immediate relevance to plant nutrition such as soil reaction (pH), electrical conductivity (EC), OC, plant available primary nutrients (P, K), and micronutrients. The analytical models utilized to estimate soil fertility parameters are given as follows. pH level was determined by the use of pH meter with 1: 2.5 soil water suspension. EC is a metric of the concentration of soluble salts, and the degree of salinity in the soil was determined by the use of conductivity meter with 1:2.5 soil water suspension. The OC was computed by Walkley and Black's wet digestion technique. The phosphorous was estimated using ascorbic acid approach and potassium in soil was determined by the solution ratio of 1:5 of neutral normal ammonium acetate solution and the potassium in the extract was computed using flame photometry. Then, the available boron (B) in soils was extracted by the use of the hot water extraction procedure. The agricultural data collected from farmland involved four major parameters (Figure 2A): OC, P, K, and B. Each class comprises three subclasses namely low, medium, and high. Moreover, the pH level can be divided into four classes such as strongly acidic (SA), highly acidic (HA), moderately acidic (MA), and slightly acidic (SLA). The details related to the data are given in Figure 2B.

Data Collection
Samples of soil were gathered from individual farmers by the soil testing laboratory. The soil samples were examined for different parameters of immediate relevance to plant nutrition such as soil reaction (pH), electrical conductivity (EC), OC, plant available primary nutrients (P, K), and micronutrients. The analytical models utilized to estimate soil fertility parameters are given as follows. pH level was determined by the use of pH meter with 1:2.5 soil water suspension. EC is a metric of the concentration of soluble salts, and the degree of salinity in the soil was determined by the use of conductivity meter with 1:2.5 soil water suspension. The OC was computed by Walkley and Black's wet digestion technique. The phosphorous was estimated using ascorbic acid approach and potassium in soil was determined by the solution ratio of 1:5 of neutral normal ammonium acetate solution and the potassium in the extract was computed using flame photometry. Then, the available boron (B) in soils was extracted by the use of the hot water extraction procedure. The agricultural data collected from farmland involved four major parameters ( Figure 2A): OC, P, K, and B. Each class comprises three subclasses namely low, medium, and high. Moreover, the pH level can be divided into four classes such as strongly acidic (SA), highly acidic (HA), moderately acidic (MA), and slightly acidic (SLA). The details related to the data are given in Figure 2B.

Prediction Models
For predictive analysis of the soil nutrients and pH level, three DL models namely GRU, DBN, and BiLSTM models are employed. The overall structure and working of the DL models are offered in the succeeding subsections.

GRU Model
RNN has been proven to be more powerful in extracting temporal patterns than traditional neural networks by building self-loop connections from a node to itself and sharing parameters across different time steps. The benchmark RNN takes their input from the present input x t along with what they have picked up earlier. Firstly, the hidden states h t carrying the network memory can be calculated as where h t−1 represents the prior hidden states; χ i denotes a novel input; W & U indicates the weight matric; b signifies the bias vector and f is a nonlinear activation function. Then, the current state 0 t is calculated as where W 0 is the weight matrix, and b 0 is the bias vector. Although RNN shows a robust ability to model non-linear time sequences in an efficient manner, it cannot escape the exploding and vanishing gradient issues, and its accuracy decreases when the time span becomes longer [18]. The LSTM was proposed for mitigating the above-mentioned problems, but the time-consuming training process may hinder a wide-spread adoption of LSTM in real-time. In our paper, we employ another notable RNN variant, a gated recurrent unit network (GRU). Figure 3 shows the framework of GRU.

Prediction Models
For predictive analysis of the soil nutrients and pH level, three DL models namely GRU, DBN, and BiLSTM models are employed. The overall structure and working of the DL models are offered in the succeeding subsections.

GRU Model
RNN has been proven to be more powerful in extracting temporal patterns than traditional neural networks by building self-loop connections from a node to itself and sharing parameters across different time steps. The benchmark RNN takes their input from the present input along with what they have picked up earlier. Firstly, the hidden states ℎ carrying the network memory can be calculated as where ℎ represents the prior hidden states; denotes a novel input; & indicates the weight matric; signifies the bias vector and is a nonlinear activation function. Then, the current state 0 is calculated as where is the weight matrix, and is the bias vector. Although RNN shows a robust ability to model non-linear time sequences in an efficient manner, it cannot escape the exploding and vanishing gradient issues, and its accuracy decreases when the time span becomes longer [18]. The LSTM was proposed for mitigating the above-mentioned problems, but the time-consuming training process may hinder a wide-spread adoption of LSTM in real-time. In our paper, we employ another notable RNN variant, a gated recurrent unit network (GRU). Figure 3 shows the framework of GRU. Both RNN and GRU have chain-like modules, but the repeating modules of GRU are more complicated. Each repeating module of GRU contains two gates, named update gate and reset gate, which gives GRU the ability to control the flow of information. The two gates are sigmoid units that map the variables in [0, 1], where the value between 0 and 1 is the ratio of memory Thus, GRU can tackle the correlation with the time series over long and short terms.
Initially, the reset gate controls how many data from the prior hidden states would be transferred to the present hidden states, whereas Both RNN and GRU have chain-like modules, but the repeating modules of GRU are more complicated. Each repeating module of GRU contains two gates, named update gate and reset gate, which gives GRU the ability to control the flow of information. The two gates are sigmoid units that map the variables in [0, 1], where the value between 0 and 1 is the ratio of memory Thus, GRU can tackle the correlation with the time series over long and short terms.
Initially, the r t reset gate controls how many data from the prior hidden states would be transferred to the present hidden states, whereas The novel memory candidate h t is created using r t using tan h layers derive from the succeeding equation: The upgrade gate z t determine the hidden states would be upgraded using a novel hidden states, whereas At last, the hidden states h t are regenerated In Equations (3)-(6), W r , W z indicates the weight matric, b r , b z denotes the respective bias vector.

DBN Model
The DBN has been generative graphical method which is a class of deep neural networks (DNNs). Hinton [19] projected to stack trained Restricted Boltzmann Machine (RBM) from the greedy approach for creating the called DBN. This is a deep layer network with all layers being an RBM network stacked together for construction of a DBN.
In DBN structure, all two sequential hidden layer procedures an RBM. An input layer of the current RBM is usually the resultant layer of preceding RBM. The DBN has been graphical method which contains deep hierarchical representation of trained data. The joint probability distribution of visible vector v and l hidden layer (h k (k = 1, 2, . . . , l), h 0 = v) is demonstrated utilizing the subsequent equations: The probabilities of bottom-up inference in the visible layer v to hidden layer h k , is determined as: where b k represents the bias to the layer kth.
Comparison, the top-down inference from the symmetric version of bottom-up inference that is expressed as [20]: where a k−1 signifies the bias to the layer (k -1)th. The training process of DBN is separated into 2 phases: pre-training and fine-tuning utilizing back propagation (BP). Pre-training subsequently fine-tuning has been great mechanism to train as DBN.

BiLSTM Model
LSTM [21] was developed by a specific memory cell for storing temporal data. This framework permits LSTM to recall longer-range features better than traditional RNN. Using multilayer models, component of cells at time step i at l layers in the forward direction could be performed as follows: and C l i , represents the hidden state, input gate, forget gate, output gate, candidate gate, and cell state correspondingly. Each is the size of the N ldimension vector. In Equations (11) Whereas l = 0 denotes the input layer. BiLSTM is better at attaining the correlations amongst the components in an entire series through data in both directions, rather than recalling the feature in one direction. Further, with the parameter sharing method, the BiLSTM models require lesser memory for solving the problems than traditional CNN and FNN models.

Design of MRFO Based Parameter Optimization Technique
To optimally tune the hyperparameters of the DL models, the MRFO algorithm is applied to it. The inspiration of MRFO depends upon the smart foraging behaviors of MR. It has three exclusive foraging principles of manta ray (MR) for identifying the optimal food source [22]. MRFO is operated by three foraging behaviors: Somersault foraging, Chain foraging, and Cyclone foraging. Some numerical methods are given as follows.

Chain Foraging
In MRFO, MR monitors the place of plankton and moves towards it. If the plankton concentration is higher, then the position will be optimal in which, every position is upgraded by a remarkable identified solution. This numerical method of chain foraging is depicted as: where, implies the place of xth individual at time n in dim is a dimension, rand refers an arbitrary vector from [0, 1], ϕ denotes a weight coefficient, and refers plankton with maximum concentration.

Cyclone Foraging
In this strategy, MR is shifted spirally to the place of the food source; the MR swims toward the plankton. It follows the one in front of it and swims towards the food spirally. The numerical notion of spiral-shaped events of MRs is described in the following: This behavior can be updated to d space. The arithmetical model of cyclone foraging is represented as: where α refers the weight coefficient, T shows higher count of iterations, and rand1 defines the rand value from [0, 1]. Every individual explores the novel position away from recent optimal one through allocating a novel arbitrary location in the search space location. This process is highly concentrated on MRFO to accomplish a wider global search; the mathematical function is projected as; where rand refers the random position, LB and UB denote lower and upper limits of a dimension, correspondingly.

Somersault Foraging
Every MR intends to move and somersault to novel place. Hence, it maximizes the positions and makes an optimal position. The numerical representation of this behavior can be depicted as: where T refer higher count of iterations.

Design of Weighted Voting Ensemble Model
In general, the generation of an ensemble of classifiers considers mostly two phases: Combination and Selection. The combination of a single classifier prediction takes place through various methods with distinct concepts; whereas the selection of component classifier is deliberated necessary for the efficacy of ensemble, and the key points for its efficiency is dependent on their accuracy and diversity. Considering that fact, the presented method depends on the concept of electing a set C = (C 1 , C 2 , . . . , C N ) of N self-labelled classifier through distinct methods (using heterogeneous method representation) to an individual dataset and the combination of their separate prediction take place by using a novel weighted voting method. It is noteworthy that weighted voting is a widely employed method to combine prediction in pair-wise classification where the classifier is not equally treated. All the classifiers are calculated on a calculation set D and related to a coefficient (weight), generally proportional to its classification performance.
Assume a dataset D using M classifier, i.e., used to the calculation of all the component classifiers. Particularly, the efficiency of all the classifiers C i , using i = 1, 2, . . . , N is calculated on D and a N × M matrix W is determined by Whereas all the elements w i,j are determined as follows While D j represent the collection of samples of the datasets belong to the class j, p denotes the amount of accurate prediction of classifiers C i on D j also q indicates the amount of incorrect predictions of C i that instances belong to class j. Obviously, all the weights w i,j are the F 1 -score of classifiers C i for j class [23]. The basis behindhand (1) is to evaluate the efficacy of all the classifiers, relate to all the classes j of calculation set D. Next, the class y of all the unknown instances χ in the test sets are evaluated as follows Whereas function argmax return the values of index respective to the large value from array, A = {1, 2, . . . , M} denotes the set of exclusive class labels and χ A indicates the characteristics function that considered the predictions j ∈ A of a classifiers C i on instances χ and create vectors where the j coordinates take values of one and the remaining takes the value of zero. Currently, it is noteworthy that this is the execution they elected for evaluating the efficiency of all the classifiers of the ensemble on the early training labelled set L.

Result Analysis
The performance of the ISNpHC-WVE technique for soil nutrient and pH classification is tested using Python 3.6.5 tool.

Comparative Analysis with Existing Models
A brief comparative study of the ISNpHC-WVE technique with existing techniques [10] is performed in Table 3

Comparative Analysis with Existing Models
A brief comparative study of the ISNpHC-WVE technique with existing techniques [10] is performed in Table 3

Discussion
By looking into the above-mentioned results analysis, it is apparent that the ISNpHC-WVE technique has the ability to classify soil nutrients and soil pH effectively over other models [10]. The proposed model accomplishes superior performance due to the inclusion of weighted voting ensemble model and hyperparameter tuning process. The proposed weighted strategy allocates weights on every individual classification model of the ensemble depending upon the accuracy on every class. The presented model allocates a vector of weights on every component classifier of the ensemble depending upon the accuracy on every class. The major intention is to determine the efficiency of the weighted voting ensemble model compared to the majority voting ensembles, by the use of separate component classification models in each case. Therefore, the presented weighted voting scheme had a considerable impact of every ensemble of self-labeled model, making use of the individual predictions of every component classifier effectually over other traditional voting models.

Conclusions
In this study, a novel ISNpHC-WVE technique was derived to classify the level of soil nutrients and pH level in the soil. The ISNpHC-WVE technique involved three DL models: GRU, DBN, and BiLSTM for the predictive process. In addition, the ISNpHC-WVE technique derived a weighted voting ensemble DL model with MRFO-based hyperparameter tuning process. The use of MRFO algorithm assists to boost the overall predictive performance of the DL models. In order to examine the improved prediction results of the ISNpHC-WVE technique, a wide-ranging simulation analysis was carried out on benchmark dataset. The experimental results showcased the better performance of the ISNpHC-WVE technique over the recent techniques with accuracy of 0.9281 and 0.9497 on soil nutrient and soil pH classification, respectively. In future, the presented ISNpHC-WVE technique could be deployed in the real time environment to automate the agricultural process. In addition, the performance of the proposed model can be improved by the use of hybrid metaheuristic optimizers with feature selection process. Moreover, the performance of the proposed model can be investigated on large scale datasets in future. Data Availability Statement: Data sharing not applicable to this article as no datasets were generated during the current study.