Deep Learning File
Deep Learning File
1
credit card fraud detection—as well as still emerging technologies such as self-driving
cars and generative AI.
2
a process in which a model learns to become more accurate for performing an action in
an environment based on feedback in order to maximize the reward.
3
data processing that is taking place in the background. Some of these examples include
the following:
1. Law enforcement:- Deep learning algorithms can analyse and learn from
transactional data to identify dangerous patterns that indicate possible fraudulent
or criminal activity. Speech recognition, computer vision, and other deep learning
applications can improve the efficiency and effectiveness of investigative analysis
by extracting patterns and evidence from sound and video recordings, images, and
documents, which helps law enforcement analyse large amounts of data more
quickly and accurately.
2. Financial services:- Financial institutions regularly use predictive analytics to
drive algorithmic trading of stocks, assess business risks for loan approvals, detect
fraud, and help manage credit and investment portfolios for clients.
3. Customer service :- Many organisations incorporate deep learning technology
into their customer service processes. Chatbots—used in a variety of applications,
services, and customer service portals—are a straightforward form of AI.
Traditional chatbots use natural language and even visual recognition, commonly
found in call centre-like menus. However, more sophisticated chatbot solutions
attempt to determine, through learning, if there are multiple responses to
ambiguous questions. Based on the responses it receives, the chatbot then tries to
answer these questions directly or route the conversation to a human user.
4. Healthcare:- The healthcare industry has benefited greatly from deep learning
capabilities ever since the digitization of hospital records and images. Image
recognition applications can support medical imaging specialists and radiologists,
helping them analyse and assess more images in less time.
5. Deep learning:- The core objective of machine learning is the learning and
inference. First of all, the machine learns through the discovery of patterns. This
discovery is made thanks to the data. One crucial part of the data scientist is to
choose carefully which data to provide to the machine. The list of attributes used
to solve a problem is called a feature vector. You can think of a feature vector as a
subset of data that is used to tackle a problem.
4
1.6 Inferring
When the model is built, it is possible to test how powerful it is on never-seen-before
data. The new data are transformed into a features vector, go through the model and give
a prediction. This is all the beautiful part of machine learning. There is no need to update
the rules or train again the model. You can use the model previously trained to make
inference on new data.
Once the algorithm gets good at drawing the right conclusions, it applies that knowledge
to new sets of data.
5
1.7 Machine Learning Algorithms and where they are used?
1.7.1 Convolutional Neural Networks (CNNs)
Convolutional Neural Networks (CNNs) are a class of deep neural networks, most
commonly applied to analysing visual imagery. They have revolutionised various fields
such as computer vision, image recognition, and even natural language processing.
key components and concepts of CNNs:
1. Convolutional Layer: This is the core building block of a CNN. In this layer, a
set of learnable filters (also called kernels) slide over the input image, computing
dot products between the filter and localised portions of the input. This operation
enables the network to detect features like edges, textures, and patterns at
different spatial locations in the image.
2. Pooling Layer: After the convolutional layer, pooling layers are often added to
progressively reduce the spatial size of the representation, reducing the amount of
parameters and computation in the network. Max pooling is a common pooling
technique where the maximum value within a region is selected.
3. Activation Function: Typically, CNNs use activation functions like ReLU
(Rectified Linear Unit) to introduce non-linearity into the network, allowing it to
learn complex patterns.
4. Fully Connected Layer: After several convolutional and pooling layers, the
high-level reasoning in the neural network is done via fully connected layers.
These layers take the high-level features from the convolutional layers and use
them to classify the input into various classes.
5. Softmax Layer: In classification tasks, the softmax layer is often used as the
output layer. It converts the raw scores (output of the previous layer) into
probability values, indicating the likelihood of each class.
6. Training: CNNs are typically trained using supervised learning, where the
network learns to map input images to their respective class labels by minimizing
a loss function, such as cross-entropy loss. This is done through backpropagation
and optimization algorithms like Stochastic Gradient Descent (SGD) or Adam.
6
7. Transfer Learning: Due to the computational resources required to train deep
CNNs from scratch, transfer learning is a common practice. Pre-trained CNN
models, like VGG, ResNet, or Inception, which have been trained on large
datasets like ImageNet, are fine-tuned on specific tasks with smaller datasets.
8. Data Augmentation: To improve generalization and prevent overfitting, data
augmentation techniques are often employed. These techniques involve
generating new training samples through transformations like rotations, flips, and
shifts on the original dataset.
9. Applications: CNNs have a wide range of applications including image
classification, object detection, facial recognition, medical image analysis,
autonomous vehicles, and more. They have achieved state-of-the-art performance
in many of these tasks.
10. Overall, CNNs have significantly advanced the field of computer vision and
continue to be a cornerstone of research and applications in artificial intelligence.
7
input, and outputs a forget gate vector (values between 0 and 1) indicating how
much of each cell state element to forget.
4. Input Gate: Determines which new information to store in the cell state. It
consists of two parts:
5. Input Gate: Determines which values from the input should be updated. It
computes a candidate value vector.
6. Update Gate: Combines the candidate values with the forget gate output to
update the cell state.
7. Output Gate: Controls which information from the cell state should be exposed
as the output. It takes input from the previous hidden state and current input, and
outputs an output gate vector that is multiplied element-wise with the cell state.
8. Hidden State: LSTMs also have a hidden state that acts as the short-term
memory of the network. It is updated based on the cell state and input at each time
step.
9. Training: LSTMs are trained using backpropagation through time (BPTT), an
extension of backpropagation that considers the unfolding of the network over
time. The parameters (weights and biases) of the LSTM network are updated to
minimise a loss function, typically using gradient descent-based optimization
algorithms like Adam or RMSProp.
10. Bidirectional LSTMs: In some cases, bidirectional LSTMs are used, which
process the input sequence both forwards and backwards. This allows the network
to capture dependencies from both past and future contexts.
11. Applications: LSTMs have been successfully applied in various tasks such as:
12. Natural Language Processing (NLP): Language modeling, text generation,
sentiment analysis, machine translation.
13. Speech Recognition: Phoneme recognition, speech synthesis.
14. Time Series Prediction: Stock price prediction, weather forecasting.
15. Gesture Recognition: Handwriting recognition, action recognition in videos.
8
Recurrent Neural Networks (RNNs) are a class of neural networks designed to work with
sequential data by maintaining a hidden state that captures information about previous
elements in the sequence. Unlike traditional feedforward neural networks, RNNs have
connections that form directed cycles, allowing them to exhibit temporal dynamics and
handle inputs of variable length.
key components and concepts of RNNs:
1. Recurrent Connections: RNNs have recurrent connections that enable them to
maintain information over time by feeding the output of a neuron back to itself as
input in the next time step. This loop allows the network to retain memory and
process sequences of arbitrary length.
2. Hidden State: At each time step, an RNN computes a hidden state vector based
on the current input and the previous hidden state. This hidden state serves as the
memory of the network and encodes information about past inputs in the
sequence.
3. Activation Function: Similar to other neural networks, RNNs use activation
functions (e.g., sigmoid, tanh, ReLU) to introduce non-linearity into the model,
enabling it to learn complex patterns in the data.
4. Training: RNNs are typically trained using backpropagation through time
(BPTT), which is an extension of the standard backpropagation algorithm for
feedforward networks. BPTT involves unfolding the network over time and
computing gradients at each time step to update the parameters (weights and
biases) of the network.
5. Vanishing Gradient Problem: One challenge with training RNNs is the
vanishing gradient problem, where gradients become very small as they propagate
back through time, leading to difficulties in learning long-range dependencies.
This problem can be mitigated to some extent using techniques like gradient
clipping, using alternative activation functions, or employing specialized RNN
architectures like Long Short-Term Memory (LSTM) networks or Gated
Recurrent Units (GRUs).
6. Applications: RNNs have been successfully applied in various tasks involving
sequential data, including:
9
7. Natural Language Processing (NLP): Language modeling, text generation,
sentiment analysis, machine translation.
8. Time Series Analysis: Stock market prediction, weather forecasting,
physiological signal analysis.
9. Speech Recognition: Phoneme recognition, speech synthesis.
10. Video Analysis: Action recognition, video captioning.
11. Genomics: DNA sequence analysis, gene expression prediction.
12. Despite their effectiveness in modelling sequential data, RNNs have limitations
such as difficulties in learning long-range dependencies and challenges in
parallelization due to their sequential nature. However, they serve as the basis for
more advanced architectures like LSTM and GRU, which address some of these
limitations while retaining the ability to process sequential data.
10
manner. The generator aims to generate realistic data samples to fool the
discriminator, while the discriminator aims to distinguish between real and fake
data accurately.
4. Loss Functions: The generator aims to generate realistic data samples to fool the
discriminator, while the discriminator aims to distinguish between real and fake
data accurately.
5. Generator Loss: The generator's objective is to minimize the probability that the
discriminator correctly classifies its generated samples as fake. This is typically
achieved by maximizing the log-probability of the discriminator making a
mistake, effectively encouraging the generator to produce realistic samples.
6. Discriminator Loss: The discriminator's objective is to correctly classify real and
fake samples. It aims to minimize the sum of the negative log-probabilities
assigned to the correct labels for both real and fake samples.
7. Training Procedure: During training, the generator and discriminator are
updated alternately. First, the discriminator is trained on a batch of real and fake
samples. Then, the generator is trained to generate more realistic samples to better
fool the discriminator. This process continues iteratively until convergence.
8. Mode Collapse: One common challenge in training GANs is mode collapse,
where the generator produces limited varieties of samples or ignores certain
modes of the data distribution. Mode collapse can occur when the generator
overfits to a small subset of the training data or when the discriminator becomes
too effective at distinguishing fake samples.
9. Applications: GANs have been applied in various domains, including:
10. Image Generation: Generating high-resolution images, image-to-image
translation, style transfer.
11. Data Augmentation: Generating synthetic data for training machine learning
models in scenarios with limited data.
12. Super-Resolution: Upscaling low-resolution images to higher resolutions.
13. Anomaly Detection: Identifying anomalies or outliers in data distributions.
14. Drug Discovery: Generating novel molecular structures with desired properties.
11
15. Overall, GANs have demonstrated remarkable capabilities in generating high-
quality synthetic data and have spurred significant research and development in
the field of generative modelling. However, training GANs can be challenging
due to issues like mode collapse, instability, and hyperparameter sensitivity,
which continue to be active areas of research
12
2. Weight Adjustment: Once the centres are fixed, the weights between the hidden
and output layers are adjusted using techniques like least squares regression or
gradient descent to minimise the error between the network's output and the
desired output.
Advantages:
1. RBFNs are particularly effective for function approximation tasks, interpolation,
and pattern recognition.
2. They have a simple and interpretable architecture.
3. RBFNs can provide smooth and continuous outputs due to the use of radial basis
functions.
Disadvantages:
1. Determining the optimal number and positions of radial basis functions can be
challenging.
2. RBFNs may suffer from overfitting, especially when the number of radial basis
functions is too large relative to the size of the training data.
Applications: RBFNs have been used in various fields, including:
1. Function approximation and interpolation.
2. Time series prediction.
3. Classification and pattern recognition.
4. Financial forecasting.
Overall, RBFNs offer an alternative approach to traditional neural networks, particularly
suitable for tasks where smooth interpolation or function approximation is desired.
However, they require careful tuning of hyperparameters and may not always generalize
well to unseen data.
13
Chapter 2 LITERATURE REVIEW
1. CRY—an improved crop yield prediction model using bee hive
clustering approach for agricultural data sets
Agricultural researchers over the world insist on the need for an efficient mechanism to
predict and improve the crop growth. The need for an integrated crop growth control with
accurate predictive yield management methodology is highly felt among farming
community. The complexity of predicting the crop yield is highly due to multi
dimensional variable metrics and unavailability of predictive modeling approach, which
leads to loss in crop yield. This research paper suggests a crop yield prediction model
(CRY) which works on an adaptive cluster approach over dynamically updated historical
crop data set to predict the crop yield and improve the decision making in precision
agriculture. CRY uses bee hive modeling approach to analyze and classify the crop based
on crop growth pattern, yield. CRY classified dataset had been tested using Clementine
over existing crop domain knowledge. The results and performance shows comparison of
CRY over with other cluster approaches.
14
3. Fuzzy Logic based Crop Yield Prediction using Temperature and
Rainfall parameters predicted through ARMA, SARIMA, and ARMAX
models
Agriculture plays a significant role in the economy of India. This makes crop yield
prediction an important task to help boost India's growth. Crops are sensitive to various
weather phenomena such as temperature and rainfall. Therefore, it becomes crucial to
include these features when predicting the yield of a crop. Weather forecasting is a
complicated process. In this work, three methods are used to forecast- ARMA (Auto
Regressive Moving Average), SARIMA (Seasonal Auto Regressive Integrated Moving
Average) and ARMAX (ARMA with exogenous variables). The performance of the three
is compared and the best model is used to predict rainfall and temperature which are in
turn used to predict the crop yield based on a fuzzy logic model.
15
database thus making this prediction system a perfect candidate for application of data
mining. Through data mining we extract the knowledge from the huge size of data. This
paper presents the study about the various data mining techniques used for predicting the
crop yield. The success of any crop yield prediction system heavily relies on how
accurately the features have been extracted and how appropriately classifiers have been
employed. This paper summarizes the results obtained by various algorithms which are
being used by various authors for crop yield prediction, with their accuracy and
recommendation
16
dataset contained the observed yield, check yield (average yield across all hybrids of the
same location), and yield difference of 148,452 samples for different hybrids planted in
different years and locations. Yield difference is the difference between yield and check
yield, and indicates the relative performance of a hybrid against other hybrids at the same
location (Marko et al., 2017). The environment dataset contained 8 soil variables and 72
weather variables (6 weather variables measured for 12 months of each year). The soil
variables included percentage of clay, silt and sand, available water capacity (AWC), soil
pH, organic matter (OM), cation-exchange capacity (CEC), and soil saturated hydraulic
conductivity (KSAT). The weather data provided in the 2018 Syngenta Crop Challenge
were normalized and anonymized. Based on the pattern of the data, we hypothesized that
they included day length, precipitation, solar radiation, vapor pressure, maximum
temperature, and minimum temperature. Part of the challenge was to predict the 2017
weather variables and use them for yield prediction of the same year.
The goal of the 2018 Syngenta Crop Challenge was to predict the performance of corns
in 2017, but the ground truth response variables for 2017 were not released after the
competition. In this paper, we used the 2001–2015 data and part of the 2016 data as the
training dataset (containing 142,952 samples) and the remaining part of the 2016 data as
the validation dataset (containing 5,510 samples). All validation samples were unique
combinations of hybrids and locations, which did not have any overlap with training data.
17
The output is the predicted soybean yield. Different from traditional pure CNN or pure
LSTM architectures, the proposed model mainly has two components: The first is CNN
used for feature extraction, and the second is LSTM, which is used to learn the temporal
features extracted by CNN. The CNN starts from two Conv2D layers with a kernel size
of 1×2 , the first Conv2D has 32 filters and the second has 64 counterparts. Feature maps
are first followed by a batch normalization layer and then followed by a 2-dimensional
max-pooling layer with 1×2 kernel. This improves generalization, robustness to small
distortions, and also reduces dimensionality. Note that batch normalization is employed
after each convolutional layer, which is another method to regularize a CNN. In addition
to providing a regularizing effect, batch normalization also gives CNN resistance to the
vanishing gradient during training, which can decrease training time and result in better
performance [56]. By the TimeDistributed wrapper, the two stacked Conv2D layers are
applied to every temporal slice of the inputs for feature extraction. Then, each output is
flattened and batch normalized successively before they are fed into an LSTM layer.
There is only one LSTM layer in the LSTM part. The neurons’ number of the LSTM is
set to 256, which is followed by a dense layer with 64 neurons. After that, all temporal
output is flattened into a long vector, which is sent into a Dropout layer with 0.5 dropout
probability; the dropout layer can randomly turn off a percentage of neurons during
training, which can help prevent groups of neurons from all overfitting to themselves.
Finally, a one neuron dense layer is used to output predicted yield.
18
Fig 2. CNN FEATURE EXTRACTION
2.3 OBJECTIVES
This project aims at predicting the crop yield at a particular weather condition and
thereby recommending suitable crops for that field. It involves the following steps.
1. Collect the weather data, crop yield data, soil type data and the rainfall data and
merge these datasets in a structured form and clean the data. Data Cleaning is
done to remove inaccurate, incomplete and unreasonable data that increases the
quality of the data and hence the overall productivity.
2. Perform Exploratory Data Analysis (EDA) that helps in analysing the complete
dataset and summarising the main characteristics. It is used to discover patterns,
spot anomalies and to get graphical representations of various attributes. Most
importantly, it tells us the importance of each attribute, the dependence of each
attribute on the class attribute and other crucial information.
3. Divide the analysed crop data into training and testing sets and train the model
using the training data to predict the crop yield for given inputs.
4. Compare various Algorithms by passing the analysed dataset through them and
calculating the error rate and accuracy for each. Choose the algorithm with the
highest accuracy and lowest error rate.
5. Implement a system in the form of a mobile application and integrate the
algorithm at the Dept of CSE, CMRIT 2019-2020 Page 4 Crop Yield Prediction
based on Weather using Machine Learning back end.
6. Test the implemented system to check for accuracy and failure
19
India is a country where agriculture and agriculture related industries are the major
source of living for the people. Agriculture is a major source of the economy of the
country. It is also one of the countries which suffer from major natural calamities like
drought or flood which damages the crop. This leads to huge financial loss for the
farmers thus leading to the suicide. Predicting the crop yield well in advance prior to its
harvest can help the farmers and Government organisations to make appropriate planning
like storing, selling, fixing minimum support price, importing/exporting etc. Predicting a
crop well in advance requires a systematic study of huge data coming from various
variables like soil quality, pH, EC, N, P, K etc. Prediction of crops deals with a large set
of databases thus making this prediction system a perfect candidate for application of
data mining. Through data mining we extract knowledge from the huge size of data.
Its harvest can help the farmers and Government organisations to make appropriate
planning like storing, selling, fixing minimum support price, importing/exporting etc.
Predicting a crop well in advance requires a systematic study of huge data coming from
various variables like soil quality, pH, EC, N, P, K etc. Prediction of crops deals with a
large set of databases thus making this prediction system a perfect candidate for
application of data mining. Through data mining we extract the knowledge from the huge
size of data
20
Chapter 3 Tool & Technology
3.1 System Requirements:
3.1.1 Hardware Requirement
Database MySql
21
2. Python is Interactive −You can sit at a Python prompt and
interact with the interpreter directly to write your
programs.
3. Python is Object-Oriented −Python supports Object-
Oriented style or technique of programming that
encapsulates code within objects.
4. Python is a Beginner's Language −Python is a great
language for the beginner-level programmers and
supports the development of a wide range of applications
from simple text processing to WWW browsers to games.
22
Python's features include−
1. Easy-to-learn −Python has few keywords, simple
structure, and a clearly defined syntax. This allows the
student to pick up the language quickly.
2. Easy-to-read −Python code is more clearly defined
andvisible to the eyes.
3. Easy-to-maintain −Python's source code is fairly easy-
to-maintain.
4. A broad standard library −Python's bulk of the library is
very portable and cross- platform compatible on UNIX,
Windows, and Macintosh.
5. Interactive Mode −Python has support for an interactive
mode which allows interactive testing and debugging of
snippets of code.
6. Portable −Python can run on a wide variety of hardware
platforms and has the same interface on all platforms.
7. Extendable −You can add low-level modules to the Python
interpreter. These modules enable programmers to add to
or customize their tools to be more efficient.
8. Databases −Python provides interfaces to all major
commercial databases.
9. GUI Programming −Python supports GUI applications that
can be created and ported to many system calls, libraries
and windows systems, such as Windows MFC, Macintosh, and
the X Window system of Unix.
10. Scalable −Python provides a better structure and support
for large programs than shell scripting.
11. Apart from the above-mentioned features, Python has a big
list of good features, few are listed below−
12. It supports functional and structured programming methods as well as OOP.
23
13. It can be used as a scripting language or can be compiled to byte-code for
building large applications.
24
3.5 Tools Used
3.5.1 Visual Studio Code (VSCODE):
Visual Studio Code, also commonly referred to as VS Code, is a source-code editor made
by Microsoft the Electron Framework, for Windows, Linux and macOS] Features include
support for debugging, syntax highlighting, intelligent code completion, snippets, code
refactoring, and embedded Git. Users can change the theme, keyboard shortcuts,
preferences, and install extensions that add additional functionality.
25
In the Stack Overflow2021 Developer Survey, Visual Studio Code was ranked the most
popular developer environment tool among 82,000 respondents; with 70% reporting that
they use it
Fig 3 VSCODE
3.5.2 Features:
1. Visual Studio Code is a source-code editor that can be used with a variety of
programming languages, including C# , Java, JavaScript, Go, Node.js, Python, C+
+, C, Rust and Fortran. It is based on the Electron framework, which is used to
develop Node.js web applications that run on the Blink layout engine. Visual
Studio Code employs the same editor component (codenamed "Monaco") used
Azure DevOps (formerly called Visual Studio Online and Visual Studio Team
Services).
2. Out of the box, Visual Studio Code includes basic support for most common
programming languages. This basic support includes syntax highlighting, bracket
matching, code folding, and configurable snippets. Visual Studio Code also ships
with IntelliSense for JavaScript, Type Script, JSON, CSS and HTML, as well as
debugging support for Node.js. Support for additional languages can be provided
by freely available extensions on the VS Code Marketplace.
3. Instead of a project system, it allows users to open one or more directories, which
can then be saved in workspaces for future use. This allows it to operate as a
language-agnostic code editor for any language. It supports many programming
languages and a set of features that differs per language. Unwanted files and
26
folders can be excluded from the project tree via the settings. Many Visual Studio
Code features are not exposed through menus or the user interface but can be
accessed via the command palette.
4. Visual Studio Code can be extended via extensions available through a central
repository. This includes additions to the editor and language support. A notable
feature is the ability to create extensions that add support for new languages,
themes, debuggers, time travel debuggers, perform static code analysis, and add
code linters using the Language Server Protocol.
5. Source control is a built-in feature of Visual Studio Code. It has a dedicated tab
inside of the menu bar where users can access version control settings and view
changes made to the current project. To use the feature, Visual Studio Code must
be linked to any supported version control system (Git, Apache Sub version,
Perforce, etc.). This allows users to create repositories as well as to make push
and pull requests directly from the Visual Studio Code program.
6. Visual Studio Code includes multiple extensions for FTP, allowing the software
to be used as a free alternative for web development. Code can be synced between
the editor and the server, without downloading any extra software
Chapter 4 METHODOLOGY
27
Fig. 4 SYSTEM ARCHITECTURE
28
5.
29
3. The Unified Modelling Language is a standard language for specifying,
Visualization, Constructing and documenting the artefacts of software system, as
well as for business modelling and other non- software systems.
4. The UML represents a collection of best engineering practices that have proven
successful in the modelling of large and complex systems.
5. The UML is a very important part of developing objects oriented software and the
software development process. The UML uses mostly graphical notations to
express the design of software projects.
4.4 GOALS:
1. The Primary goals in the design of the UML are as follows:
2. Provide users a ready-to-use, expressive visual modelling Language so that they
can develop and exchange meaningful models.
3. Provide extendibility and specialisation mechanisms to extend the core concepts.
4. Be independent of particular programming languages and development process.
5. Provide a formal basis for understanding the modelling language.
6. Encourage the growth of the OO tools market.
7. Support higher level development concepts such as collaborations, frameworks,
patterns and components.
8. Integrate best practices.
30
Fig. 6 Use Case Diagram
4.6 CLASS DIAGRAM:
In software engineering, a class diagram in the Unified Modelling Language (UML) is a
type of static structure diagram that describes the structure of a system by showing the
system's classes, their attributes, operations (or methods), and the relationships among the
classes. It explains which class contains information.
31
Fig. 7 Class Diagram
32
Sequence Diagrams show elements as they interact over time and they are organized
according to object (horizontally) and time (vertically):
33
Fig . 9 Collaboration Diagram
34
Chapter 5 IMPLEMENTATION AND RESULT
5.1 MODULES:
1. Data Collection
2. Dataset
3. Data Preparation
4. Model Selection
5. Analyze and Prediction
6. Accuracy on test set
7. Saving the Trained Model
5.2.2 Dataset:
1. The dataset consists of 2232 individual data. There are 9 columns in the dataset,
which are described below.
2. Id: unique id
3. State_Name: India is a union of States and Union Territories for the purposes of
administration, India is divided into 29 States
4. District_Name: District in india
5. Crop_Year: which year crop harvested.
6. Season:
Winter, occurring from December to February. ...
35
Summer or pre-monsoon season, lasting from March to May. ...
Monsoon or rainy season, lasting from June to September. ...
Post-monsoon or autumn season, lasting from October to November.
7. Crop: crop name
Area: how much area? they harvested.
Production: production amount
cat_crop: cat_crop name
36
Once the model is trained, we need to Test the model. For that we will pass test_x to the
predict method.
We trained two deep neural networks, one for yield and the other for check yield, and
then used the difference of their outputs as the prediction for yield difference. These
models are illustrated in Figure 3. This model structure was found to be more effective
than using one single neural network for yield difference, because the genotype and
environment effects are more directly related to the yield and check yield than their
difference.
37
5.2.6 Convolutional Neural Networks (CNN)
Using feedforward neural networks (FFNN) involves several key steps, from data
preparation to model evaluation. Here's a comprehensive guide on how to use FFNN in
your project:
1. Data Preparation:Data Collection: Gather the dataset relevant to your problem
domain. Ensure the data is appropriately labelled.
2. Data Preprocessing: Clean the data by handling missing values, outliers, and
formatting inconsistencies. Normalise or scale the features to ensure uniformity in
data distribution.
3. Train-Test Split: Divide the dataset into training and testing sets. The training set
is used to train the model, while the testing set evaluates its performance on
unseen data.
4. Define Architecture: Design the FFNN architecture, including the number of
layers, the number of neurons in each layer, and the activation functions.
5. Compile Model: Compile the model by specifying the loss function, optimizer,
and evaluation metrics.
6. Fit Model: Train the FFNN model using the training dataset. Adjust the
hyperparameters like batch size and number of epochs to optimise performance.
7. Monitor Training: Monitor the training process using metrics such as loss and
accuracy. Utilise techniques like early stopping to prevent overfitting.
8. Evaluate Performance: Evaluate the trained model on the test dataset to assess
its generalisation performance. Measure metrics like accuracy, precision, recall,
and F1-score.
9. Visualise Results: Visualise the model's performance using plots like confusion
matrices or ROC curves.
38
10. Hyperparameter Tuning: Experiment with different hyperparameters to fine-
tune the model's performance. Use techniques like grid search or random search
for optimization.
11. Regularisation: Apply regularisation techniques like L1/L2 regularisation or
dropout to prevent overfitting.
12. Deploy Model: Deploy the trained FFNN model in a production environment to
make predictions on new data.
13. Integration: Integrate the model into your application or system for real-time
inference.
39
necessary to put transaction data in to a usable form for processing can be achieved by
inspecting the computer to read data from a written or printed document or it can occur
by having people keying the data directly into the system. The design of input focuses on
controlling the amount of input required, controlling the errors, avoiding delay, avoiding
extra steps and keeping the process simple. The input is designed in such a way so that it
provides security and ease of use with retaining privacy. Input Design considered the
following things:
● What data should be given as input?
● How should the data be arranged or coded?
● The dialog to guide the operating personnel in providing input.
● Methods for preparing input validations and steps to follow when errors occur.
5.3.2 OBJECTIVES
Input Design is the process of converting a user-oriented description of the input into a
computer-based system. This design is important to avoid errors in the data input process
and show the correct direction to the management for getting correct information from
the computerised system.
1. It is achieved by creating user-friendly screens for the data entry to handle large
volumes of data. The goal of designing input is to make data entry easier and to
be free from errors. The data entry screen is designed in such a way that all the
data can be performed. It also provides record viewing facilities.
2. When the data is entered it will check for its validity. Data can be entered with the
help of screens. Appropriate messages are provided as when needed so that the
user will not be in maize instant. Thus the objective of input design is to create an
input layout that is easy to follow
40
most important and direct source of information to the user. Efficient and intelligent
output design improves the system’s relationship to help user decision-making.
1. Designing computer output should proceed in an organised, well thought out
manner; the right output must be developed while ensuring that each output
element is designed so that people will find the system can be used easily and
effectively. When analysis design computer output, they should Identify the
specific output that is needed to meet the requirements.
2. Select methods for presenting information.
3. Create documents, reports, or other formats that contain information produced.
41
This study is carried out to check the technical feasibility, that is, the technical
requirements of the system. Any system developed must not have a high demand on the
available technical resources. This will lead to high demands on the available technical
resources. This will lead to high demands being placed on the client. The developed
system must have a modest requirement, as only minimal or null changes are required for
implementing this system.
5.6 SOCIAL FEASIBILITY
The aspect of study is to check the level of acceptance of the system by the user. This
includes the process of training the user to use the system efficiently. The user must not
feel threatened by the system, instead must accept it as a necessity. The level of
acceptance by the users solely depends on the methods that are employed to educate the
user about the system and to make him familiar with it. His level of confidence must be
raised so that he is also able to make some constructive criticism, which is welcomed, as
he is the final user of the system.
42
business process, application, and/or system configuration. Unit tests ensure that each
unique path of a business process performs accurately to the documented specifications
and contains clearly defined inputs and expected results
The purpose of testing is to discover errors. Testing is the process of trying to discover
every conceivable fault or weakness in a work product. It provides a way to check the
functionality of components, sub-assemblies, assemblies and/or a finished product It is
the process of exercising software with the intent of ensuring that Software system meets
its requirements and user expectations and does not fail in an unacceptable manner. There
are various types of test. Each test type addresses a specific testing requirement.
Unit tests perform basic tests at component level and test a specific business process,
application, and/or system configuration. Unit tests ensure that each unique path of a
business process performs accurately to the documented specifications and contains
clearly defined inputs and expected results
The purpose of testing is to discover errors. Testing is the process of trying to discover
every conceivable fault or weakness in a work product. It provides a way to check the
functionality of components, sub-assemblies, assemblies and/or a finished product It is
the process of exercising software with the intent of ensuring that Software system meets
its requirements and user expectations and does not fail in an unacceptable manner. There
are various types of test. Each test type addresses a specific testing requirement.
43
Functional tests provide systematic demonstrations that functions tested are available as
specified by the business and technical requirements, system documentation, and user
manuals.
Functional testing is centred on the following items:
44
business process performs accurately to the documented specifications and contains
clearly defined inputs and expected results
The purpose of testing is to discover errors. Testing is the process of trying to discover
every conceivable fault or weakness in a work product. It provides a way to check the
functionality of components, sub-assemblies, assemblies and/or a finished product It is
the process of exercising software with the intent of ensuring that Software system meets
its requirements and user expectations and does not fail in an unacceptable manner.
45
5.8.6.3 Features to be tested
1. Verify that the entries are of the correct format.
2. No duplicate entries should be allowed.
3. All links should take the user to the correct page.
46
Chapter 6 Results
6.1 Dataset
To implement this project we are using agriculture production dataset and then training
above 3 neural networks algorithms on that dataset and building neural network model,
we can apply new test data on that model to predict crop yield will be HIGH or LESS. In
test data we will have values of location, current year, and agriculture land area and then
neural model will predict production. To test neural model we are using below test
dataset.
47
Fig 10 DATASET
In above test data in last column there is no production values and neural network will
predict production will be high or less. In above dataset we have area name, crop name,
year and area size.
48
In above screen selecting and uploading ‘dataset’ folder which contains agriculture and
rainfall dataset and then click on ‘Select Folder’ button to load dataset and to get below
screen
In above screen dataset loaded and above dataset contains missing values and string
values and neural network will not accept missing or string values so we need to
preprocess above dataset to replace missing and string values with numeric data. So click
on ‘Preprocess Dataset’ button to get below screen
49
In above screen all dataset converted to numeric values and now dataset is ready and now
click on ‘Run RNN Algorithm’ button to build RNN model on loaded dataset
In above screen RNN model generate with accuracy as 58% and now click on ‘Run
LSTM Algorithm’ button to build LSTM model
50
In above screen LSTM model generated with accuracy 78% and now click on ‘Run
FeedForward Neural Network’ button to build feed forward model
In above screen feed forward model generated with accuracy 62% and now click
‘Accuracy Comparison Graph’ button to get below graph
51
In above graph x-axis represents algorithm name and y-axis represents accuracy of those
algorithms and in all algorithms LSTM giving better prediction accuracy and now click
on ‘Predict Disease using Test Data’ button to upload test data and then neural network
will give below prediction result
52
In above screen selecting and uploading ‘testData.csv’ and then click on ‘Open’ button to
get below result
In above screen in square brackets we have test values from dataset which converted to
numeric format and after square bracket we can see prediction result as HIGH or LESS.
Based on given agriculture input neural network will give prediction result. Now click on
‘Top 6 Crop Yield Graph’ button to get below graph
53
In above graph x-axis represents state names and y-axis represents rainfall, rice, coconut,
sugarcane and various top6 crops in other states. First graph is for state vs rainfalls, state.
Chapter 7
Discussing the future and scope of a project focused on crop yield prediction using
machine learning is crucial for understanding the potential evolution and impact of this
technology in agriculture. As you draft your project report, consider outlining the
54
opportunities for advancement and expansion, along with the broader impacts on
agriculture, economics, and society. Here are some key areas to highlight:
55
water, nutrients, and pesticides), thus optimizing input usage and minimizing
environmental impact.
1. Climate Change: Machine learning models can help predict and mitigate the
impacts of climate change on agriculture by modeling complex scenarios
involving weather extremes and crop adaptability.
2. Food Security: Improved yield predictions can directly contribute to better food
supply planning and management, crucial for addressing food security issues,
especially in vulnerable regions.
56
2. Supportive Policies: Encouraging policies that support research and deployment
of AI technologies in agriculture, including subsidies, grants, and educational
programs to train farmers and agronomists in high-tech agricultural techniques.
REFERENCES
[1] “data.gov.in.” [Online]. Available: https://data.gov.in/
[2] Ananthara, M. G., Arunkumar, T., &Hemavathy, R. (2013, February).CRY
—an improved crop yield prediction model using bee hive clustering approach for
agricultural data sets. In 2013 International Conference on Pattern Recognition,
Informatics and Mobile Engineering (pp. 473-478).IEEE.
[3] Awan, A. M., & Sap, M. &. M. (2006, April). An intelligent system based on
57
kernel methods for crop yield prediction. In Pacific-Asia Conference on Knowledge
Discovery and Data Mining (pp. 841-846).Springer, Berlin, Heidelberg.
[4] Bang, S., Bishnoi, R., Chauhan, A. S., Dixit, A. K., &Chawla, I.
(2019,August). Fuzzy Logic based Crop Yield Prediction using Temperature and
Rainfall parameters predicted through ARMA, SARIMA, and ARMAX models. In
2019 Twelfth International Conference on Contemporary Computing (IC3) (pp. 1-6).
IEEE.
[5] Bhosale, S. V., Thombare, R. A., Dhemey, P. G., &Chaudhari, A. N.(2018,
August). Crop Yield Prediction Using Data Analytics and Hybrid Approach. In 2018
Fourth International Conference on Computing Communication Control and
Automation (ICCUBEA) (pp. 1-5).IEEE.
[6] Gandge, Y. (2017, December). A study on various data mining techniques for
crop yield prediction. In 2017 International Conference on Electrical, Electronics,
Communication, Computer, and Optimization Techniques (ICEECCOT) (pp. 420-
423).IEEE.
[7] Gandhi, N., Petkar, O., & Armstron0\g, L. J. (20 16, July). Rice crop yield
prediction using artificial neural networks. In 2016 IEEE Technological Innovations
in ICT for Agriculture and Rural Development (TIAR) (pp.105-110).IEEE.
[8] Gandhi, N., Armstrong, L. J., Petkar, O., & Tripathy, A. K. (2016, July).Rice crop
yield prediction in India using support vector machines.In2016 13th International
Joint Conference on Computer Science and Software Engineering (JCSSE) (pp. 1-
5).IEEE.
[9] Gandhi, N., Armstrong, L. J., &Petkar, O. (2016, July). Proposeddecision
support system (DSS) for Indian rice crop yield prediction.In2016 IEEE
Technological Innovations in ICT for Agriculture and RuralDevelopment (TIAR) (pp.
13-18).IEEE.
[10] Islam, T., Chisty, T. A., &Chakrabarty, A. (2018, December). A DeepNeural
Network Approach for Crop Selection and Yield Prediction inBangladesh. In 2018
IEEE Region 10 Humanitarian TechnologyConference (R10-HTC) (pp. 1-6). IEEE.
[11] Jaikla, R., Auephanwiriyakul, S., &Jintrawet, A. (2008, May). Riceyield
prediction using a support vector regression method. In 2008 5thInternational
58
Conference on Electrical Engineering/Electronics,Computer, Telecommunications
and Information Technology (Vol. 1,pp. 29-32). IEEE.
[12] Kadir, M. K. A., Ayob, M. Z., &Miniappan, N. (2014, August). Wheatyield
prediction: Artificial neural network based approach. In 2014 4 thInternational
Conference on Engineering Technology andTechnopreneuship (ICE2T) (pp. 161-
165). IEEE.
[13] Manjula, A., &Narsimha, G. (2015, January). XCYPF: A flexible
andextensible framework for agricultural Crop Yield Prediction. In 2015IEEE 9th
International Conference on Intelligent Systems and Control(ISCO) (pp. 1-5). IEEE.
[14] Mariappan, A. K., & Das, J. A. B. (2017, April). A paradigm for riceyield
prediction in Tamilnadu. In 2017 IEEE Technological Innovationsin ICT for
Agriculture and Rural Development (TIAR) (pp. 18-21).IEEE.
[15] Paul, M., Vishwakarma, S. K., &Verma, A. (2015, December).Analysis of
soil behaviour and prediction of crop yield using datamining approach. In 2015
International Conference on ComputationalIntelligence and Communication
Networks (CICN) (pp. 766-771).IEEE.
[16] Shah, A., Dubey, A., Hemnani, V., Gala, D., &Kalbande, D. R. (2018).Smart
Farming System: Crop Yield Prediction Using RegressionTechniques. In Proceedings
of International Conference on WirelessCommunication (pp. 49-56).Springer,
Singapore.
[17] Ahamed, A. M. S., Mahmood, N. T., Hossain, N., Kabir, M. T., Das,
K.,Rahman, F., &Rahman, R. M. (2015, June). Applying data miningtechniques to
predict annual yield of major crops and recommendplanting different crops in
different districts in Bangladesh. In 2015IEEE/ACIS 16th International Conference on
Software Engineering,Artificial Intelligence, Networking and Parallel/Distributed
Computing(SNPD) (pp. 1-6). IEEE.
[18] Shastry, A., Sanjay, H. A., &Hegde, M. (2015, June). A parameterbased
ANFIS model for crop yield prediction. In 2015 IEEEInternational Advance
Computing Conference (IACC) (pp. 253-257).IEEE.
[19] Sujatha, R., &Isakki, P. (2016, January). A study on crop yieldforecasting
using classification techniques.In 2016 InternationalConference on Computing
59
Technologies and Intelligent DataEngineering (ICCTIDE'16) (pp. 1-4).IEEE.
[20] Suresh, A., Kumar, P. G., &Ramalatha, M. (2018, October). Predictionof
major crop yields of Tamilnadu using K-means and Modified KNN.In 2018 3rd
International Conference on Communication andElectronics Syst ems (ICCES) (pp.
88-93).IEEE.
[21] Veenadhari, S., Misra, B., & Singh, C. D. (2014, January). Machinelearning
approach for forecasting crop yield based on climaticparameters. In 2014 International
Conference on ComputerCommunication and Informatics (pp. 1-5).IEEE.
60