Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

Measurement: Sensors 27 (2023) 100722

Contents lists available at ScienceDirect

Measurement: Sensors
journal homepage: www.sciencedirect.com/journal/measurement-sensors

IOT-BASED professional crop recommendation system using a weight-based


long-term memory approach
S. Kiruthika a, b, *, D. Karthika b
a
Department of Computer Science, P.K.R Arts College for Women, Gobichettipalayam, Tamil Nadu, 638476, India
b
Department of Computer Science, VET Institute of Arts and Science, Erode, Tamil Nadu, 638012, India

A R T I C L E I N F O A B S T R A C T

Keywords: For the vast majority of Indians, agriculture is their main source of income, and it plays a vital role in the
Crop prediction country’s economy. The most prevalent issue Indian farmers have is that they do not choose their crops based on
Crop recommendation system the requirements of the soil, which has a significant negative impact on their productivity. Precision agriculture
And improved distribution based chicken
can help solve this problem. This method considers three parameters: soil characteristics, soil types, and crop
swarm optimization (IDCSO) with weight
based long short-term memory are all terms
yield data collection. A suitable crop to cultivate is suggested to the farmer based on these parameters. However,
that are essential to comprehend (WLSTM) India must develop and civilizes the agro industry’s technological engagement and usability. Due to the inability
to select acceptable features, the existing system’s accuracy is low, and it takes longer to process the given
climate dataset. This paper proposes a method based on IDCSO (Improved Distribution-based Chicken Swarm
Optimization) with WLSTM (Weight-based Long Short-Term Memory) for crop predictions and recommendations
in order to address the aforementioned issues with the help of the Internet of Things (IoT). The primary phases
are pre-processing, attribute selection using the IDCSO algorithm, and crop prediction using the WLSTM method.
First, climate data are collected, then crop production data. For this study, the climate data includes a number of
variables responsible for the rainfall at a given location and the agricultural yield in that region. Then, pre-
processing is performed to enhance the quality of the input. To provide precise prediction results with shorter
execution times, the IDCSO algorithm is utilized to choose the most helpful features. The most pertinent features
from the provided dataset are chosen using the optimal fitness values. The required crop predictions are then
performed using the WLSTM approach. Farmers can get instant crop recommendations by entering their
preferred climate and crop attributes. The experimental findings show that in terms of precision, recall, and
execution time, the suggested IDCSO-WLSTM technique performs better than its forerunner.

1. Introduction land, the crops have been adapted to meet their requirements. As a result
of the development of new creative technologies and methods, agri­
India is an agricultural nation with over 1,6 million square kilome­ cultural practices are gradually declining. As a result of these abundant
ters of land under cultivation, second only to China. Agriculture employs inventions, people have concentrated on creating artificial hybrid
the vast majority of Indians and is essential to the Indian economy [1]. products, which has led to an unhealthy existence [3]. The majority of
India has the potential to become an agricultural superpower on a global people today are unaware of the importance of planting crops at the
scale. Agriculture promotes economic expansion and rural development. proper time and place. Due to these agricultural practices, seasonal
Crop protection is essential but difficult due to the numerous pests that climatic conditions are altering in opposition to vital resources such as
threaten them, such as insects, plant diseases, and weeds, and the land, water, and air, resulting in food insecurity. Crop yield can be
toxicity of the majority of available remedies [2]. As a result, the ma­ increased by implementing new farming techniques that make use of IoT
jority of governments have imposed stringent restrictions on their use technology. The “Internet of Things” (IoT) is a creative idea of integra­
and advocate for non-chemical alternatives. tion that allows any object to send data over a network [2,3]. The
Agriculture has long been regarded as India’s primary and most “Internet of Things” (IoT) is an extremely encouraging group of in­
significant cultural activity. Because ancient people cultivate their own novations capable of providing numerous solutions for agricultural

* Corresponding author. Department of Computer Science, P.K.R Arts College for Women, Gobichettipalayam, Tamil Nadu, 638476, India.
E-mail addresses: kiruthikas@pkrarts.org (S. Kiruthika), karthikad@vetias.ac.in (D. Karthika).

https://doi.org/10.1016/j.measen.2023.100722
Received 29 October 2022; Received in revised form 20 January 2023; Accepted 23 February 2023
Available online 9 March 2023
2665-9174/© 2023 Published by Elsevier Ltd. This is an open access article under the CC BY-NC-ND license (http://creativecommons.org/licenses/by-nc-nd/4.0/).
S. Kiruthika and D. Karthika Measurement: Sensors 27 (2023) 100722

modernization [4]. Agriculture is one of the industries that will be recommendation system technology. In Section 4, the experimental
heavily influenced by advances in IoT technology. In crop production conclusions are presented. The work concludes with Section 5.
analysis, MLTs (Machine Learning Techniques) are novel areas of study.
In agriculture, yield forecasting is of paramount importance [4]. The 2. Literary work
farmer would like to know their output yields. In the past, farmers’ fa­
miliarity with particular fields and crops was taken into account for Khosla et al. (2020) [7] focused on the forecast of significant Kharif
predicting yields. Solutions to essential problems of yield predictions crops in Visakhapatnam, one of the largest coastal districts in Andhra
must be based on facts where MLTs help in achieving ideal solutions for Pradesh. The number of primary Kharif crops that could be produced
achieving the aforesaid goal. In order to predict crop yield for the was predicted by SVR (support vector regression) using rainfall data in
following year, many MLTs are used and assessed in the agricultural regions designated for specific crops after Manns (modular artificial
sector. neural networks) estimated the number of monsoon rainfalls. Rainfall is
The climate has the greatest impact on agricultural production. Any an important factor in determining Kharif crop yield levels. Using the
knowledge regarding climatic factors would aid farmers in their agri­ MANNs-SVR technique developed in the study, appropriate agricultural
cultural planning. Selecting the proper crop at the ideal time is essential methods for increasing crop outputs can be established. When compared
for maximizing output. By adding agro-climatic crop data including to existing techniques, their proposed method outperformed existing
temperature, relative humidity, soil type, soil pH, and crop period, a MLTs in predicting Kharif agricultural yield.
classification model is produced to assist farmers in making decisions, Jaison et al. (2017) [8] showed that DBNs (deep belief networks)
and a recommendation system is built based on three variables: crop, could be used in pre-training and feature learning, DTs (decision trees)
crop type, and districts [5,6]. A unique method called “Prediction of the and K-means clustering with PSOs (particle swarm optimizations) for
Districts” identifies agricultural patterns in 33 districts of Tamil Nadu training to get global solutions, and NBs (naive bayes) clustering with
and creates a classification model from them. A sample crop recom­ PSOs for testing could achieve the best results. Ranchers would benefit
mendation system is shown in Fig. 1. from predictions made by their proposed algorithms as they chose the
Despite the development of numerous studies and methods, crop most productive crops to grow. In the experiment, Anaconda Spyder was
recommendation system accuracy has not improved significantly. used to test the performance of the proposed model in Python, and their
Existing techniques are limited by time consumption and inaccurate results showed 98.35% accuracy and an error rate of 0.0314, which was
outputs of crop production datasets. In order to address the aforemen­ significantly better than most other methods. To provide a probabilistic
tioned issues, the IDCSO with the WLSTM method is designed to estimate of soybean crop production across 100 locations in three U.S.
improve overall system performance in this project. states Abbaszadeh et al. (2022) [9] presented a model that used BMA
The main contributions of the proposed crop prediction system are as (Bayesian Model Averaging) and groups of Copula functions for
follows: combining outputs of various DNNs (deep neural networks) including
3DCNNs (3D Convolution Neural Networks) and ConvLSTM (Convolu­
• Pre-processing, attribute selection, and crop prediction are the pri­ tion Long Short-Term Memory). The study showed that their suggested
mary contributions of this study. technique was more precise and trustworthy in estimating soybean crop
• Initially, pre-processing is performed to enhance the quality of the production when compared to 3DCNNs and ConvLSTM networks, even
input. when the models’ inherent uncertainty was taken into consideration.
• IDCSO method is used to choose attributes. To get reliable prediction According to Pant et al. (2021) [10], MLTs can be used to forecast
results as quickly as feasible, attribute selection aims to choose the four extensively grown crops in India. When crop production forecasts
most informative traits. are created for a specific site, based on the predicted crop and soil re­
• The required crop predictions are then performed using the WLSTM quirements, inputs like fertilizers can be applied in a variety of methods.
approach. Farmers can get instant crop recommendations by In this work, MLTs were used to train a model that could recognize
entering their preferred climate and crop attributes. patterns in the data and estimate agricultural yield. This study in­
• The experimental findings show that in terms of precision, recall, and vestigates the yield prediction of four of India’s most popular crops using
execution time, the suggested IDCSO-WLSTM technique performs MLTs. These include wheat, potatoes, paddy rice, and maize.
better than its forerunner. To efficiently extract features, Hafez et al. (2015) [11] presented
CSO (Chicken swarm optimization), a novel bio-influenced algorithm
The remaining sections of this study are organized as follows: Section that mimics the hierarchical ranking of the chicken swarm and its be­
2 discusses the literature review of crop recommendation systems. The haviors, including those of roosters, hens, and chicks. In order to find the
third section elaborates on the suggested crop prediction and best feature combinations that maximize classification performance

Fig. 1. Illustration of a crop recommendation system.

2
S. Kiruthika and D. Karthika Measurement: Sensors 27 (2023) 100722

while lowering the number of selected features, CSO is employed in are responsible for the rainfall in a given region as well as the crop yield
wrapper mode. When compared against 18 datasets obtained from the in that region. The crop recommendation dataset contains the variables
UCI database under varied assessment settings, it outperformed PSOs phosphorus (P), nitrogen (N), potassium (K), temperature, humidity,
and GAs (Genetic Algorithms), which are often employed to tackle pH, precipitation, and label.
optimization problems.
Zhang et al. (2017) [12] made short/long-term predictions (1–3 3.2. Pre-processing
days) of sea surface temperatures (weekly/monthly means) using LSTM.
It had two layers: a thick layer with full connectivity and an LSTM to Data pre-processing can improve input quality. The data model is
model the relationship between the time series. The outputs of LSTM provided with a consistent structure that manages missing data, iden­
layers were transferred to final predictions by fully-connected layers. tifies duplicate data, and eliminates poor data at this level. There are two
The accuracy of China’s coastal waters was stated to show the efficacy of steps involved in this procedure. The initial step is to eliminate the
their suggested strategy, and experiments were carried out to ascertain actual dataset’s missing values, which are represented by a dot (‘.’). The
the ideal configurations of their model. Forecast accuracies were also inclusion of these missing values diminishes the data’s usefulness and
assessed using SST anomaly data. The model’s attributes that have been hinders the performance of models based on MLTs. In order to deal with
updated online are also shown. these missing data, we replace them with extremely large negative
Jiang et al. [13] Recurrent neural networks (RNN) with long values that can be easily identified as outliers by the trained model.
short-term memory (LSTM) might be used to forecast maize yields. Data Before MLTs can utilize the data, it is necessary to develop class la­
on county-level maize production and hourly meteorological factors bels. The purpose of class labels is to facilitate the use of supervised
make the sample space big enough for deep learning systems. A good fit learning. Because the actual dataset lacked labels, they had to be
for this application is LSTM’s ability to anticipate time series with generated during data preprocessing. The necessary labels are generated
complicated internal linkages. for each crop based on yield (in tonnes) and cultivated area (in hect­
Layona et al. [14] Swarm Optimization (SSO) based on Particle ares). Those with a production area value greater than zero are denoted
Swarm Optimization (PSO) and Cat Swarm Optimization is described in by the number 1. In all other cases, the value 0 is assigned to the class
this study in order to anticipate industrial production. label.
Saranya et al. [15] The system’s performance is forecasted and
enhanced using a neural network and an incremental learning meth­ 3.3. IoT based sensors in field area for crop prediction
odology. Peng and colleagues [16] Researchers examined three satellite
products for maize and soybean production forecasts in the Midwest: Soil moisture sensors, soil pH level sensors, temperature sensors, and
gap-filled Smooth Inverse Frequency (SIF) data from the Orbiting Car­ humidity sensors, for example, are used to measure various parameters
bon Observatory-2 (OCO-2), new SIF data from the Tropospheric in that region, such as soil moisture level, pH value, and rainfall, which
Monitoring Instrument (TROPOMI), and coarse-resolution SIF data from will be used to recommend the crop to be sown. If a crop becomes
the Global Ozone Monitoring Experiment-2 (GOME-2). Zhong et al. [17] infected, images of the infected crop are captured using a mobile camera
Deep learning-based time series classification is the goal of this study. to determine the best fertilizer, and all data is saved on the cloud.
Commercial crops prevail in irrigation systems in Yolo County. Landsat Following that, data processing rules will be applied to data stored in the
Enhanced Vegetation Index (EVI) time-series data was utilized to iden­ cloud. Following that, the dataset is divided into training and testing
tify summer crops because of the large diversity of crops that may be datasets. Apply the deep learning algorithm to the crop recommendation
identified. We also looked into XGBoost, Random Forest, and Support training model’s training dataset. It retrieves data from the database for
Vector Machine (SVM). crop disease segmentation in the case of crop diseases by supplying
Farmers in agriculture strive to cultivate crops that produce the images of infected croplands. The extracted features will then be used by
highest yield. Choosing the best crop among the many varieties should image-processing algorithms to predict crop disease.
be critical in making agriculture more profitable. So the most difficult
issue for farmers is crop selection. They typically grow the product that 3.4. IDCSO algorithm for selection of attributes
was marketed at a low cost the previous year. However, crop yield is
affected by a variety of factors. The use of data mining technologies in IDCSO method is used in this study to choose attributes. To get
agriculture could aid in determining the best crop choice or hybrid seed reliable prediction results as quickly as feasible, attribute selection aims
choices for a crop mix that is adapted to various objectives and condi­ to choose the most informative traits. The overall block diagram of the
tions and is better suited to the farm’s needs. Many algorithms can be proposed crop prediction system is shown in Fig. 2.
developed to assist in determining which crops have the best chance of In order to increase crop prediction accuracy, the IDCSO approach is
producing the highest yield potential in any given environment. How­ used to choose the best crop prediction features. In order to successfully
ever, each proposed algorithm has some drawbacks. As a result, an perform classification tasks, feature selection is the process of choosing
advanced computerised crop forecasting approach solves crop selection features from a larger set of characteristics in order to reduce the di­
problems. As a result, an effective decision-making methodology for mensionalities of feature spaces. Feature selection is a technique for
crop selection is required. identifying and removing redundant or irrelevant data from a dataset. It
facilitates data comprehension, reduces processing needs, mitigates the
3. Methodology impact of the dimensionality curse, and enhances prediction perfor­
mance [18].
IDCSO with WLSTM is designed for optimal crop forecasting and By simulating the hierarchy and behavior of the chicken swarm, the
recommendation in this study proposal. The primary objective of the novel bio-inspired algorithm CSO effectively extracts the intelligence
proposed system is to assist farmers in crop cultivation for increased displayed by a chicken swarm to optimize problems, including those of
production. the hens, chicks, and roosters. In order to maximize classification per­
formance while utilizing fewer features, CSO is used in feature selection
3.1. Dataset to explore the feature space for the ideal mix of features. The hierarchy
and individual behavior of a flock of chickens are mimicked by the al­
The dataset for crop recommendation can be found at https://www. gorithm. A chicken swarm’s hierarchical structure is made up of various
kaggle.com/siddharthss/crop-recommendation-dataset/. For this study, groups, each of which has a rooster and a large number of hens and
the crop recommendation dataset contains a number of variables that chicks. Every type of chicken demonstrates a distinct set of motion

3
S. Kiruthika and D. Karthika Measurement: Sensors 27 (2023) 100722

Fig. 2. Overall block diagram of the proposed crop prediction system.

principles. Chicken social structures are characterized by hierarchy. The Hen movements: Hens move in lockstep with their roosters in quest
stronger chickens in a flock will outweigh the weaker ones. There are of food. Additionally, while being controlled by the other chickens, they
lesser hens and powerful hens around the dominating roosters on the would grab the tasty food that the chickens haphazardly discovered.
group’s periphery. Fig. 3 represents the CSO method. When vying for food, the stronger chickens would have an advantage
over the weaker hens.
3.4.1. Migrations of chickens The chicks roam about their mother in search of food.
Movement of Rooster: Roosters with greater levels of physical Based on the behaviour of hens, the authors of [19] present a
fitness can search for food in a wide variety of locations. mathematical model of CSO that includes the following elements:

Fig. 3. Characteristics of the CSO algorithm.

4
S. Kiruthika and D. Karthika Measurement: Sensors 27 (2023) 100722

1) There are many types of chickens in the flock. There is a dominating ( ) ( )


rooster in each group, followed by a number of hens and young xt+1 t t t t t
i,j = xi,j + S1 ∗ rand ∗ xr1,j − xi,j + S2 ∗ rand ∗ xr2,j − xi,j (4)
chicks.
2) The hierarchy of the swarm is decided by the fitness levels of the S1 = exp ((fi − fr1 ) / (abs(fi ) + ε) (5)
chickens; the roosters, each of whom becomes the group leader, have
the highest fitness, while the chicks have the lowest fitness. Hens S2 = exp ((fr2 − fi )) (6)
make up the remaining.
3) A group’s mother-child bond, dominance association, and swarm Where rand indicates a homogeneous random number between [0, 1].
hierarchy will all remain the same. After a certain amount of time has r1ε[1, ..N] stands for an index of the rooster, which refers to the ith hen’s
passed, these statuses are only updated. groupmate, whereas r2ε[1, ..N] is an index of the chicken (rooster or
hen), which is chosen arbitrarily from the swarm r1 ∕ = r2.
This is the total number of mother hens, roosters, hens, and chicks. Obviously, fi > fr1 , fi > fr2 , .
Every person is specified in a D-dimensional space using their place­ As a result, S2 <1< S1. If S1 is equal to zero, the ith hen will perform
ments. food foraging before the other chickens. The greater the disparity be­
tween the fitness ratings of two chickens, the lower S2 and the farther
xi,j (i ∈ [1, ..., N], j ∈ [1, ..., D]). (1) apart they are from one another. The chickens would be less inclined to
Priority access to food is given to roosters with the highest fitness steal food that was found by other chickens as a result. The S1 formula is
ratings over those with lower fitness ratings. By assuming that roosters different from the S2 formula because contests exist inside groups. In
with higher fitness values are able to seek food in more locations than other words, group competitions are modeled after the fitness values of
roosters with lower fitness values, this example can be made simpler. the hens in relation to those of the rooster. The ith hen will look for food
The normal CSO has an issue with its error rate, so the Gaussian distri­ in its immediate surroundings if S2 is equal to zero. The particular group
bution is utilized to significantly reduce the error rate. Consequently, the has a special benefit for the rooster’s fitness [20]. As a result, the closer
IDCSO can be calculated as follows. S1 approaches 1 and the smaller the difference between its location and
( ( )) that of its group-mate rooster, the lower the ith hen’s fitness value. As a
xt+1 t
i,j = xi,j ∗ 1 + Randn 0, σ
2
(2) result, dominating hens are more inclined to eat than their weaker
⎧ counterparts.
⎨ 1, if fi ≤ fk kε[1, N], k ∕
⎪ =i By surrounding their mother, the chicks forage for food. This is
( outlined below.
σ2 = (f k − fi ) (3)

⎩ exp , otherwise
|fi | + ε ( )
xt+1 t t t
i,j = xi,j + FL ∗ xm,j − xi,j (7)
The index of a rooster, k, is chosen at random from the group of
roosters, and f represents the fitness score of the matching. Where can we find the mother of the eighth chick? () is a parameter that
On the other side, the hens can go where their roosters go in quest of indicates that the chick will forage for food alongside its mother.
food. Despite being controlled by the other chickens, they would also Because of the individual differences, each chick’s FL would be chosen at
grab the tasty food that the other chickens have haphazardly discovered. random between 0 and 2.

When vying for food, the stronger chickens would have an advantage
over the weaker hens.
In this study, chicks are assigned and identified based on the random

5
S. Kiruthika and D. Karthika Measurement: Sensors 27 (2023) 100722

location of climate feature data. As described in Algorithm 1, the the previous output. During the computation of the new candidate’s
chicken with the highest fitness value is modified to improve the rele­ activation, GRU regulates the flow of information from the previous
vant feature based on climate data. Compute the optimal values for each candidate’s activation, but does not individually regulate the sum of the
chicken (climate feature) using an equation, and the hens with the candidate’s activation. Due to parameter minimization, GRU has a
highest global finding food mechanism fitness value are identified as the higher convergence rate than LSTM, and outperforms LSTM models in
best (7). The proposed system uses the IDCSO algorithm to find feature only a few situations [22]. Fig. 4 illustrates the general structure of an
combinations that maximize classification precision with a small num­ LSTM.
ber of characteristics. Every feature is represented by a distinct dimen­ LSTM contains two types of cells, short term memory cells and long
sion, with each dimension ranging between 0 and 1 in the feature space. term memory cells, which are used to determine whether or not to retain
Therefore, an intelligent searching strategy is needed to discover the information in memory for an extended period of time by feeding it back
optimal locations in search spaces that maxize the fitness functions. into the network, or to delete it. LSTM memory is composed of gated
Given the training data, the IDCSO fitness function optimises the per­ cells, where gated indicates that the cell determines whether the infor­
formance of crop prediction on the validation set. mation is to be stored or discarded. This is accomplished through the use
of gates such as the learn gate, the forget gate, and the remember gate.
To generate descriptions from photographs, LSTM is utilized. It
3.5. WLSTM approach for predicting crops directly increases the likelihood that a given input sentence will be
translated correctly, both for training and observations. These models
Using WLSTM, this study predicts suitable crop conditions. Obtain utilize a recurrent neural network, which encodes the differential length
trained crop advice models by applying MLTs to data. Farmers can input into a predefined dimensional vector prior to “decoding” it to
quickly obtain crop recommendations by inputting their preferred produce the required output sentence.
climate and crop parameters into the system. Consequently, it makes sense to apply the same concept of “trans­
LSTM neural networks are a type of RNN (Recurrent Neural Net­ lating” an image into its description when provided with an image
works) that employ context-based prediction in contrast to standard (rather than a source-language sentence as input). The following
RNNs. In other words, LSTM can eliminate the problem of vanishing formulation is used to directly maximize the probability of the correct
gradients by training RNN. LSTM provides the ability to manage a image definition provided.
gradient flow while preserving dependencies in a superior manner over ∑
the long term. Every LSTM cell is composed of gates that determine the θ∗ = argmax log p(S|I; θ) (8)
amount of time to remember the input, the amount of time to remember
θ
(I,S)

or forget the value, and when to output the value [21]. According to
their performance, there are various Input gates, output gates, and Where is the parameter of the method, I represents an image, and S is its
forget gates are examples of gates. When this gate swings open and correct transcription. As S is capable of representing any sentence, its
produces a close-to-zero value, it prevents a value from entering the length is infinite. Consequently, it is customary to use the chain rule to
subsequent layer. This gate simply subtracts the input value from the describe the joint probability over S 0, S 1, …, S N, where N represents
total input. The forget gate retains the stored value until it generates a the length of this particular case.
number greater than zero. When a near-zero value is created, the block ∑
N
forgets the previous value it had stored. When the value kept in the log p(S|I) = log p(St |I, So , …, St− 1 ) (9)
unit’s memory has to be output, the output gate decides. LSTM networks t=0

have been proven to be very helpful for learning sequences made up of (S, I) represents a training example pair that optimised the total log
unknown long-term patterns because of their capacity to store long-term probabilities as shown in (9)
memory. In these networks, a stack of recurrent hidden layers enables The LSTM is typically a memory cell that encodes information about
rapid learning with sparser representations by facilitating the learning of the detected inputs up to this point in time at each time step. It con­
higher-level temporal characteristics. formed to the standard. Incorporating sigmoid nonlinearity, the LSTM
Gated Recurrent Unit (GRU) is identical to LSTM in that its gating updates for a given time step are
units control the flow of information within the unit without employing
individual memory cells. Similar to LSTM, GRU lacks memory cells and it = σ(Wxi xt + Whi ht− 1 + bi ) (10)
consists of fewer gates that are triggered by both the current input and

Fig. 4. LSTM architecture diagram.

6
S. Kiruthika and D. Karthika Measurement: Sensors 27 (2023) 100722

( ) existing ANN and proposed IDCSO-WLSTM models. The proposed


ft = σ Wxf xt + Whf ht− 1 + bf (11)
IDCSO-WLSTM outperforms the existing ANN classification system for
crop recommendation in terms of recall, precision, accuracy, and
ot = σ (Wxo xt + Who ht− 1 + bo ) (12)
execution time. The values of the present and planned systems are
gt = tanh (Wxc xt + Whc ht− 1 + bc ) (13) compared in Table 1.

ct = ft ⊙ ct− 1 + it ⊙ gt (14) 4.1. Accuracy

ht = ot ⊙ tanh (ct ) (15) Accuracy is defined as the model’s overall veracity and is calculated
as the sum of the original classification parameters (divided by the total
pt+1 = softmax (ht ) (16)
number of classification parameters)
Here, it , ft, ct, ot is the LSTM’s input, forget, cell memory, and output Tp + Tn
state. Accuracy = ( ) (25)
Tp + Tn + Fp + Fn
The multiple W matrices indicate the training parameters, and the
product is represented by a gate value. ht represents the hidden state at Where Tp is True positive, Tn is true negative, Fp is false positive and Fn is
time step t, and it is sent into a Softmax, which generates a probability false negative.
distribution pt+1 over all the words and indicates the word at time step t As shown in Fig. 5, the accuracy of the comparison measure is
+ 1. The LSTM model’s input and output are denoted by gt and ht evaluated using both the current and proposed methods. On the x-axis,
respectively. The context vector xt is handled by the soft attention the techniques are selected, while the y-axis represents the accuracy
mechanism and can capture visual information linked with a certain value. Existing methods such as the ANN algorithm provide lower ac­
input point. curacy for the given crop recommendation dataset, whereas the IDCSO-
The distinctive data with a high attention coefficient will be accor­ WLSTM approach provides higher accuracy. As a result, the proposed
ded greater importance, and the neural network will pay closer attention IDCSO-WLSTM improves 95% crop prediction accuracy by selecting
to it. As a result, the following are the coefficients of amplification for climate features appropriately.
input and recurring data:
βi = (1 + αi ) (17) 4.2. Precision

δi = () (18) The precision is determined as follows:


True positive
With the help of the discovered amplification coefficients, the neural Precision = (26)
True positive + False positive
network’s weights are amplified. (17) and (18). After projection, the
input data weight and the recurrent weight are amplified using the While recalls are measurements of fullness or quantity, precisions are
amplification coefficients I and I, respectively. computations of accuracy or quality. A higher level of precision often
means that an algorithm produces more relevant results than irrelevant
(19)

wix = βi wix
ones. The accuracy of a class in a classification problem is determined by
the ratio of true positives to the total number of objects classified as
(20)

wox = βi wox belonging to the positive class.
As shown in Fig. 6, the precision of the comparison measure is
(21)

wfx = βi wfx evaluated using both the existing and proposed methods. The techniques
are chosen on the x-axis, and the precision value is plotted on the y-axis.
(22)

wir = δi wir For the given crop recommendation dataset, conventional methods such
as the ANN algorithm have a lower precision, whereas the IDCSO-
(23) WLSTM technique has a higher precision. As a result, the proposed

wor = δi wor
IDCSO-WLSTM improves the accuracy of crop prediction by selecting
(24) climate features appropriately illustrated in Fig. 7.

wfr = δi wfr

From the above equations, it is evident that weight-based amplifi­


cation is performed efficiently on the LSTM neural network. The inno­ 4.3. Recall
vation of the WLSTM algorithm is the enhancement of the best solutions
using average weight values. Consequently, it is used to classify accurate The recall metric is computed using the following formula:
crop recommendation results. True positive
Recall = (27)
True positive + False negative
4. Experimental result
The following is the comparative graph:
In this work, the crop recommendation dataset can be found at https As opposed to precision, recall is determined by the proportion of
://www.kaggle.com/siddharthss/crop-recommendation-dataset. In this relevant documents returned by a search to the total number of relevant
study, MATLAB is used to evaluate the classification performance of documents available. The proportion of relevant documents returned by
a search to all documents returned determines precision.
As shown in Fig. The recall of the comparison measure is evaluated
Table 1 using both the existing and new methods. The recall value is plotted
Comparing existing and proposed system values.
along the y-axis, whereas the methods are plotted along the x-axis. For
METHODS/METRICS ANN (%) IDCSO-WLSTM (%) the presented crop recommendation dataset, conventional methods such
Accuracy 87.71 92.68 as the ANN algorithm yield a lower recall, whereas the IDCSO-WLSTM
Precision 82.06 90.88 method yields a higher recall. As a result, the proposed IDCSO-
Recall 84.78 91.98 WLSTM improves crop prediction accuracy by selecting climate fea­
Execution time (sec) 250.47 241.0484
tures appropriately.

7
S. Kiruthika and D. Karthika Measurement: Sensors 27 (2023) 100722

Fig. 5. Precision.

Fig. 6. Precision.

Fig. 7. Recall.

4.4. Execution time 5. Conclusion

When the proposed method runs faster, the system is enhanced. It is crucial to ensure that even the smallest investment in the sector
The proposed and existing approaches are used to compare the is taken care of when it comes to farming because of how important
execution times of the comparative measure, as seen in Fig. 8. The agriculture is to our economy. Crop seeds are an example of such an
techniques are characterized on the x-axis, while the execution times are investment. It is therefore critical to determine whether the appropriate
shown on the y-axis. The available techniques, such as the ANN algo­ crop has been chosen for suitable soil that meets its requirements in
rithm, have a longer execution time, whereas the proposed IDCSO- order to benefit the farmer. This system would assist farmers in making
WLSTM algorithm has a shorter execution time for the crop recom­ educated decisions about which crops to grow based on a variety of
mendation dataset. As a result, the proposed IDCSO-WLSTM improves environmental and geographical factors. ML and IoT-based recommen­
crop prediction accuracy by selecting climate features appropriately. dations will significantly educate farmers and assist them in minimising
costs and making strategic decisions by replacing intuition and passed-

8
S. Kiruthika and D. Karthika Measurement: Sensors 27 (2023) 100722

Fig. 8. Execution time.

down knowledge with far more reliable data-driven ML models. The Acknowledgements
proposed system developed the IDCSO-WLSTM crop prediction and
recommendation algorithm. The given recommendation model is an The author with a deep sense of gratitude would thank the supervisor
efficient solution to the problem of farmers selecting the most suitable for his guidance and constant support rendered during this research.
crop throughout the growing season. With the use of data from just one
Indian region, the model is calibrated and validated. Different types of References
soil cannot be modeled using the same methodology. As a result, in order
to generalize the model, soil samples from diverse sites must be used. [1] Elias E. Elemike, et al., The role of nanotechnology in the fortification of plant
nutrients and improvement of crop production, Appl. Sci. 9 (3) (2019) 499.
The IDCSO algorithm is used in this work to choose the most important [2] C.A. Campbell, et al., Crop production and soil organic matter in long-term crop
and pertinent features from a given dataset using the best fitness values. rotations in the sub-humid northern Great Plains of Canada, in: Soil Organic Matter
The WLSTM approach is then utilized for crop prediction and crop in Temperate Agroecosystems, CRC Press, 2019, pp. 297–315.
[3] X. Shi, X.S. An, Q. Zhao, et al., State-of-the-art internet of things in protected
recommendation using LSTM neural network weight values. The agriculture, Sensors 19 (8) (2019) 1833.
experimental findings show that in terms of precisions, recalls, and [4] Andrew Crane-Droesch, Machine learning methods for crop yield prediction and
execution times, the suggested IDCSO-WLSTM technique performs bet­ climate change impact assessment in agriculture, Environ. Res. Lett. 13 (11)
(2018), 114003.
ter than its forerunners. As a result, the proposed IDCSO-WLSTM im­ [5] S. Pudumalar, E. Ramanujam, R.H. Rajashree, C. Kavya, T. Kiruthika, J. Nisha,
proves 95% crop prediction accuracy by selecting climate features Crop recommendation system for precision agriculture, in: 2016 Eighth
appropriately. But there is one disadvantage that, the proposed work International Conference on Advanced Computing (ICoAC), IEEE, 2017, January,
pp. 32–36.
may not provide better result for large number of datasets. It will pertain
[6] Duraisamy Vasu, et al., Assessment of spatial variability of soil properties using
to the identification of various weed species in future projects. In geospatial techniques for farm level nutrient management, Soil and Tillage
addition, it will be compatible with a variety of feature selection stra­ Research 169 (2017) 25–34.
tegies and hybrid optimal deep learning models, such as border detec­ [7] Ekaansh Khosla, Dharavath Ramesh, RashmiPriya, Crop yield prediction using
aggregated rainfall-based modular artificial neural networks and support vector
tion and the incorporation of prior discoveries. Also, the Future work regression, Environ. Dev. Sustain. 22 (6) (2020) 5687–5708.
will focus on an improved data set with a large number of attributes as [8] B. Jaison, Adaptive Lemuria: a progressive future crop prediction algorithm using
well as yield prediction. data mining, Sustainable Computing: Informatics and Systems (2021), 100577.
[9] Peyman Abbaszadeh, et al., Bayesian multi-modeling of deep neural nets for
probabilistic crop yield prediction, Agric. For. Meteorol. 314 (2022), 108773.
CRediT authorship contribution statement [10] Janmejay Pant, et al., Analysis of agricultural crop yield prediction using statistical
techniques of machine learning, Mater. Today Proc. (2021).
[11] Ahmed Ibrahem Hafez, et al., An innovative approach for feature selection based
S. Kiruthika: Conceptualization, Conception and design of study, on chicken swarm optimization, in: 2015 7th International Conference of Soft
Formal analysis, analysis and/or interpretation of data, revising the Computing and Pattern Recognition (SoCPaR), IEEE, 2015.
manuscript critically for important intellectual content, Approval of the [12] Qin Zhang, et al., Prediction of sea surface temperature using long short-term
memory, Geosci. Rem. Sens. Lett. IEEE 14 (10) (2017) 1745–1749.
version of the manuscript to be published. D. Karthika: Funding [13] Z. Jiang, C. Liu, N.P. Hendricks, B. Ganapathysubramanian, D.J. Hayes, et al., arXiv
acquisition, Writing – original draft, Drafting the manuscript, Approval preprint, Predicting County Level Corn Yields Using Deep Long Short Term
of the version of the manuscript to be published. Memory Models, vol. 7, 2018, p. 1805, 2.
[14] R. Layona, S. Suharjito, Y. Tunardi, D. Tanoto, Optimization of land suitability for
food crops using neural network and swarm optimization algorithm, International
Declaration of competing interest Review on Computers and Software (IRECOS) 11 (8) (2016) 1.
[15] C. Saranya, N. Nagarajan, Efficient agricultural yield prediction using
The authors declare that they have no known competing financial metaheuristic optimized artificial neural network using Hadoop framework, Soft
Comput. 24 (7) (2020) 12659–12669.
interests or personal relationships that could have appeared to influence [16] B. Peng, K. Guan, W. Zhou, C. Jiang, C. Frankenberg, et al., Assessing the benefit of
the work reported in this paper. satellite-based solar-induced chlorophyll fluorescence in crop yield prediction, Int.
J. Appl. Earth Obs. Geoinf. 90 (8) (2020), 102126.
[17] L. Zhong, L. Hu, H. Zhou, Deep learning based multi-temporal crop classification,
Data availability Rem. Sens. Environ. 221 (9) (2019) 430–443.
[18] X. Meng, Y. Liu, X. Gao, H. Zhang, A new bioinspired algorithm: chicken swarm
The data that has been used is confidential. optimization, in: Advances in Swarm Intelligence, Springer, 2014, pp. 86–94.
[19] Khaled Ahmed, Aboul Ella Hassanien, Siddhartha Bhattacharyya, A novel chaotic
chicken swarm optimization algorithm for feature selection, in: 2017 Third

9
S. Kiruthika and D. Karthika Measurement: Sensors 27 (2023) 100722

International Conference on Research in Computational Intelligence and [21] Jianjing Zhang, et al., Long short-term memory for machine remaining life
Communication Networks (ICRCICN), IEEE, 2017. prediction, J. Manuf. Syst. 48 (2018) 78–86.
[20] Dinghui Wu, Shipeng Xu, Fei Kong, Convergence analysis and improvement of the [22] Shu Zhang, et al., Bidirectional long short-term memory networks for relation
chicken swarm optimization algorithm, IEEE Access 4 (2016) 9400–9412. classification, in: Proceedings of the 29th Pacific Asia Conference on Language,
Information and Computation, 2015.

10

You might also like