Crop Yield

You might also like

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

ABSTRACT

Crop yield prediction plays a pivotal role in agriculture, aiding farmers, policymakers, and
stakeholders in decision-making processes related to crop planning, resource allocation, and
food security. Traditional methods of yield estimation often rely on historical data, agronomic
knowledge, and manual observation, which can be time-consuming and prone to inaccuracies.
In recent years, machine learning (ML) techniques have emerged as powerful tools for
predicting crop yields with greater accuracy and efficiency. This paper presents a
comprehensive review of machine learning-based crop yield prediction methodologies,
focusing on recent advancements, challenges, and future directions. The review encompasses
various aspects of crop yield prediction, including data sources, feature selection, model
selection, and evaluation metrics.
TABLE OF CONTENTS

S.No TITLE Page No

1 ABSTRACT 2

Chapter 1 : INTRODUCTION

2 1.1 Background
1.2 Overview
1.3 Scope

3 Chapter 2 : LITERATURE REVIEW

Chapter 3 : REQUIREMENT SPECIFICATION

3.1 Functional Requirements


3.2 Non – Functional Requirements
4 3.3 Software Requirement
3.4 Hardware Requirement
3.5 Technologies Used
3.6 Libraries
3.7 Integrated Development Environment

Chapter 4 : SYSTEM DESIGN

4.1 Introduction To System Design


4.2 Problem Statement Of the Proposed System
4.3 Objective Of The Application
5 4.4 Flowchart
4.5 Dataset Description
4.6 Machine Learning Algorithms
4.7 Modules
Chapter 5 : METHODLOGY OF THE SYSTEM

5.1 Existing System


6
5.2 Proposed System
5.3 Steps In Methodology
5.4 Methodology – Pre – Processing

7 Chapter 6 : CODING AND APPENDENCIES

Chapter 7 : RESULTS
8
7.1 Snapshots

Chapter 8 : FUTURE ENHANCEMENTS


9
8.1 Future Enhancement of Crop Yield
Prediction

10 Chapter 9 : CONCLUSION

11 Chapter 10 : REFERENCES
LIST OF FIGURES

Figure 1 Flowchart -

Figure 2 Prediction module -

Figure 3 Recommendation module

Figure 4 Methodology

Figure 5 Methodology-pre processing

Figure 6 Homepage Of The Crop Yield Predictor

Figure 7 Crop Prediction

Figure 8 Yield prediction

Figure 9 Rainfall prediction

Figure 10 Crop recommendation

Figure 11 Fertilizer prediction


INTRODUCTION

In recent years, agriculture has witnessed a significant transformation with the integration of
advanced technologies like machine learning. One of the key areas where machine learning
algorithms have made a profound impact is in crop yield prediction. Crop yield prediction using
machine learning techniques offers farmers and agricultural stakeholders valuable insights into
potential harvests, enabling them to make informed decisions regarding crop management,
resource allocation, and market strategies.

Traditional methods of crop yield estimation often relied on historical data, manual
observations, and subjective assessments. However, these methods are limited in accuracy and
scalability, particularly in the face of dynamic environmental factors and changing climate
patterns. Machine learning algorithms, on the other hand, have the capability to analyse vast
amounts of data, including environmental variables, soil characteristics, crop genetics, and
agronomic practices, to generate predictive models with greater precision and reliability.

The process of crop yield prediction using machine learning typically involves several stages.
Firstly, relevant data is collected from various sources such as satellite imagery, weather
stations, soil sensors, and historical records. This data is then pre processed and transformed to
extract meaningful features that can influence crop growth and productivity. Next, machine
learning models are trained using supervised learning techniques, where past observations of
crop yields are used to teach the algorithm to recognize patterns and relationships between
input variables and output yields. Various algorithms such as decision trees, random forests,
support vector machines, and neural networks can be employed depending on the complexity
of the problem and the nature of the data.

Once trained, the machine learning models can be deployed to predict crop yields for future
seasons based on real-time or forecasted environmental conditions. These predictions empower
farmers with valuable insights into crop performance, allowing them to optimize resource
utilization, implement precision agriculture practices, and mitigate risks associated with factors
like drought, pests, and diseases. Moreover, accurate yield forecasts facilitate better planning
and decision-making across the agricultural value chain, from seed manufacturers and input
suppliers to commodity traders and policymakers.

crop yield prediction using machine learning represents a powerful tool for enhancing
agricultural productivity, sustainability, and resilience in the face of evolving challenges. By
harnessing the capabilities of machine learning algorithms, farmers can make data-driven
decisions to maximize yields, minimize losses, and contribute to global food security. As
technology continues to advance, the integration of machine learning into agriculture holds
immense promise for transforming the way we grow, manage, and harvest crops in the future.

1.1 Background

Agriculture is the backbone of any country, and it has become the most significant growing
sector all over the world because of increasing the population. About 60% of our country's
population works in agriculture which contributes more to our country's GDP and employment.
The main challenge in the agriculture industry is to improve farming efficiency and quality to
fulfil the speedily increasing demand for food. Apart from the mounting population, the climate
circumstance is also a huge challenge in the agricultural industry. In our project, we will make
use of ML algorithms to assist farmers to know future crop yield predictions and favourable
weather predictions.

1.2 Overview

Basic Concepts

An Crop yield predictor is an online platform that provides access to a variety of resources and
services to farmers and other stakeholders in the agriculture industry. The main objective of
such a portal is to help farmers improve their crop production and profitability by providing
them with information, tools, and services that can help them make informed decisions and
adopt best practices. Some of the basic concepts that are central to an Crop yield predictor for
better crop production include:

Weather data: Farmers must be able to plan their planting and harvesting schedules in
accordance with the weather as it is so important to agriculture. Agricultural portals give
farmers access to weather alerts and forecasts, which can aid them in making decisions
regarding pest control, irrigation, and other tasks. exemplary practices.
Best Practices: Farmers must stay current on the most recent best practices and procedures
because agriculture is a complicated and ever-evolving industry. It gives farmers access to a
variety of tools and materials that can assist them advance their agricultural methods.

1.3 Scope

Crop yield prediction is a critical component in modern agriculture, facilitating efficient


resource management, maximizing productivity, and ensuring food security. The scope of a
crop yield prediction project involves the integration of various data sources, including
historical weather patterns, soil quality, crop genetics, and farming practices, to develop
accurate forecasting models. These models leverage machine learning algorithms and data
analytics techniques to predict future crop yields with precision.

One aspect of the project scope is data collection and pre processing. This involves gathering
historical data on weather conditions, soil characteristics, crop types, and previous yield
records. Data pre processing techniques such as cleaning, normalization, and feature
engineering are applied to ensure data quality and relevance for model training.

The next phase involves model development and evaluation. Machine learning algorithms such
as regression, decision trees, or neural networks are trained on the pre processed data to learn
the relationships between various factors and crop yields. These models are then evaluated
using metrics like mean absolute error or root mean square error to assess their accuracy and
reliability.

Furthermore, the project encompasses the deployment of the developed models into operational
systems. This involves integrating the models with agricultural management software or
decision support systems used by farmers or agricultural organizations. Real-time data streams
may be incorporated to continuously update and improve the predictive capabilities of the
models.

Finally, the project involves continuous monitoring and refinement. As new data becomes
available and agricultural practices evolve, the models need to be updated and fine-tuned
accordingly. Monitoring performance metrics and gathering feedback from end-users helps in
iteratively improving the accuracy and usability of the crop yield prediction system, ensuring
its effectiveness in supporting agricultural decision-making processes.
LITERATURE REVIEW

[1] According to analysis, the most used features are temperature, rainfall, and soil type, and
the most applied algorithm is Artificial Neural Networks in these models. The author used
parameters like State, district, season, and area. The user can predict the yield of the crop in
which year the user wants. The paper uses advanced regression techniques like Kernel Ridge,
and Lasso to predict the yield and uses the concept of Stacking Regression for enhancing the
algorithms to give a better prediction.

[2] In this paper, the author says, yield prediction was performed by considering farmers’
experience on a particular field and crop. Different Data Mining techniques are used and
evaluated in agriculture for estimating the future year’s crop production. This is achieved by
applying association rule mining on agriculture data. This research focuses on the creation of
a prediction model which may be used for future prediction of crop yield. This paper presents
a brief analysis of crop yield prediction using a data mining technique based on association
rules for the selected region.

[3] The author describes how the old farming data can be utilized to depict the future
expectation of harvests and yield. It likewise proposes to the ranchers what kind of yield can
be developed utilizing the climate station data and gives the appropriate data to incline toward
the precise season for cultivating. The curse on the harvest yield is broken down by utilizing
different ecological elements and Regression Analysis (RA), Linear Regression (LR)
Algorithms utilizing the various data mining strategies how to improve harvest production.

[4] This paper uses machine learning algorithms, direct relapse demonstrated from insights,
and two enhancement techniques, the Normal condition strategy, and the Gradient plunge
technique to anticipate the weather based on a couple of parameters. This work utilizes the
ordinary condition model’s speculation and contrasts it and the angle plunge model to give a
superior thought of the productivity of the models. This paper is about the use of machine
learning crop yield predictor for Better Crop Production ML algorithms, direct relapse
demonstrates from inside, and two enhancement techniques.

[5] We describe an approach to yield modelling that uses a semiparametric variant of a deep
neural network, which can simultaneously account for complex nonlinear relationships in high
dimensional datasets, as well as the known parametric structure and unobserved cross-sectional
heterogeneity. We show that this approach outperforms both classical statistical methods and
fully nonparametric neural networks in predicting the yields of years withheld during model
training. Our approach is less pessimistic in the warmest regions and the warmest scenarios.

[6] This paper predicts the yield of almost all kinds of crops that are planted in India. This script
makes novel by the usage of simple parameters like State, district, season, area and the user
can predict the yield of the crop in which year he or she wants to. The paper uses advanced
regression techniques like Kernel Ridge, Lasso, and Enet algorithms to predict the yield and
uses the concept of Stacking Regression for enhancing the algorithms to give a better
prediction.

[7] In this paper, we can predict the things like rainy, windy, sunny, stormy, floods and
variations in temperature, etc. Nowadays, the weather is making a bad impact, as society is
growing more and more, causing much damage, injury, and loss of life for farmers. Weather
forecasting is very important for agriculture and terrace gardening. Weather forecasting will
help remote areas for better crop production .In this paper, a low-cost solution for weather
forecast prediction is discussed.

[8] This paper uses algorithms such as Random Forest, Support Vector Machine, Weather, and
K Nearest neighbour, which are used for better performance results for each selected weather
parameter. We also use soil and weather parameters such as soil type, soil fertility, maximum
temperature, minimum temperature, and rainfall are used to identify suitable crops for specified
farms or land. Ethiopia consolidates both remotely detected information (RSD) and agrarian
overview information for a considerable beneficiary of specially appointed imported
nourishment help.
REQUIREMENT SPECIFICATION

3.1 FUNCTIONAL REQUIREMENTS

1. Farmer should be able to:

● Get recommendations for crop and fertilizers.

➢ Under the recommendation option, crop recommendation and fertilizer


recommendation will tell which crop to be grown and which fertilizer to be used.

● Get predictions for crop, yield, and rainfall.

➢ Under the prediction option, crop prediction will predict the crop to be grown, yield
prediction will predict the yield of the crop, and rainfall prediction will predict the rainfall
for that area in milli meters

3.2 NON-FUNCTIONAL REQUIREMENTS

3.2.1 Performance requirements

Response time should be minimum. The application should be responsive.

3.2.2 Usability requirements

The interface should be user-friendly. The application environment should be easy to use. It
should be adaptable to all kinds of platforms.

3.2.3 Reliability requirements

The system should behave consistently in a user-acceptable manner when operating within the
environment for which the system is intended.
3.3 SOFTWARE REQUIREMENT

● Operating system: Windows10 or above.

● Browser: Chrome.

● Other software’s:

❖ Visual studio code


❖ XAMPP
❖ PyCharm
❖ Postman
❖ Jupyter notebook.

● Frontend:

❖ HTML5
❖ CSS3
❖ JavaScript.

● Backend:

❖ Python ,
❖ Apache,
❖ Php.

3.4 HARDWARE REQUIREMENT

● Processor speed: 2.50GHz-2.71GHz.

● RAM size: 512MB and above.

● User Interface: Mouse and Keyboard.

● Storage Capacity: 1GB (minimum).


3.5 TECHNOLOGIES USED:

FRONTEND:
PHP:

PHP (Hypertext Preprocessor) is a server-side scripting language primarily designed for


web development but also used as a general-purpose programming language. Originally
created by Danish-Canadian programmer Rasmus Lerdorf in 1994, PHP has evolved into a
powerful and versatile language that powers a significant portion of the web.

Key Features of PHP

1. Simplicity and Ease of Use

➢ PHP is renowned for its simplicity and ease of use, making it accessible to both
beginners and experienced developers alike. Its syntax is similar to C, Java, and Perl,
making it familiar to programmers from various backgrounds.

2. Server-Side Scripting

➢ PHP is primarily used for server-side scripting, allowing developers to generate


dynamic content, interact with databases, and manage session data. It is seamlessly
integrated with web servers like Apache and Nginx, enabling the execution of PHP
code directly within HTML files.

3. Cross-Platform Compatibility

➢ PHP is a cross-platform language, meaning it can run on various operating systems


including Windows, macOS, Linux, and Unix-based systems. This versatility makes it
an ideal choice for building web applications that need to be deployed across different
environments.

4. Extensive Library Support

➢ PHP boasts a vast ecosystem of libraries and frameworks that streamline development
and enhance functionality. Popular frameworks such as Laravel, Symfony, and
CodeIgniter provide robust solutions for building scalable and maintainable web
applications.
5. Database Integration

➢ PHP offers seamless integration with databases, including MySQL, PostgreSQL,


SQLite, and MongoDB. Developers can easily execute SQL queries, retrieve data, and
manipulate database records using built-in functions and extensions.

6. Rapid Development

➢ With its dynamic typing, automatic memory management, and built-in functions for
common tasks, PHP enables rapid prototyping and development of web applications.
Its interpreted nature eliminates the need for compilation, allowing developers to iterate
quickly and efficiently.

Use Cases of PHP

1. Web Development

➢ PHP is widely used for building dynamic websites, e-commerce platforms, content
management systems (CMS), and web applications. Its ability to generate HTML,
interact with databases, and handle user authentication makes it indispensable for web
developers.

2. Server-Side Scripting

➢ PHP excels in server-side scripting tasks such as form processing, file handling, and
session management. It can process user input, generate customized responses, and
maintain stateful interactions between clients and servers.

Beyond web development, PHP is also utilized for command-line scripting tasks such as
automation, data processing, and system administration. Its command-line interface (CLI)
allows developers to execute scripts directly from the terminal, making it a versatile tool for
various scripting tasks
Backend:

PYTHON:

➢ Python is a high-level programming language renowned for its simplicity, readability,


and versatility, making it popular among developers across various domains. Its syntax
emphasizes code readability and allows developers to express concepts in fewer lines
of code compared to other languages, enhancing productivity and ease of maintenance.
Python's extensive standard library provides built-in modules and functions for tasks
ranging from web development and data analysis to machine learning and scientific
computing, empowering developers to create robust and efficient applications rapidly.
Furthermore, Python's dynamic typing and automatic memory management simplify
development by handling memory allocation and deallocation automatically, reducing
the burden on developers. Its compatibility with multiple platforms, including
Windows, macOS, and Linux, along with its strong community support and vast
ecosystem of third-party libraries, tools, and frameworks, contribute to Python's status
as one of the most widely used and versatile programming languages in the world.

PYTHON'S CHARACTERISTICS

1. Readability and Simplicity

Python's syntax is known for its readability and simplicity. Its use of indentation and
whitespace as block delimiters enforces clean, well-structured code. This design choice
makes Python an excellent language for beginners and seasoned developers alike.

2. Cross-Platform Compatibility

Python is cross-platform, meaning it can run on various operating systems like Windows,
macOS, and Linux without significant modification. This feature simplifies development
and deployment.

3. Extensive Standard Library

Python comes with an extensive standard library that provides modules and functions for a
wide range of tasks. These libraries offer solutions for file handling, networking, regular
expressions, and more, reducing the need for developers to reinvent the wheel.
4. Open Source and Community-Driven

Python is an open-source language, which means it is freely available for anyone to use,
modify, and distribute. This open nature has fostered a vibrant and supportive community
of Python developers who contribute to its growth and development.

5. Dynamically Typed

Python is a dynamically typed language, which means you don't need to specify variable
types explicitly. This feature enhances developer productivity and code flexibility.

3.6 LIBRARIES:

1. Python: Python is a widely used programming language in the field of machine


learning and data science due to its extensive libraries and frameworks for numerical
computing, data manipulation, and machine learning.
2. Jupyter Notebooks: Jupyter Notebooks provide an interactive computing environment
that allows researchers and data scientists to create and share documents containing
code, visualizations, and narrative text. Jupyter Notebooks are commonly used for
exploratory data analysis, model prototyping, and documentation in machine learning
projects.
3. Scikit-learn: Scikit-learn a popular machine learning library in Python that provides
simple and efficient tools for data mining and data analysis. Scikit-learn offers a wide
range of algorithms for regression, classification, clustering, and dimensionality
reduction, as well as tools for model evaluation and hyperparameter tuning.
4. TensorFlow or PyTorch: TensorFlow and PyTorch are deep learning frameworks
commonly used for building and training neural network models. These frameworks
provide high-level APIs for constructing neural networks, as well as low-level
operations for advanced customization and optimization. TensorFlow and PyTorch are
particularly useful for tasks such as image recognition and time series forecasting in
crop yield prediction.
5. Pandas and NumPy: Pandas and NumPy are Python libraries for data manipulation
and numerical computing, respectively. These libraries are essential for preprocessing
and cleaning input data, handling missing values, and transforming data into a format
suitable for machine learning models.
6. Matplotlib and Seaborn: Matplotlib and Seaborn are Python libraries for data
visualization. These libraries provide tools for creating static, animated, and interactive
visualizations of data, enabling researchers to explore relationships between variables
and gain insights from their data.
7. GeoPandas and Folium: GeoPandas and Folium are Python libraries for geospatial
data analysis and visualization. These libraries are useful for incorporating geographic
information such as crop field locations, soil types, and weather patterns into machine
learning models for crop yield prediction.
8. SQL Databases (e.g., PostgreSQL, MySQL): SQL databases are commonly used for
storing and querying large datasets in machine learning projects. SQL databases
provide features for data indexing, transaction management, and relational querying,
making them suitable for managing historical crop yield data and other related
information

3.7 Integrated Development Environment:


Visual Studio Code, is a popular free and open-source IDE developed by Microsoft. It includes
a range of features and capabilities for developing software, including support for multiple
programming languages, a powerful code editor, debugging tools and a range of plugins and
extensions.

Introduction to Visual Studio Code

• Visual Studio Code is a code editor in layman’s terms. Visual Studio Code is “a freeeditor
that helps the programmer write code, helps in debugging and corrects the code using the
intelli-sense method”. In normal terms, it facilitates users to write the code in an easy
manner. Many people say that it is half of an IDE and an editor, but the decision is up to to
the coders. Any program/software that we see or use works on the code that runs in the
background. Traditionally coding was used to do in the traditional editors or even in the
basic editors like notepad! These editors used to provide basic support to the coders.
• Some of them were so basic that it was very difficult in writing basic English level
programs in them. As time went by, some programming languages needed a specific
framework and support for further coding and development it, which was not possible using
these editors. VI Editor, Sublime Text Editor, is one of the many kinds of editors that came
into existence. The most prominent and which supports almost every coding language is
VISUAL STUDIO CODE. Its features let the user modify the editor as per the usage, which
means the user is able to download the libraries from the internet and integrate it with the
code as per his requirements.

What can Visual Studio Code do?

Visual Studio Code has some very unique features. They are listed as below :

Support for multiple programming languages:

Supports multiple programming languages. So earlier, programmers needed Web-Support: a


different editor for different languages, but it has built-in multi-language support. This also
means it easily detects if there’s any fault or cross-language reference, it’ll be able to detect it
easily.

• Intelli-Sense:

It can detect if any snippet of code is left incomplete. Also, common variable syntaxes and
variable declarations are made automatically. Ex: If a certain variable is being used in the
program and the user has forgotten to declare, intelli-sense will declare it for the user.

• Cross-Platform Support:

Traditionally, editors used to support either Windows or Linux or Mac Systems. But Visual
Studio Code is cross-platform. So it can work on all three platforms. Also, the code works on
all three platforms; else, the open-source and proprietary software codes used to be different.

• Extensions and Support:

Usually supports all the programming languages but, if the user/programmer wants to use the
programming language which is not supported then, he can download the extension and use it.
And performance-wise, the extension doesn’t slow down the editor as it rums as a different
process. • Repository: With the ever-increasing demand for the code, secure and timely storage
is equally important. It is connected with Git or can be connected with any other repository for
pulling or saving the instances.

• Web-Support:

Comes with built-in support for Web applications. So, web applications can be built and
supported in VSC.

• Hierarchy Structure:

The code files are located in files and folders. The required code files also have some files,
which may be required for other complex projects. These files can be deleted as per
convenience.

• Improving Code:

Some code snippets can be declared a bit differently, which might help the user in the code.
This function prompts the user, wherever necessary, to change it to the suggested option.

• Terminal Support:

Many of the times, the user needs to start from the root of the directory to start with a particular
action, in-built terminal or console provides user support to not to switch in-between two
screens for the same.

• Multi-Projects:

Multiple projects containing multiple files/folders can be opened simultaneously. These


projects/folders might or might not be related to each other.

• Git Support:

Resources can be pulled from Git Hub Repo online and vice-versa; saving can be done too.
Resource pulling also means cloning the code which is made available on the internet. This
code can later be changed and saved.

• Commenting: A common feature, but some of the languages do not support it. Commenting
on the code helps the user to recall or track according to the sequence he wants.
Advantages and Why should we use Visual Studio Code

There are many advantages over any other IDE; they are as follow:

1. Cross-platform support:

• Windows

• Linux

• Mac

2. Light-weight

3. Robust Architecture

4. Intelli-Sense

5. Freeware: Free of Cost- probably the best feature of all for all the programmers out there,
even more for the organizations.

6. Many users will use it or might have used it for desktop applications only, but it also provides
great tool support for Web Technologies like; HTML, CSS, JSON.

There are a few things that one can find a bit odd compared with so many features. It mainly
helps the front-end developers as compared with the back-end developers. But as per some
user’s opinions, it is equally helpful. It supports most of the languages used by most of the
programmers, but other languages might have to download, or extensions may have to be used
for them. Along with this common zoom-in, zoom-out brightness, theme selection features too
are made available.

Why do we need Visual Studio Code?

• Till recent times, there’s hardly been an IDE or code editor that has been so user friendly that
even first-time users can use each and every feature without any hassles.

• The coding-friendly feature and code error recognition also helps users a long way into
making the code more efficient and error-less
SYSTEM DESIGN

4.1 INTRODUCTION TO SYSTEM DESIGN

The system design controls the major structural characteristics of the system. It as a major
impact on the testability and modifiability of the system, and it affects its efficiency. Much of
the designing software is spent in creating the system design. In the first level of the design
process, the focus is on deciding which modules are needed for the system, the specification of
these modules, and how the modules should be interconnected.

This is called the system design or toplevel design. The design activity begins when the
requirement documents for the software to be developed is available. The goal of the design
process is to produce a model or representation of the system, which can be used later to bind
the system. The produced model is called design of the system.

A structured design is a top down approach to minimize complexity and make a problem
manageable by sub dividing it into smaller segments. The most creative and challenging phase
of the system development of life cycle is system design. The design phase is translation from
user oriented document to document oriented programmers.

4.2 PROBLEM STATEMENT OF THE PROPOSED SYSTEM

Below are the problems faced by the farmers these days:

1. Weather prediction

2. Yield prediction

3. Crop selection

Our project aims at minimizing these problems and looks forward to easing the activities of
the farmers.
4.3 OBJECTIVE OF THE APPLICATION

The objective of our project is to build a project which helps the farmers to carry out better
farming. Help the farmers to predict the weather and climatic changes. To enable easy
communication between the farmers

4.4 FLOWCHART

Figure 1 - Flowchart of the crop yield prediction

The above figure 1 - is the design of our project Crop yield predictor for better crop production.
4.5 DATASET DESCRIPTION

1. Crop Yield Dataset

This dataset comprises historical records of crop yields from various agricultural fields over
multiple years. It includes information on factors such as weather conditions, soil properties,
agricultural practices, and crop types. The primary objective of this dataset is to facilitate the
prediction of crop yields based on these factors, aiding farmers, researchers, and policymakers
in optimizing agricultural productivity and sustainability.

Features:

Crop Type: The type of crop grown in the field (e.g., wheat, corn, rice).

Field Characteristics:

Field Size: Area of the agricultural field (in hectares).

Data Source: The data is collected through various sources including agricultural research
institutions, government agencies, and agricultural surveys.

The Dataset has been Downloaded from Kaggle .

Kaggle : https://www.kaggle.com/code/charlessamuel/tamil-nadu-crop-production-eda-
analysis

Use Case: This dataset can be used for crop yield prediction, identifying the impact of different
factors on crop productivity, and optimizing agricultural practices for improved yields and
sustainability.

Yield Prediction Dataset

• State_Name
• District_Name
• Crop_Year
• Season
• Crop
• Area
• Production
2. Crop Prediction Dataset

This dataset contains information on various agricultural parameters and environmental factors
associated with the cultivation of different crops. The primary goal of this dataset is to facilitate
the prediction of suitable crops for a given region based on factors such as climate, soil
characteristics, and agronomic practices. It aims to assist farmers, agricultural researchers, and
policymakers in making informed decisions regarding crop selection and land use planning.

Crop Prediction Dataset

• State_Name
• District_Name
• Season
• Crop

Use Case: This dataset can be used for crop suitability mapping, recommending suitable crops
for specific regions, optimizing land use planning, and assessing the potential impact of climate
change on crop production.

3. Rainfall Dataset

This dataset comprises historical records of rainfall measurements from various meteorological
stations across different regions. It includes information on daily, monthly, or yearly
precipitation levels, providing insights into precipitation patterns, variability, and trends over
time. The dataset aims to support research, analysis, and applications related to hydrology,
climate studies, agriculture, water resource management, and weather forecasting.

Features:

Location: Geographic coordinates or identifiers of meteorological stations where rainfall


measurements were recorded.

Rainfall Measurement

• Monthly Rainfall: Total rainfall recorded in milli meters for a specific month.
• Yearly Rainfall: Total rainfall recorded in milli meters for a particular year.
Use Case: This dataset can be used for various purposes, including analysing long-term rainfall
trends, assessing seasonal variations in precipitation, studying the impact of climate change on
rainfall patterns, modelling hydrological processes, and supporting decision-making in
agriculture, water resource management, and disaster preparedness.

Rainfall Prediction Dataset

• SUBDIVISION
• YEAR
• JAN
• FEB
• MAR
• APR
• MAY
• JUN
• JUL
• AUG
• SEP
• OCT
• NOV
• DEC
• ANNUAL
• Jan-Feb
• Mar-May
• Jun-Sep
• Oct-Dec

Kaggle: https://www.kaggle.com/code/anbarivan/indian-rainfall-analysis-and-
prediction/input?select=rainfall+in+india+1901-2015.csv
4. Crop Recommendation Dataset

Description:

This dataset comprises agricultural parameters, environmental factors, and crop performance
data collected from various regions and farming practices. The primary objective of this dataset
is to facilitate the recommendation of suitable crops for specific agricultural conditions,
considering factors such as soil properties, climate conditions, and historical crop performance.
It aims to assist farmers, agricultural extension services, and policymakers in making informed
decisions regarding crop selection and land use planning to optimize productivity and
sustainability.

• Temperature: Average, minimum, and maximum temperature (in Celsius) during the
growing season.
• Humidity: Average relative humidity (as a percentage) during the growing season.
• pH Level: Soil pH level indicating acidity or alkalinity.
• Yearly Rainfall: Total rainfall recorded in milli meters for a particular year.
• Recommended Crops: Crops recommended based on the analysis of soil, climate, and
historical performance data.
• Nitrogen (N), Phosphorus (P), Potassium (K): Concentrations of major nutrients in the
soil (in parts per million or kilograms per hectare).

Use Case: This dataset can be used for crop recommendation systems, precision agriculture,
land use planning, and sustainable farming practices.

Crop Recommendation Dataset

• N
• P
• K
• Temperature
• Humidity
• pH
• Rainfall
• Label
5. Fertilizer Recommendation Dataset

This dataset comprises agricultural parameters, soil nutrient data, crop requirements, and
fertilizer application records collected from various farming systems and experimental
trials. The primary objective of this dataset is to support the recommendation of appropriate
fertilizer types and application rates for specific crops and soil conditions, aiming to
optimize crop productivity, nutrient use efficiency, and environmental sustainability. It
serves as a valuable resource for farmers, agronomists, and agricultural extension services
seeking guidance on effective fertilizer management practices.

Features:

• Nitrogen (N), Phosphorus (P), Potassium (K): Concentrations of major nutrients in the
soil (in parts per million or kilograms per hectare).
• pH Level: Soil pH level indicating acidity or alkalinity.
• Temperature: Average, minimum, and maximum temperature (in Celsius) during the
growing season.
• Humidity: Average relative humidity (as a percentage) during the growing season.
• Crop Type: The type of crop grown in the field (e.g., wheat, corn, rice).

Use Case: This dataset can be used to develop fertilizer recommendation models, decision
support systems for precision agriculture, and advisory tools for optimizing nutrient
management practices in crop production.

Fertilizer Recommendation Dataset

• Temperature
• Humidity
• Soil Moisture
• Soil Type
• Crop Type
• Nitrogen
• Phosphorous
• Potassium
• Fertilizer Name
4.6 MACHINE LEARNING ALGORITHMS :

1. DECISION TREES :

Decision trees are versatile machine learning algorithms used for both classification and
regression tasks. They mimic human decision-making processes by recursively partitioning the
data into subsets based on features’ values, creating a tree-like structure of decisions.

• Nodes: Represent specific features or attributes in the dataset.


• Edges: Connect nodes and denote the outcome of a decision.
• Root Node: The topmost node in the tree, representing the initial feature to split on.
• Internal Nodes: Nodes other than the root and leaf nodes; they represent features used
for further splits.
• Leaf Nodes: Terminal nodes that predict the outcome; they do not split further.

Construction of Decision Trees:

• Splitting Criteria: Decision trees split data based on the most informative features.
Common criteria include information gain, Gini impurity, or entropy.
• Recursive Splitting: The algorithm recursively splits data based on the selected criteria
until a stopping condition is met.
• Stopping Conditions: Include reaching a maximum tree depth, having nodes with pure
subsets, or reaching a minimum number of data points in a node.

Advantages of Decision Trees:

• Interpretability: Easily interpretable and visualizable, making them useful for


explaining decisions.
• Non-parametric: No assumptions about the underlying distribution of data, making
them versatile for different types of datasets.
• **Handle Mixed Data Types: Can handle both numerical and categorical data without
requiring feature scaling or transformation.
Applications of Decision Trees:

• Classification: Predicting categorical outcomes, such as class labels.


• Regression: Predicting continuous outcomes, such as house prices.
• Feature Selection: Identifying the most informative features in a dataset.
• Ensemble Methods: Used as base learners in ensemble methods like Random Forests

2. KNN

The k-Nearest neighbours (kNN) algorithm is a simple yet effective machine learning
technique used for classification and regression tasks. It operates on the principle of similarity,
where the prediction for a new data point is based on the majority class or average value of its
k nearest neighbors in the feature space.

1. Distance Metric: The choice of distance metric, such as Euclidean, Manhattan, or


Minkowski, determines the notion of similarity between data points.

2. k-Nearest Neighbours: The value of k specifies the number of nearest neighbours to consider
when making predictions. Typically, k is chosen empirically or through cross-validation.

3. Classification: For classification tasks, the majority class among the k nearest neighbours is
assigned to the new data point.

4. Regression: For regression tasks, the average (or weighted average) value of the target
variable among the k nearest neighbours is used as the prediction.

Construction of KNN:

1. Training Phase: In the training phase, the algorithm stores the feature vectors and
corresponding class labels or target values of the training dataset.

2. Prediction Phase: In the prediction phase, for each new data point, the algorithm calculates
the distances to all training data points and selects the k nearest neighbours.

3.Decision Rule: The decision rule determines the prediction based on the majority class
(classification) or average value (regression) of the k nearest neighbours.
3. NAÏVE BAYES GAUSSIAN :

The Naïve Bayes Gaussian algorithm is a probabilistic classification technique based on Bayes’
theorem with the assumption of Gaussian (normal) distribution of features. It’s particularly
useful for classification tasks involving continuous features. Despite its simplicity, Naïve
Bayes Gaussian often performs surprisingly well, especially with high-dimensional data.

1. Bayes’ Theorem:

A fundamental theorem in probability theory used for calculating conditional


probabilities. It states that the probability of a hypothesis given the observed evidence
is proportional to the probability of the evidence given the hypothesis, multiplied by the
prior probability of the hypothesis, and divided by the marginal probability of the
evidence.

2. Naïve Assumption:

The “naïve” assumption of Naïve Bayes is that features are conditionally independent
given the class label. This simplifies the computation, as it allows us to calculate the
joint probability of the features as the product of the individual conditional
probabilities.

3. Gaussian Distribution:

Naïve Bayes Gaussian assumes that the continuous features follow a Gaussian (normal)
distribution. This assumption simplifies the calculation of conditional probabilities and
makes the algorithm suitable for continuous data.
4.7 MODULES

There are 2 modules in our project, Prediction module, Recommendation module .

PREDICTION

CROP PREDICTION YEILD PREDICTION RAINFALL PREDICTION

Figure 2 - Prediction Module

1. Prediction module

Crop Prediction :

The crop prediction module employs machine learning algorithms to forecast crop yields and
production outcomes based on a multitude of factors including historical yield data, weather
patterns, soil conditions, and agronomic practices. By analysing these diverse datasets, the
module generates predictive models capable of estimating future crop yields, planting
schedules, and potential risks such as pest infestations or droughts. These predictions empower
farmers, policymakers, and agricultural stakeholders to make informed decisions regarding
crop selection, resource allocation, and adaptation strategies, ultimately enhancing agricultural
productivity, sustainability, and food security.

Yield Prediction :

The yield prediction module is a crucial component of agricultural decision support systems,
leveraging machine learning techniques to forecast crop yields based on various input factors
such as weather data, soil conditions, crop type, and management practices. By analysing
historical yield data and correlating it with environmental and agronomic variables, the module
generates predictive models capable of estimating future crop yields with a certain degree of
accuracy. These predictions enable farmers, agronomists, and policymakers to make informed
decisions regarding crop planning, resource allocation, and risk management, ultimately
improving productivity, sustainability, and profitability in agriculture.

Rainfall Prediction :

The rainfall prediction module utilizes statistical and machine learning models to forecast
future precipitation patterns based on historical weather data, atmospheric conditions, and
geographical factors. By analysing past rainfall records, satellite imagery, and atmospheric
pressure data, the module generates predictive models capable of estimating upcoming rainfall
amounts, timing, and spatial distribution. These predictions are invaluable for a wide range of
applications, including agriculture, water resource management, disaster preparedness, and
infrastructure planning. By providing early warnings and insights into potential weather-related
events, the rainfall prediction module helps stakeholders make informed decisions to mitigate
risks and maximize opportunities related to precipitation variability.

2. RECOMMENDATION MODULE :

RECOMMENDATION

CROP RECOMMENDATION FERTLIZER RECOMMENDATION

Figure 3 - Recommendation Module


Recommendation Module :

The crop recommendation module utilizes machine learning algorithms and agricultural
expertise to suggest suitable crop choices to farmers based on various factors such as soil type,
climate conditions, market demand, and agronomic practices. By analysing data on soil
characteristics, historical crop performance, climate patterns, and market trends, the module
generates personalized recommendations tailored to the specific needs and constraints of
individual farmers or agricultural regions. These recommendations empower farmers to make
informed decisions about crop selection, diversification, and rotation, ultimately optimizing
yields, profitability, and sustainability in agriculture while minimizing risks associated with
environmental variability and market fluctuations

Fertilizer Recommendation :

The fertilizer recommendation module utilizes soil nutrient analysis, crop nutrient
requirements, and agronomic best practices to suggest optimal fertilizer formulations and
application rates for specific crops and soil conditions. By analysing soil nutrient levels, crop
nutrient demands, and environmental factors, such as rainfall patterns and temperature, the
module generates personalized recommendations aimed at maximizing crop productivity while
minimizing nutrient wastage and environmental impact. These recommendations empower
farmers to make informed decisions about fertilizer management, ensuring efficient use of
resources and sustainable agricultural practices, ultimately leading to improved yields,
profitability, and soil health
METHODOLOGY OF THE SYSTEM

5.1 EXISTING SYSTEM

• In our research, which we found in the previous research papers is that everyone uses
climatic factors like rainfall, sunlight and agricultural factors like soil type, nutrients
possessed by the soil (Nitrogen, Potassium, etc.)
• But the problem is we need to gather the data and then a third party does this prediction
and then it is explained to the farmer and this takes a lot of effort for the farmer and he
doesn’t understand the science behind these factors.
• Machine Learning Projects: These projects utilize machine learning algorithms to
analyze historical agricultural data and predict crop yields. Python libraries like Scikit-
Learn and TensorFlow are commonly used for building predictive models. These
models can take into account various factors such as weather conditions, soil quality,
and crop characteristics to make accurate predictions .
• Web Applications: Platforms like GitHub host web applications specifically designed
for crop yield prediction. These applications typically utilize historical data to provide
insights into future crop harvests. Users can access these platforms to analyze crop yield
trends, perform data visualization, and make informed decisions about agricultural
practices .
• Flask Deployment: Some systems deploy crop yield prediction models using Flask, a
Python web framework. Flask allows developers to create web services that can be
easily accessed and integrated into agricultural practices. This deployment method
enables farmers and agricultural professionals to conveniently access crop yield
predictions and make real-time decisions .
• Visualization Tools: Python is used to develop visualization and prediction tools for
analysing crop production data. These tools enable users to visualize historical trends
in crop yield, weather patterns, and other relevant factors. By understanding these
trends, stakeholders can make informed decisions about crop management and resource
allocation.
• These systems collectively contribute to enhancing agricultural productivity and
sustainability by providing valuable insights into crop yield prediction.
5.2 PROPOSED SYSTEM

• The proposed system for crop yield prediction using Python integrates various
components and methodologies to provide accurate predictions and valuable insights
for agricultural decision-making. Here's a deeper explanation of each aspect:
• -Data Collection and Pre processing: The system gathers diverse datasets containing
information on weather conditions, soil quality, historical crop yields, and other
relevant environmental factors. These datasets undergo pre processing steps such as
cleaning, normalization, and feature engineering to ensure data quality and relevance to
the prediction models.
• Machine Learning Models: Utilizing Python libraries like Scikit-Learn, TensorFlow, or
PyTorch, the system employs machine learning algorithms such as regression, decision
trees, or neural networks to build predictive models. These models analyze the pre
processed data to forecast future crop yields based on historical patterns and
environmental variables .
• Flask Deployment: To make the predictive models accessible to end-users, the system
utilizes Flask, a lightweight Python web framework. Flask allows for easy deployment
of machine learning models as RESTful APIs, enabling integration into web
applications or other systems .
• Visualization Tools: Python's visualization libraries such as Matplotlib, Seaborn, or
Plotly are employed to create intuitive visualizations of the predicted crop yields. These
visualizations aid stakeholders in understanding the trends, patterns, and potential risk
factors affecting crop production .
• Continuous Improvement: The system incorporates mechanisms for continuous
learning and improvement. It regularly updates its models with new data, adjusts
parameters based on feedback, and explores advanced techniques to enhance prediction
accuracy and reliability over time.
• By integrating these components, the proposed system aims to empower farmers,
agricultural researchers, and policymakers with actionable insights to optimize crop
production, mitigate risks, and improve food security.
5.3 STEPS IN METHODOLOGY

Figure 4 - Methodology

The methodology of developing and deploying a machine learning model, which typically
involves the following steps: data acquisition and pre processing, model development, model
training, model testing, and deployment

1. Data Acquisition and Pre - processing:

• Identify the problem statement and the type of data required to solve it.

• Collect the necessary data from various sources such as datasets

• Clean the data by removing any irrelevant or inconsistent entries, handling missing
values, and dealing with outliers.

• Pre process the data by performing tasks like normalization, feature scaling, feature
engineering, and encoding categorical variables.

2. Model Development:

• Choose an appropriate machine learning algorithm or a combination of algorithms based on


the problem type (classification, regression, clustering, etc.) and the nature of the data.
• Split the pre processed data into training and validation sets. The training set is used
to train the model, and the validation set is used to tune its parameters and evaluate
performance during development.

• Define the model architecture or structure, including the number and type of layers
(in the case of neural networks) or the configuration of the algorithm.

• Set hyperparameters, such as learning rate, regularization strength, and batch size,
which control the learning process.

• Implement the model using a suitable programming language or a machine learning


library/framework

3. Model Training:

• Feed the training data into the model and use an optimization algorithm (e.g., gradient
descent) to update the model's parameters iteratively.

• Monitor the model's performance on the validation set during training to detect
overfitting or underfitting and adjust hyperparameters accordingly.

• Continue training until the model achieves satisfactory performance on the validation
sector converges to a stable state.

4. Model Testing:

• Once training is complete, evaluate the trained model's performance on a separate,


unseen test dataset.

• Calculate various evaluation metrics (accuracy, precision, recall, F1 score, etc.) to


measure the model's performance and assess its suitability for the problem at hand.

• Analyse the model's performance and make any necessary adjustments or


improvements based on the evaluation results.
5. Deployment:

• Prepare the model for deployment by packaging it in a format suitable for the chosen
deployment environment (e.g., a serialized model file or a containerized application).

• Integrate the model into the target system, which may involve writing code to handle
input/output, data pre processing, and interacting with other components of the system.

• Test the deployed model thoroughly to ensure it functions correctly in the production
environment.

• Monitor the model's performance and collect feedback from real-world usage to
continuously improve and update the model if necessary.

5.4 METHODOLOGY - PREPROCESSING:

Figure 5 - Methodology-preprocessing

The pre processing step in machine learning involves several important tasks to prepare the
data for model training. Let's break down each task:

1. Acquiring Dataset:

• Determine the data sources that are relevant to your problem statement.

• Gather the required data from these sources, such as databases, APIs, or web scraping.
• Ensure that the collected data is in a structured format, such as CSV, JSON, or a
database table.

2. Handling Missing Values:

• Identify any missing values in the dataset, represented as NaN (Not a Number) or null
values.

• Decide on an appropriate strategy to handle missing values based on the nature of the
data and the missing data patterns.

• Some common strategies include:

➢ Removing the rows or columns with missing values if they are few and the loss of
information is acceptable.
➢ Imputing the missing values by filling them with a statistical measure like the mean,
median, or mode of the respective feature.
➢ Using more advanced imputation techniques such as regression or machine learning
algorithms to predict missing values.

3. Handling Outliers:

• Detect and handle outliers, which are data points that significantly deviate from the
normal range or distribution of the dataset.

• Visualize the data using techniques like box plots or scatter plots to identify potential
outliers.

• Decide on an appropriate strategy based on the nature of the data and the specific
problem:

➢ Removing outliers if they are due to data entry errors or measurement issues and have a
significant impact on the analysis.
➢ Transforming the data using techniques like log transformation or fissurization to reduce
the impact of outliers.
➢ Applying robust statistical techniques or algorithms that are less sensitive to outliers.

4. Feature Scaling:

• Normalize or scale the features in the dataset to ensure that they are on a similar scale and
have comparable ranges.

• Common techniques for feature scaling include:

➢ Standardization(Z-score normalization): Transforming the data to have zero mean and


unit variance.
➢ Min-max scaling: Scaling the data to a specific range, typically between 0 and 1.
➢ Robust scaling: Scaling the data using statistical measures that are more resistant to
outliers.

• Feature scaling is important to prevent features with larger magnitudes from dominating
the learning process and to enable algorithms to converge faster.

5. Pre processed Dataset:

• After completing the above steps, you will have a pre processed dataset ready for model
training.

• This dataset should be cleaned, with missing values handled, outliers managed, and
features appropriately scaled.

• It is advisable to save the pre processed dataset separately for future reference and to
ensure consistency during model development.
SOURCE CODE

6.1 YEILD PREDICTION

Yield Prediction.py

import pandas as pd

import numpy as np

import json

import sys

from sklearn.ensemble import RandomForestRegressor

from sklearn.model_selection import train_test_split

from sklearn.preprocessing import OneHotEncoder

# Load the dataset

df = pd.read_csv("ML/yield_prediction/Tamilnadu agriculture yield data.csv")

# Drop the Crop_Year column

df = df.drop(['Crop_Year'], axis=1)

# Separate the features and target variables

X = df.drop(['Production'], axis=1)

y = df['Production']

# Split the data into training and testing sets


X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)

# Categorical columns for one-hot encoding

categorical_cols = ['State_Name', 'District_Name', 'Season', 'Crop']

# One-hot encode the categorical columns

ohe = OneHotEncoder(handle_unknown='ignore')

ohe.fit(X_train[categorical_cols])

# Convert categorical columns to one-hot encoding

X_train_categorical = ohe.transform(X_train[categorical_cols])

X_test_categorical = ohe.transform(X_test[categorical_cols])

# Combine the one-hot encoded categorical columns and numerical columns

X_train_final = np.hstack((X_train_categorical.toarray(), X_train.drop(categorical_cols,


axis=1)))

X_test_final = np.hstack((X_test_categorical.toarray(), X_test.drop(categorical_cols,


axis=1)))

# Train the model

model = RandomForestRegressor(n_estimators=100, random_state=42)

model.fit(X_train_final, y_train)
# Get the input parameters as command line arguments

Jstate = sys.argv[1]

Jdistrict = sys.argv[2]

Jseason = sys.argv[3]

Jcrops = sys.argv[4]

Jarea = sys.argv[5]

#Get the user inputs and store them in a numpy array - ans is 427.64

#user_input = np.array([['Karnataka', 'BAGALKOT', 'Kharif', 'Rice', 197]])

user_input = np.array([[Jstate,Jdistrict,Jseason,Jcrops,Jarea]])

# Convert the categorical columns to one-hot encoding

user_input_categorical = ohe.transform(user_input[:, :4])

# Combine the one-hot encoded categorical columns and numerical columns

user_input_final = np.hstack((user_input_categorical.toarray(), user_input[:,


4:].astype(float)))

# Make the prediction

prediction = model.predict(user_input_final)

# Return the prediction as a string

print(str(prediction[0]))
6.2 CROP PREDICITON

ZDecision_Tree_Model.py

#!/usr/bin/env python

# coding: utf-8

# In[1]:

import pandas as pd

import numpy as np

import matplotlib.pyplot as plt

from collections import Counter

# In[2]:

data = pd.read_csv('preprocessed2.csv')

# In[3]:

data.head()

# In[4]:

data['Season'] = data['Season'].str.rstrip()

# In[5]:

for i in data['Season']:

print(len(i))

# In[6]:

list(data)

# In[7]:

del data['Unnamed: 0']


# In[8]:

training_data = list(np.array(data))

# In[9]:

testing_data = training_data[100:120] #taking rows from 100 to 200

# In[10]:

header = ['State_Name', 'District_Name', 'Season', 'Crop']

# In[11]:

def unique_vals(Data,col):

return set([row[col] for row in Data]

# In[12]:

def class_counts(Data):

counts= {}

for row in Data:

label =row[-1]

if label not in counts:

counts[label] = 0

counts[label] += 1

return counts

# In[13]:

class_counts(training_data)

# In[14]:

class Question:
def __init__(self,column,value):

self.column =column

self.value=value

def match(self,example):

val = example[self.column]

return val == self.value

def match2(self,example):

if example == 'True' or example == 'true' or example == '1':

return True

else:

return False

def __repr__(self):

return "Is %s %s %s?" %(

header[self.column],"==",str(self.value))

# In[15]:

Question(0,'Bihar')

# In[16]:

def partition(Data,question):

true_rows,false_rows = [],[]

for row in Data:

if(question.match(row)):
true_rows.append(row)

else:

false_rows.append(row)

return true_rows,false_rows

# In[17]:

def gini(Data):

counts = class_counts(Data)

impurity = 1

for lbl in counts:

prob_of_lbl = counts[lbl]/float(len(Data))

impurity-=prob_of_lbl**2

return impurity

# In[18]:

def info_gain(left,right,current_uncertainity):

p = float(len(left))/(len(left)+len(right))

return current_uncertainity - p*gini(left) - (1-p)*gini(right)

# In[19]:

def find_best_split(Data):

best_gain = 0

best_question = None
current_uncertainity = gini(Data)

n_features = len(Data[0]) - 1

for col in range(n_features):

values = unique_vals(Data,col)

for val in values:

question = Question(col,val)

true_rows,false_rows = partition(Data,question)

if(len(true_rows) == 0 or len(false_rows) == 0 ):

continue

gain = info_gain(true_rows,false_rows,current_uncertainity)

if gain>best_gain:

best_gain ,best_question =gain,question

return best_gain,best_question

# In[20]:

class Leaf:

def __init__(self,Data):

self.predictions = class_counts(Data)

# In[21]

class Decision_Node:

def __init__(self,question,true_branch,false_branch):

self.question=question
self.true_branch = true_branch

self.false_branch = false_branch

# In[22]:

def build_tree(Data,i=0):

gain, question = find_best_split(Data)

if gain == 0 : #Contains same data

return Leaf(Data)

true_rows,false_rows =partition(Data,question)

true_branch = build_tree(true_rows,i)

false_branch = build_tree(false_rows,i)

return Decision_Node(question,true_branch,false_branch)

# In[23]:

my_tree = build_tree(training_data)

print(my_tree)

# In[24]:

def print_tree(node,spacing=""):

if isinstance(node,Leaf):

print(spacing + "Predict",node.predictions)

return

print(spacing+str(node.question))
print(spacing + "--> True:")

print_tree(node.true_branch,spacing + " ")

print(spacing + "--> False:")

print_tree(node.false_branch,spacing + " ")

# In[25]:

print_tree(my_tree)

# In[26]

def print_leaf(counts):

total = sum(counts.values())*1.0

probs = {}

for lbl in counts.keys():

probs[lbl] =str(int(counts[lbl]/total * 100)) + "%"

return probs

# In[27]:

def classify(row,node):

if is instance(node,Leaf):

return node.predictions

if node.question.match(row):
return classify(row,node.true_branch)

else:

return classify(row,node.false_branch)

# In[28]:

from sklearn.externals import joblib

# Save the model as a pickle in a file

joblib.dump(my_tree, 'filetest2.pkl')

ZDecision_Tree_Model_Call.py

import pandas as pd

import numpy as np

import matplotlib.pyplot as plt

import joblib

from collections import Counter

import cgitb

cgitb.enable()

import sys

header = ['State_Name', 'District_Name', 'Season', 'Crop']

class Question:
def __init__(self,column,value):

self.column =column

self.value=value

def match(self,example):

val = example[self.column]

return val == self.value

def match2(self,example):

if example == 'True' or example == 'true' or example == '1':

return True

else:

return False

def __repr__(self):

return "Is %s %s %s?" %(

header[self.column],"==",str(self.value))

def class_counts(Data):

counts= {}

for row in Data:

label =row[-1]

if label not in counts:

counts[label] = 0

counts[label] += 1

return counts
class Leaf:

def __init__(self,Data):

self.predictions = class_counts(Data)

class Decision_Node:

def __init__(self,question,true_branch,false_branch):

self.question=question

self.true_branch = true_branch

self.false_branch = false_branch

def print_tree(node,spacing=""):

if isinstance(node,Leaf):

print(spacing + "Predict",node.predictions)

return

print(spacing+str(node.question))

print(spacing + "--> True:")

print_tree(node.true_branch,spacing + " ")

print(spacing + "--> False:")

print_tree(node.false_branch,spacing + " ")

def print_leaf(counts):
total = sum(counts.values())*1.0

probs = {}

for lbl in counts.keys():

probs[lbl] =str(int(counts[lbl]/total * 100)) + "%"

return probs

def classify(row,node):

if isinstance(node,Leaf):

return node.predictions

if node.question.match(row):

return classify(row,node.true_branch)

else:

return classify(row,node.false_branch)

dt_model_final= joblib.load('ML/crop_prediction/filetest2.pkl')

state =sys.argv[1]

district=sys.argv[2]

season=sys.argv[3

testing_data = [[state,district,season]]

for row in testing_data:

#print("Actual: %s. Predicted: %s" % (row[-1],print_leaf(classify(row,dt_model_final))))

Predict_dict = (print_leaf(classify(row,dt_model_final))).copy()
for key, value in Predict_dict.items() :

print (key)

print (" , ")

6.3 RAINFALL PREDICTION

rainfall_prediction.py

import pandas as pd

import sys

# Load the dataset into a dataframe

df = pd.read_csv('ML/rainfall_prediction/rainfall_in_india_1901-2015.csv')

# Define a function to predict rainfall for a given district and month

def predict_rainfall(state, month):

# Filter the dataframe to only include rows with the given district

state_data = df[df['SUBDIVISION'] == state]

# Calculate the average rainfall for the given month across all the years

avg_rainfall = state_data[month].mean()

# Return the predicted rainfall for the given month

return avg_rainfall
# Get the input parameters as command line arguments

Jregion = sys.argv[1]

Jmonth = sys.argv[2]

#predicted_rainfall = predict_rainfall('ANDAMAN & NICOBAR ISLANDS', 'JAN')

predicted_rainfall = predict_rainfall(Jregion, Jmonth)

print(predicted_rainfall)

6.4 CROP RECOMMENDATION

Recommend.py

import pandas as pd

import numpy as np

import json

import sys

# Get the input parameters as command line arguments

jsonn = sys.argv[1]

jsonp = sys.argv[2]

jsonk = sys.argv[3]

jsont = sys.argv[4]

jsonh = sys.argv[5]
jsonph = sys.argv[6]

jsonr = sys.argv[7]

# Parse the JSON strings into Python objects

n_params = json.loads(jsonn)

p_params = json.loads(jsonp)

k_params = json.loads(jsonk)

t_params = json.loads(jsont)

h_params = json.loads(jsonh)

ph_params = json.loads(jsonph)

r_params = json.loads(jsonr)

#Read the dataset

dataset = pd.read_csv('ML/crop_recommendation/Crop_recommendation.csv')

#Divide the dataset into features and labels

X = dataset.iloc[:, :-1].values

y = dataset.iloc[:, -1].values

#Split the dataset into training and test sets

from sklearn.model_selection import train_test_split

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.2, random_state = 0)


#Train the model using the Random Forest Classifier algorithm

from sklearn.ensemble import RandomForestClassifier

classifier = RandomForestClassifier(n_estimators = 10, criterion = 'entropy', random_state =


0)

classifier.fit(X_train, y_train)

#Get the user inputs and store them in a numpy array

#user_input = np.array([[90,42,43,21,82,6.5,203]]) - ans is rice.

user_input =
np.array([[n_params,p_params,k_params,t_params,h_params,ph_params,r_params]])

#Make predictions using the trained model

predictions = classifier.predict(user_input)

#Print the predicted crop

print(str(predictions[0]))

6.5 FERTILIZER_RECOMMENDATION

fertilizer_recommendation.py

import pandas as pd

import sys

from sklearn.preprocessing import LabelEncoder

from sklearn.tree import DecisionTreeClassifier


# Load the dataset

data = pd.read_csv("ML/fertilizer_recommendation/fertilizer_recommendation.csv")

# Label encoding for categorical features

le_soil = LabelEncoder()

data['Soil Type'] = le_soil.fit_transform(data['Soil Type'])

le_crop = LabelEncoder()

data['Crop Type'] = le_crop.fit_transform(data['Crop Type'])

# Splitting the data into input and output variables

X = data.iloc[:, :8]

y = data.iloc[:, -1]

# Training the Decision Tree Classifier model

dtc = DecisionTreeClassifier(random_state=0)

dtc.fit(X, y)

# Get the input parameters as command line arguments

jsonn = sys.argv[1]

jsonp = sys.argv[2]

jsonk = sys.argv[3]

jsont = sys.argv[4]
jsonh = sys.argv[5]

jsonsm = sys.argv[6]

jsonsoil = sys.argv[7]

jsoncrop = sys.argv[8]

soil_enc = le_soil.transform([jsonsoil])[0]

crop_enc = le_crop.transform([jsoncrop])[0]

# Get the user inputs and store them in a numpy array - Urea

#user_input = [[26,52,38,'Sandy','Maize',37,0,0]]

user_input = [[jsont,jsonh,jsonsm,soil_enc,crop_enc,jsonn,jsonk,jsonp]]

fertilizer_name = dtc.predict(user_input)

# Return the prediction as a string

print(str(fertilizer_name[0]))
6.6 PHP SOURCES

Index.php

<!DOCTYPE html>

<html>

<?php include ('header.php'); ?>

<body class="bg-white" id="top">

<?php include ('nav.php'); ?>

<div class="wrapper" >

<div class="wrapper">

<header class="jumbotron bg-gradient-warning">

<div class="container">

<div class="row row-header">

<div class="col-12 col-sm-7">

<h1 class="text-white">Crop </h1>

<p class="text-white">

A True Farmer's Friend.

</p>

<div class="cg">

<div class="card card-body bg-gradient-success">

<blockquote cite="blockquote">

<h6 class="mb-0 text-dark">

<em
><b

> “Farming looks mighty easy when your plow is a pencil, and you're a
thousand miles from the corn field..”</b

></em>

</h6>

<br />

<footer class="blockquote-footer vg text-dark">

DWIGHT D. EISENHOWER

</footer>

</blockquote>

</div>

</div>

</div>

<div class="col-12 col-sm-3 offset-sm-2 align-self-center">

<img src="assets/img/plant-bulb.png" class="img-fluid" alt="" />

</div>

</div>

</div>

</header>

<!-- Page Content -->

<!--
==================================================================
==================================================================
==== -->
<div class="section features-6 text-dark bg-white" id="services">

<div class="container ">

<div class="row">

<div class="col-md-8 mx-auto text-center">

<span class="badge badge-primary badge-pill mb-3">Insight</span>

<h3 class="display-3 ">Features</h3>

</div>

</div>

<br>

<div class="row align-items-center">

<div class="col-lg-6">

<div class="info info-horizontal info-hover-success">

<div class="description pl-4">

<h3 class="title" >Farmers</h3>

<p class=" ">Farmers can get recommendations for crop and fertilizer and even

predictions for crop, yield and rainfall. All these are implemented using ML with
proper dataset. </p>

</div>

</div>

</div>

<div class="col-lg-6 col-10 mx-md-auto d-none d-md-block">

<img class="ml-lg-5 pull-right" src="assets/img/agri.png" width="100%">

</div>
</div>

</div>

</div>

<!--
==================================================================
==================================================================
==== -->

<div class="section features-2 text-dark bg-white" id="features">

<div class="container">

<div class="row align-items-center">

<div class="col-lg-5 col-md-8 mr-auto text-left">

<div class="pr-md-5">

<div class="icon icon-lg icon-shape icon-shape-primary shadow rounded-circle


mb-5"> <i class="ni ni-favourite-28"> </i></div>

<h3 class="display-3 text-justify">Features</h3>

<p>The time is now for the next step in farming. We bring you the future of
farming along with great tools for asisting the farmers.</p>

<ul class="list-unstyled mt-5">

<li class="py-2">

<div class="d-flex align-items-center">

<div>

<div class="badge badge-circle badge-primary mr-3"> <i class="ni ni-


settings-gear-65"> </i></div>

</div>

<div>
<h6 class="mb-0">Crop Prediction and Recommendation</h6>

</div>

</div>

</li>

<li class="py-2">

<div class="d-flex align-items-center">

<div>

<div class="badge badge-circle badge-primary mr-3"> <i class="ni ni-html5">


</i></div>

</div>

<div>

<h6 class="mb-0">Fertilizer Recommendation</h6>

</div>

</div>

</li>

<li class="py-2">

<div class="d-flex align-items-center">

<div>

<div class="badge badge-circle badge-primary mr-3"> <i class="ni ni-


settings-gear-65"> </i></div>

</div>

<div>

<h6 class="mb-0">yield Prediction</h6>


</div>

</div>

</li>

<li class="py-2">

<div class="d-flex align-items-center">

<div>

<div class="badge badge-circle badge-primary mr-3"> <i class="ni ni-


satisfied"> </i></div>

</div>

<div>

<h6 class="mb-0">Rainfall Prediction</h6>

</div>

</div>

</li>

</ul>

</div>

</div>

<div class="col-lg-7 col-md-12 pl-md-0">

<img class="img-fluid ml-lg-5" src="assets/img/features.png" width="100%">

</div>

</div>

</div>

<span > </span>


</div>

<!--
==================================================================
==================================================================
==== -->

<div class="section features-6 text-dark bg-white" id="tech">

<div class="container-fluid shado">

<div class="row">

<div class="col-md-8 mx-auto text-center">

<span class="badge badge-primary badge-pill mb-3">stack</span>

<h3 class="display-3 ">Technologies Used</h3>

<p class="" >Our Development Stack</p>

</div>

</div>

<div class="row text-lg-center align-self-center">

<div class="col-md-4">

<div class="info">

<img class=" img-fluid" src="assets/img/html.png" alt="HTML5">

<h6 class="info-title text-uppercase text-primary">HTML5</h6>

</div>

</div>

<div class="col-md-4">

<div class="info">
<img class=" img-fluid" src="assets/img/css3.png" alt="CSS3">

<h6 class="info-title text-uppercase text-primary">CSS3</h6>

</div>

</div>

<div class="col-md-4">

<div class="info">

<img class=" img-fluid" src="assets/img/js.png" alt="JavaScript">

<h6 class="info-title text-uppercase text-primary">JavaScript</h6>

</div>

</div>

</div>

<div class="row text-center ">

<div class="col-md-4 d-none d-md-block">

<div class="info">

<img class=" img-fluid" src="assets/img/bootstrap.png" alt="BootStrap4">

<h6 class="info-title text-uppercase text-primary">BootStrap4</h6>

</div>

</div>

<div class="col-md-4 d-none d-md-block">

<div class="info">

<img class=" img-fluid" src="assets/img/apache.png" alt="Apache">

<h6 class="info-title text-uppercase text-primary">Apache</h6>

</div>
</div>

<div class="col-md-4 d-none d-md-block">

<div class="info">

<img class=" img-fluid" src="assets/img/mysql.png" alt="MySQL">

<h6 class="info-title text-uppercase text-primary">MySQL</h6>

</div>

</div>

</div

</div>

</div>

</body>

</html>

header.php

<head>

<meta charset="utf-8">

<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

<link rel="icon" type="image/png" href="assets/img/logo.png" />

<title>Crop Management System</title>

<!-- Fonts and icons -->

<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-
ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
crossorigin="anonymous">

<link rel="stylesheet"
href="https://pro.fontawesome.com/releases/v5.10.0/css/all.css"

integrity="sha384-
AYmEC3Yw5cVb3ZcuHtOA93w35dYTsvhLPVnYs9eStHfGJvOvKxVfELGroGkvsg+p"
crossorigin="anonymous"/>

<link rel="stylesheet" href=" https://cdnjs.cloudflare.com/ajax/libs/bootstrap-


social/5.1.1/bootstrap-social.min.css "/>

<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700"
rel="stylesheet">

<link href="https://use.fontawesome.com/releases/v5.0.6/css/all.css" rel="stylesheet">

<!-- Nucleo Icons -->

<link href="assets/css/nucleo-icons.css" rel="stylesheet" />

<link href="assets/css/nucleo-svg.css" rel="stylesheet" />

<!-- Data Tables -->

<link rel="stylesheet" type="text/css"


href="https://cdn.datatables.net/1.12.1/css/jquery.dataTables.css">

<link rel="stylesheet" href="assets/css/creativetim.min.css" type="text/css">

<script src="assets/js/state_district_crops_dropdown.js"></script>

</head>

footer.php

<footer class="footer">
<div class="container">

<div class="row">

<div class="col-4 col-md-2 align-self-center">

<img class="align-text-center img-fluid" src="assets/img/footer-logo.png" />

</div>

<div class="offset-sm-2 col-5 ">

<h5>Our Address</h5>

<address>

No-5 Jeyaraman Street Pallavanthangal <br>

Chennai – 600114 <br>

<div class="btn-group text-center" role="group">

<a role="button" class="btn btn-primary" href="tel:+919448936339"><i


class="fa fa-phone"></i> Call</a>

<a role="button" class="btn btn-info" href="tel:+918233294006"> <i class="fa


fa-fax"></i> Fax</a>

<a role="button" class="btn btn-success" href="mailto:info@sode-edu.in"> <i


class="fa fa-envelope-o"></i> Email</a>

</div>

</address>

</div>

<div class="col-12 col-md-3 align-self-center">

<div class="social-network text-center">

<button target="_blank" href="/" rel="nofollow" class="btn btn-icon-only btn-linkedin


rounded-circle" data-toggle="tooltip" data-original-title="Mail Us">

<span class="btn-inner--icon"><i class="fas fa-envelope"></i></span>

</button>

<button target="_blank" href="/" rel="nofollow" class="btn btn-icon-only btn-twitter


rounded-circle" data-toggle="tooltip" data-original-title="Follow us">
<span class="btn-inner--icon"><i class="fab fa-twitter"></i></span>

</button>

<button target="_blank" href="/" rel="nofollow" class="btn-icon-only rounded-circle


btn btn-facebook" data-toggle="tooltip" data-original-title="Like us">

<span class="btn-inner--icon"><i class="fab fa-facebook"></i></span>

</button>

<button target="_blank" href="/" rel="nofollow" class="btn btn-icon-only btn-


instagram rounded-circle" data-toggle="tooltip" data-original-title="Follow us">

<span class="btn-inner--icon"><i class="fab fa-instagram "></i></span>

</button>

<button target="_blank" href="/" rel="nofollow" class="btn btn-icon-only btn-github


rounded-circle" data-toggle="tooltip" data-original-title="Star on Github">

<span class="btn-inner--icon"><i class="fab fa-github"></i></span>

</button>

</div>

</div>

</div>

<hr>

<div class="row justify-content- center">

<div class="col-auto">

<p>&copy; Copyright 2024 Crop Yield Prediction, All Rights Reserved </p>

</div>

</div>

</div>

</footer>

<script src="https://cdn.staticfile.org/jquery/3.6.3/jquery.min.js"></script

<script type="text/javascript" charset="utf8"


src="https://cdn.datatables.net/1.12.1/js/jquery.dataTables.js"></script>
<script src="https://cdn.staticfile.org/markdown-it/13.0.1/markdown-it.min.js"></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"

integrity="sha384-
UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1"
crossorigin="anonymous"></script>

<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"

integrity="sha384-
JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"
crossorigin="anonymous"></script>

<script src="https://use.fontawesome.com/ee1c3da296.js"></script>

nav.php
<nav

id="navbar-main"

class="

navbar navbar-main navbar-expand-lg

bg-default

navbar-light

position-sticky

top-0

shadow

py-0

“>

<div class="container-fluid">

<ul class="navbar-nav navbar-nav-hover align-items-lg-center">


<li class="nav-item dropdown">

<a href="index.php" class="navbar-brand mr-lg-5 text-white">

<img src="assets/img/nav.png" />

</a>

</li>

</ul>

<button

class="navbar-toggler bg-white"

type="button"

data-toggle="collapse"

data-target="#navbar_global"

aria-controls="navbar_global"

aria-expanded="false"

aria-label="Toggle navigation">

<span class="navbar-toggler-icon text-white"></span>

</button>

<div class="navbar-collapse collapse bg-default" id="navbar_global">

<div class="navbar-collapse-header">

<div class="row">

<div class="col-10 collapse-brand">

<a href="index.html">

<img src="assets/img/nav.png" />

</a>

</div>

<div class="col-2 collapse-close bg-danger">

<button

type="button"
class="navbar-toggler"

data-toggle="collapse"

data-target="#navbar_global"

aria-controls="navbar_global"

aria-expanded="false"

aria-label="Toggle navigation">

<span></span>

<span></span>

</button>

</div>

</div>

</div>

<ul class="navbar-nav align-items-lg-center ml-auto topnav" id="nav">

<li class="nav-item" id="prediction">

<div class="dropdown show ">

<a class="nav-link dropdown-toggle text-white " href="#" role="button"


id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-
expanded="false">

<span class="text-white nav-link-inner--text">

<i class="text-white fas fa-magic"></i> Prediction</span>

</a>

<div class="dropdown-menu" aria-labelledby="dropdownMenuLink">

<a class="dropdown-item" href="crop_prediction.php">Crop Prediction</a>

<a class="dropdown-item" href="yield_prediction.php">Yield Prediction</a>

<a class="dropdown-item" href="rainfall_prediction.php">Rainfall Prediction</a>

</div>

</div>

</li>
<li class="nav-item" id="recommendation">

<div class="dropdown show ">

<a class="nav-link dropdown-toggle text-white " href="#" role="button"


id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-
expanded="false">

<span class="text-white nav-link-inner--text">

<i class="text-white fas fa-gavel"></i> Recommendation</span>

</a>

<div class="dropdown-menu" aria-labelledby="dropdownMenuLink">

<a class="dropdown-item" href="crop_recommendation.php">Crop


Recommendation</a>

<a class="dropdown-item"
href="fertilizer_recommendation.php">Fertilizer Recommendation</a>

</div>

</div>

</li>

</ul>

</div>

</div>

</nav>

<style>

.topnav a {

border-bottom: 3px solid transparent;

.topnav a:hover {

border-bottom: 3px solid red;

opnav a.activa {
border-bottom: 3px solid red;

</style>

<script>

$("#nav li a").each(function() {

if (this.href == window.location.href) {

$(this).addClass("activaa");

});

</script>

crop_prediction.php

<!DOCTYPE html>

<html>

<?php include ('header.php'); ?>

<body class="bg-white" id="top">

<?php include ('nav.php'); ?>

<section class="section section-shaped section-lg">

<div class="shape shape-style-1 shape-primary">

<span></span>

<span></span>

<span></span>

<span></span>

<span></span>

<span></span>

<span></span>

<span></span>
<span></span>

<span></span>

</div>

<!--
==================================================================
==================================================================
==== -->

<div class="container ">

<div class="row">

<div class="col-md-8 mx-auto text-center">

<span class="badge badge-danger badge-pill mb-3">Prediction</span>

</div>

</div>

<div class="row row-content">

<div class="col-md-12 mb-3">

<div class="card text-white bg-gradient-success mb-3">

<div class="card-header">

<span class=" text-success display-4" > Crop Prediction </span>

</div>

<div class="card-body text-dark">

<form role="form" action="#" method="post" >

<table class="table table-striped table-hover table-bordered bg-gradient-white text-


center display" id="myTable">

<thead>

<tr class="font-weight-bold text-default">


<th><center> State</center></th>

<th><center>District</center></th>

<th><center>Season</center></th>

<th><center>Prediction</center></th>

</tr>

</thead>

<tbody>

<tr class="text-center">

<td>

<div class="form-group">

<select onchange="print_city('state', this.selectedIndex);" id="sts"


name ="stt" class="form-control" required></select>

<script language="javascript">print_state("sts");</script>

</div>

</td>

<td>

<div class="form-group ">

<select id ="state" name="district" class="form-control"


required>

<option value="">Select District</option>

</select>

<script language="javascript">print_state("sts");</script>

</div>

</td>

<td>

<div class="form-group ">

<select name="Season" class="form-control">


<option value="">Select Season ...</option>

<option name="Kharif" value="Kharif">Kharif</option>

<option name="Whole Year" value="Whole Year">Whole


Year</option>

<option name="Autumn"
value="Autumn">Autumn</option>

<option name="Rabi" value="Rabi">Rabi</option>

<option name="Summer"
value="Summer">Summer</option>

<option name="Winter" value="Winter">Winter</option>

</select>

</div>

</td>

<td>

<center>

<div class="form-group ">

<button type="submit" name="Crop_Predict" class="btn btn-


success btn-submit">Predict</button>

</div>

</center>

</td>

</tr>

</tbody>

</table>

</form>

</div>

</div>

<div class="card text-white bg-gradient-success mb-3">


<div class="card-header">

<span class=" text-success display-4" > Result </span>

</div>

<h4>

<?php

if(isset($_POST['Crop_Predict'])){

$state=trim($_POST['stt']);

$district=trim($_POST['district']);

$season=trim($_POST['Season']);

echo "Crops grown in ".$district." during the ".$season." season are :- ";

$JsonState=json_encode($state);

$JsonDistrict=json_encode($district);

$JsonSeason=json_encode($season);

$command = escapeshellcmd("python
ML/crop_prediction/ZDecision_Tree_Model_Call.py $JsonState $JsonDistrict
$JsonSeason");

$output = passthru($command);

echo $output;

?>

</h4>

</div>

</div>

</div>

</div>
</section>

<?php require("footer.php");?>

</body>

</html>

yield_prediction.php
<!DOCTYPE html>

<html>

<?php include ('header.php'); ?>

<body class="bg-white" id="top">

<?php include ('nav.php'); ?>

<section class="section section-shaped section-lg">

<div class="shape shape-style-1 shape-primary">

<span></span>

<span></span>

<span></span>

<span></span>

<span></span>

<span></span>

<span></span>

<span></span>

<span></span>

<span></span>

</div>
<!--
==================================================================
==================================================================
==== -->

<div class="container ">

<div class="row">

<div class="col-md-8 mx-auto text-center">

<span class="badge badge-danger badge-pill mb-3">Prediction</span>

</div>

</div>

<div class="row row-content">

<div class="col-md-12 mb-3">

<div class="card text-white bg-gradient-success mb-3">

<form role="form" action="#" method="post" >

<div class="card-header">

<span class=" text-info display-4" > Yield Prediction </span>

</div>

<div class="card-body text-dark">

<table class="table table-striped table-hover table-bordered bg-gradient-white text-


center display" id="myTable">

<thead>

<tr class="font-weight-bold text-default">

<th><center> State</center></th>

<th><center>District</center></th>

<th><center>Season</center></th>

<th><center>Crop</center></th>
<th><center>Area</center></th>

<th><center>Prediction</center></th>

</tr>

</thead>

<tbody>

<tr class="text-center">

<td>

<div class="form-group">

<select name="state" class="form-control" required>

<option value="Karnataka">TAMILNADU</option>

</select>

</div>

</td>

<td>

<div class="form-group ">

<select id="district" name="district" class="form-control" required>

<option value="">Select a district</option>

<option value="THIRUVALLUR ">TIRUVALLUR</option>

<option value="CHENNAI ">CHENNAI</option>

<option value="VELLORE ">VELLORE</option>

<option value="RANIPET ">RANIPET</option>

<option value="KANCHIPURAM ">KANCHIPURAM</option>

<option value="KRISHNAGIRI ">KRISHNAGIRI</option>

<option value="TIRUPATTUR ">TIRUPATTUR</option>

<option value="TIRUVANAMALAI ">TIRUVANNAMALAI</option>

<option value="CHENGALPATTU ">CHENGALPATTU</option>

<option value="VILLUPURAM">VILLUPURAM</option>
<option value="DHARMAPURI ">DHARMAPURI</option>

<option value="PUDUCHERRY ">PUDUCHERRY</option>

<option value="KALLAKURICHI">KALLAKURICHI</option>

<option value="SALEM ">SALEM</option>

<option value="ERODE ">ERODE</option>

<option value="NILGIRIS ">NILGIRIS</option>

<option value="NAMAKKAL ">NAMAKKAL</option>

<option value="PERAMBALUR ">PERAMBALUR</option>

<option value="CUDDALORE ">CUDDALORE</option>

<option value="ARIYALUR ">ARIYALUR</option>

<option value="MAYILADUTHURAI ">MAYILADUTHURAI</option>

<option value="THIRUCHIRAPALLI ">THIRUCHIRAPALLI</option>

<option value="KARAIKAL ">KARAIKAL</option>

<option value="KARUR ">KARUR</option>

<option value="COIMBATORE ">COIMBATORE</option>

<option value="TIRUPPUR ">TIRUPPUR</option>

<option value="THANJAVUR ">THANJAVUR</option>

<option value="TIRUVARUR ">TIRUVARUR</option>

<option value=" DINDIGUL ">DINDIGUL</option>

<option value="PUDUKKOTTAI ">PUDUKKOTTAI</option>

<option value="NAGAPATTINAM ">NAGAPATTINAM</option>

<option value="THENI ">THENI</option>

<option value="MADURAI ">MADURAI</option>

<option value="SIVAGANGAI ">SIVAGANGAI</option>

<option value="VIRUTHUNAGAR ">VIRUTHUNAGAR</option>

<option value="RAMANATHAPURAM ">RAMANATHAPURAAM</option>

<option value="TENKASI ">TENKASI</option>


<option value="THOOTHUKUDI ">THOOTHUKUDI</option>

<option value="TIRUNELVELI ">TIRUNELVELI</option>

<option value="KANNIYAKUMARI ">KANNIYAKUMARI</option>

</select>

</div>

</td>

<td>

<div class="form-group ">

<select name="Season" class="form-control" id="season" required>

<option value="">Select Season ...</option>

<option name="Kharif" value="Kharif">Kharif</option>

<option name="Rabi" value="Rabi">Rabi</option>

<option name="Summer" value="Summer">Summer</option>

<option name="WholeYear" value="WholeYear">Whole Year</option>

</select>

</div>

</td>

<td>

<div class="form-group" >

<select id="crop" class="form-control" name="crops" required>

<option value="">Select crop</option>

</select>

</div>

</td>
<script>

document.getElementById("season").addEventListener("change", function() {

const districtDropdown = document.getElementById('district');

const seasonDropdown = document.getElementById('season');

const cropDropdown = document.getElementById('crop');

console.log(districtDropdown);

console.log(seasonDropdown);

console.log(cropDropdown);

const selectedDistrict = districtDropdown.value;

const selectedSeason = seasonDropdown.value;

// Clear the current crop options

cropDropdown.innerHTML = '<option value="">Select crop</option>';

// If both district and season are selected, add the corresponding crop options to the
dropdown

if (selectedDistrict && selectedSeason) {

const options = cropOptions[selectedDistrict][selectedSeason];

for (const option of options) {

const optionElement = document.createElement('option');

optionElement.value = option; // Set the value to the option text

optionElement.text = option;

cropDropdown.appendChild(optionElement);
}

});

</script>

<td>

<div class="form-group">

<input type = "number" step=0.01 name="area" placeholder="Area in Hectares"


required class="form-control">

</div>

</td>

<td>

<center>

<div class="form-group ">

<button type="submit" value="Yield" name="Yield_Predict" class="btn btn-


success btn-submit">Predict</button>

</div>

</center>

</td>

</tr>

</tbody>

</table>

</div>

</form>

</div>

<div class="card text-white bg-gradient-success mb-3">

<div class="card-header">
<span class=" text-success display-4" > Result </span>

</div>

<h4>

<?php

if(isset($_POST['Yield_Predict'])){

$state=trim($_POST['state']);

$district=trim($_POST['district']);

$season=trim($_POST['Season']);

$crops=trim($_POST['crops']);

$area=trim($_POST['area']);

echo "Predicted crop yield (in Quintal) is: ";

$Jstate=json_encode($state);

$Jdistrict=json_encode($district);

$Jseason=json_encode($season);

$Jcrops=json_encode($crops);

$Jarea=json_encode($area);

$command = escapeshellcmd("python ML/yield_prediction/yield_prediction.py


$Jstate $Jdistrict $Jseason $Jcrops $Jarea ");

$output = passthru($command);

echo $output;

?>
</h4>

</div>

</div>

</div>

</div>

</section>

<?php require("footer.php");?>

</body>

</html>

rainfall_prediction.php
<!DOCTYPE html>

<html>

<?php include ('header.php'); ?>

<body class="bg-white" id="top">

<?php include ('nav.php'); ?>

<section class="section section-shaped section-lg">

<div class="shape shape-style-1 shape-primary">

<span></span>

<span></span>

<span></span>

<span></span>

<span></span>

<span></span>

<span></span>

<span></span>

<span></span>
<span></span>

</div>

<!--
==================================================================
==================================================================
==== -->

<div class="container ">

<div class="row">

<div class="col-md-8 mx-auto text-center">

<span class="badge badge-danger badge-pill mb-3">Prediction</span>

</div>

</div>

<div class="row row-content">

<div class="col-md-12 mb-3">

<div class="card text-white bg-gradient-success mb-3">

<form role="form" action="#" method="post" >

<div class="card-header">

<span class=" text-info display-4" > Rainfall Prediction </span>

</div>

<div class="card-body text-dark">

<table class="table table-striped table-hover table-bordered bg-gradient-white text-


center display" id="myTable">

<thead>

<tr class="font-weight-bold text-default">

<th><center>Region</center></th>

<th><center>Month</center></th>

<th><center>Prediction</center></th>
</tr>

</thead>

<tbody>

<tr class="text-center">

<td>

<div class="form-group ">

<select id="region-select" name="region" class="form-control" required>

<option value="">Select Region</option>

</select>

<script language="javascript"> print_region("region-select"); </script>

</div>

</td>

<td>

<div class="form-group ">

<select id="month-select" name="month" class="form-control" required>

<option value="">Select Month</option>

</select>

<script language="javascript"> print_months("month-select"); </script>

</div>

</td>

<td>

<center>

<div class="form-group ">

<button type="submit" value="Yield" name="Rainfall_Predict" class="btn btn-


success btn-submit">Predict</button>

</div>
</center>

</td>

</tr>

</tbody>

</table>

</div>

</form>

</div>

<div class="card text-white bg-gradient-success mb-3">

<div class="card-header">

<span class=" text-success display-4" > Result </span>

</div>

<h4>

<?php

if(isset($_POST['Rainfall_Predict'])){

$region=trim($_POST['region']);

$month=trim($_POST['month']);

echo "Predicted Rainfall for the Region $region in the month $month is (in mm) : ";

$Jregion=json_encode($region);

$Jmonth=json_encode($month);

$command = escapeshellcmd("python
ML/rainfall_prediction/rainfall_prediction.py $Jregion $Jmonth ");
$output = passthru($command);

echo $output;

?>

</h4>

</div>

</div>

</div>

</div>

</section>

<?php require("footer.php");?>

</body>

</html>

crop_recommendation.php
<!DOCTYPE html>

<html>

<?php include ('header.php'); ?>

<body class="bg-white" id="top">

<?php include ('nav.php'); ?>

<section class="section section-shaped section-lg">

<div class="shape shape-style-1 shape-primary">

<span></span>

<span></span>

<span></span>

<span></span>

<span></span>
<span></span>

<span></span>

<span></span>

<span></span>

<span></span>

</div>

<!--
==================================================================
==================================================================
==== -->

<div class="container-fluid ">

<div class="row">

<div class="col-md-8 mx-auto text-center">

<span class="badge badge-danger badge-pill mb-3">Recommendation</span>

</div>

</div>

<div class="row row-content">

<div class="col-md-12 mb-3">

<div class="card text-white bg-gradient-success mb-3">

<form role="form" action="#" method="post" >

<div class="card-header">

<span class=" text-info display-4" > Crop Recommendation </span>

<span class="pull-right">

<button type="submit" value="Recommend" name="Crop_Recommend"


class="btn btn-warning btn-submit">SUBMIT</button>

</span>

</div>

<div class="card-body text-dark">


<form role="form" action="#" method="post" >

<table class="table table-striped table-hover table-bordered bg-gradient-white text-


center display" id="myTable">

<thead>

<tr class="font-weight-bold text-default">

<th><center> Nitrogen</center></th>

<th><center>Phosporous</center></th>

<th><center>Potasioum</center></th>

<th><center>Temparature</center></th>

<th><center>Humidity</center></th>

<th><center>PH</center></th>

<th><center>Rainfall</center></th>

</tr>

</thead>

<tbody>

<tr class="text-center">

<td>

<div class="form-group">

<input type = 'number' name = 'n' placeholder="Nitrogen Eg:90" required


class="form-control">

</div>

</td>

<td>

<div class="form-group">

<input type = 'number' name = 'p' placeholder="Phosphorus Eg:42" required


class="form-control">
</div>

</td>

<td>

<div class="form-group">

<input type = 'number' name = 'k' placeholder="Pottasium Eg:43" required


class="form-control">

</div>

</td>

<td>

<div class="form-group">

<input type = 'number' name = 't' step =0.01 placeholder="Temperature Eg:21"


required class="form-control">

</div>

</td>

<td>

<div class="form-group">

<input type = 'number' name = 'h' step =0.01 placeholder="Humidity Eg:82"


required class="form-control">

</div>

</td>

<td>

<div class="form-group">

<input type = 'number' name = 'ph' step =0.01 placeholder="PH Eg:6.5" required
class="form-control">

</div>

</td>

<td>

<div class="form-group">
<input type = 'number' name = 'r' step =0.01 placeholder="Rainfall Eg:203" required
class="form-control">

</div>

</td>

</tr>

</tbody>

</table>

</form>

</div>

</div>

<div class="card text-white bg-gradient-success mb-3">

<div class="card-header">

<span class=" text-success display-4" > Result </span>

</div>

<h4>

<?php

if(isset($_POST['Crop_Recommend'])){

$n=trim($_POST['n']);

$p=trim($_POST['p']);

$k=trim($_POST['k']);

$t=trim($_POST['t']);

$h=trim($_POST['h']);

$ph=trim($_POST['ph']);

$r=trim($_POST['r']);

echo "Recommended Crop is : ";


$Jsonn=json_encode($n);

$Jsonp=json_encode($p);

$Jsonk=json_encode($k);

$Jsont=json_encode($t);

$Jsonh=json_encode($h);

$Jsonph=json_encode($ph);

$Jsonr=json_encode($r);

$command = escapeshellcmd("python ML/crop_recommendation/recommend.py


$Jsonn $Jsonp $Jsonk $Jsont $Jsonh $Jsonph $Jsonr ");

$output = passthru($command);

echo $output;

?>

</h4>

</div>

</div>

</div>

</div>

</section>

<?php require("footer.php");?>

</body>

</html>

fertilizer_recommendation.php
<!DOCTYPE html>
<html>

<?php include ('header.php'); ?>

<body class="bg-white" id="top">

<?php include ('nav.php'); ?>

<section class="section section-shaped section-lg">

<div class="shape shape-style-1 shape-primary">

<span></span>

<span></span>

<span></span>

<span></span>

<span></span>

<span></span>

<span></span>

<span></span>

<span></span>

<span></span>

</div>

<!--
==================================================================
==================================================================
==== -->

<div class="container-fluid ">

<div class="row">

<div class="col-md-8 mx-auto text-center">

<span class="badge badge-danger badge-pill mb-3">Recommendation</span>

</div>

</div>
<div class="row row-content">

<div class="col-md-12 mb-3">

<div class="card text-white bg-gradient-success mb-3">

<form role="form" action="#" method="post" >

<div class="card-header">

<span class=" text-info display-4" > Fertilizer Recommendation </span>

<span class="pull-right">

<button type="submit" value="Recommend" name="Fert_Recommend" class="btn


btn-warning btn-submit">SUBMIT</button>

</span>

</div>

<div class="card-body text-dark">

<table class="table table-striped table-hover table-bordered bg-gradient-white text-


center display" id="myTable">

<thead>

<tr class="font-weight-bold text-default">

<th><center> Nitrogen</center></th>

<th><center>Phosporous</center></th>

<th><center>Potasioum</center></th>

<th><center>Temparature</center></th>

<th><center>Humidity</center></th>

<th><center>Soil Moisture</center></th>

<th><center>Soil Type</center></th>

<th><center>Crop</center></th>

</tr>

</thead>

<tbody>

<tr class="text-center">
<td>

<div class="form-group">

<input type = 'number' name = 'n' placeholder="Nitrogen Eg:37" required


class="form-control">

</div>

</td>

<td>

<div class="form-group">

<input type = 'number' name = 'p' placeholder="Phosphorus Eg:0" required


class="form-control">

</div>

</td>

<td>

<div class="form-group">

<input type = 'number' name = 'k' placeholder="Pottasium Eg:0" required


class="form-control">

</div>

</td>

<td>

<div class="form-group">

<input type = 'number' name = 't' placeholder="Temperature Eg:26" required


class="form-control">

</div>

</td>

<td>

<div class="form-group">

<input type = 'number' name = 'h' placeholder="Humidity Eg:52" required


class="form-control">

</div>
</td>

<td>

<div class="form-group">

<input type = 'number' name='soilMoisture' placeholder="Soil Moisture Eg:38"


required class="form-control">

</div>

</td>

<td>

<div class="form-group ">

<select name="soil" class="form-control">

<option value="">Select Soil Type</option>

<option value="Sandy">Sandy</option>

<option value="Loamy">Loamy</option>

<option value="Black">Black</option>

<option value="Red">Red</option>

<option value="Clayey">Clayey</option>

</select>

</div>

</td>

<td>

<div class="form-group ">

<select name="crop" class="form-control">

<option value="">Select Crop</option>

<option value="Maize">Maize</option>

<option value="Sugarcane">Sugarcane</option>

<option value="Cotton">Cotton</option>

<option value="Tobacco">Tobacco</option>
<option value="Paddy">Paddy</option>

<option value="Barley">Barley</option>

<option value="Wheat">Wheat</option>

<option value="Millets">Millets</option>

<option value="Oil seeds">Oil seeds</option>

<option value="Pulses">Pulses</option>

<option value="Ground Nuts">Ground Nuts</option>

</select>

</div>

</td>

</tr>

</tbody>

</table>

</div>

</form>

</div>

<div class="card text-white bg-gradient-success mb-3">

<div class="card-header">

<span class=" text-success display-4" > Result </span>

</div>

<h4>

<?php

if(isset($_POST['Fert_Recommend'])){

$n=trim($_POST['n']);

$p=trim($_POST['p']);

$k=trim($_POST['k']);
$t=trim($_POST['t']);

$h=trim($_POST['h']);

$sm=trim($_POST['soilMoisture']);

$soil=trim($_POST['soil']);

$crop=trim($_POST['crop']);

echo "Recommended Fertilizer is : ";

$Jsonn=json_encode($n);

$Jsonp=json_encode($p);

$Jsonk=json_encode($k);

$Jsont=json_encode($t);

$Jsonh=json_encode($h);

$Jsonsm=json_encode($sm);

$Jsonsoil=json_encode($soil);

$Jsoncrop=json_encode($crop);

$command = escapeshellcmd("python
ML/fertilizer_recommendation/fertilizer_recommendation.py $Jsonn $Jsonp $Jsonk $Jsont
$Jsonh $Jsonsm $Jsonsoil $Jsoncrop ");

$output = passthru($command);

echo $output;

?>

</h4>

</div>

</div>

</div>
</div>

</section>

<?php require("footer.php");?>

</body>

</html>

RESULTS

7.1 SNAPSHOTS

Figure 6 – Interface Of The Crop Yield Predictor


Figure 7 - Crop prediction

Crop prediction will predict different kinds of crops suitable to be grown for the area which
has been selected through the input

Figure 8 - Yield prediction

In yield prediction yield for the particular area which is selected is predicted, this will give
the farmer an idea about the production of the crop
Figure 9 - Rainfall prediction

Rainfall prediction will predict the rainfall for the particular region which is selected according
to the inputs from the list. This will help farmers from incurring losses.

Figure 10 - Crop recommendation

Crop recommendation recommends the particular crop to be grown in that particular area
Figure 11 - Fertilizer prediction

Fertilizer prediction will recommend the particular fertilizer suitable for that area. That
fertilizer will be helpful for the crop which is to be grown.
FUTURE ENHANCEMENT

As a future scope, the web-based application can be made more user-friendly by targeting more
populations by including all the different regional languages in the interface and providing a
link to upload information instead of entering the test value manually. This research work can
be enhanced to a high level by building a recommender system of agriculture production and
distribution for farmers. By which farmers can make their own decision like which season
which crop should sow so that they can get better profit. This system works for structured
datasets or databases

8.1 FUTURE ENHANCEMENTS FOR CROP YIELD PREDICTION

1. Integration of Remote Sensing Data:

Incorporating satellite imagery and remote sensing data can provide real-time information on
crop health, moisture levels, and environmental conditions. This integration can enhance the
accuracy and timeliness of crop yield predictions.

2. Utilization of IoT Sensors:

Deploying IoT sensors in agricultural fields can enable the collection of high-resolution data
on soil moisture, temperature, and nutrient levels. Integrating this data with crop yield
prediction models can offer more granular insights for farmers to optimize their farming
practices.

3. Adoption of Deep Learning Techniques:

Deep learning algorithms such as convolutional neural networks (CNNs) and recurrent neural
networks (RNNs) have shown promise in handling complex spatial and temporal data.
Leveraging these techniques can improve the predictive capabilities of crop yield models,
especially for crops with intricate growth patterns.

4. Ensemble Modelling Approaches:

Implementing ensemble learning techniques such as bagging, boosting, or stacking can


combine the strengths of multiple models to produce more robust predictions. Ensemble
models often outperform individual algorithms by mitigating biases and variance in the
predictions.
5. Integration of Weather Forecast Data: Integrating weather forecast data into crop yield
prediction models can enable proactive decision-making for farmers. By considering future
weather conditions, farmers can anticipate potential risks and adjust their farming strategies
accordingly to mitigate adverse effects on crop yields.

6. Geographic Expansion and Crop Diversity:

Expanding the geographic coverage of crop yield prediction models to encompass diverse
regions and crops can enhance their applicability and utility. Incorporating data from different
climatic zones and agricultural practices can improve the models' adaptability and accuracy
across varied agricultural landscapes.

7. Incorporation of Socio-Economic Factors:

Integrating socio-economic factors such as market demand, commodity prices, and


government policies into crop yield prediction models can provide a holistic view of the
agricultural landscape. Understanding the socio-economic context can help farmers make
informed decisions about crop selection, pricing strategies, and market opportunities.

8. Development of User-Friendly Interfaces:

Designing user-friendly interfaces and mobile applications can facilitate the adoption of crop
yield prediction tools by farmers and stakeholders. Intuitive dashboards and visualization tools
can empower users to interpret the model outputs effectively and incorporate them into their
decision-making processes.

9. Continuous Model Refinement and Validation:

Continuous refinement and validation of crop yield prediction models are essential to ensure
their accuracy and reliability over time. Incorporating feedback from farmers, agronomists, and
domain experts can help identify areas for improvement and refine the models' performance in
real-world scenarios.

10. Collaboration and Knowledge Sharing:

Encouraging collaboration and knowledge sharing among researchers, practitioners, and


policymakers can accelerate innovation in crop yield prediction and promote the adoption of
best practices. Open-source initiatives, collaborative research projects, and interdisciplinary
partnerships can foster a culture of innovation and sustainability in agriculture.
CONCLUSION

This paper presents the various machine learning algorithms for predicting the yield of the crop
on the basis of weather and other conditions. This project develops a website for predicting
crop yield, weather, and fertilizer recommendation using machine learning algorithms. The
decision tree is found to provide the most accurate predictions for crop yield, weather, and
fertilizer recommendation. The prediction system takes the inputs from the user and provides
the best and most accurate predictive analysis for crop yield. The website also provides
information on the best crop that is suitable and also which particular fertilizers are required
for that crop. Results also revealed that the Random Forest classifier gives the highest weather
prediction and fertilizer recommendation accuracy. These will not only help farmers maintain
the proper crop supply to grow but also in cost management also it can be helpful. It will
empower farmers to make informed decisions regarding crop selection, fertilizer usage, and
overall cost management. The robustness and reliability of our system have been validated
through experiments conducted on a reliable dataset
. REFERENCES

[1] Prameya R Hegde, Ashok Kumar A R, “Crop Yield and Price Prediction System for
Agriculture Application”,International Journal of Engineering Research & Technology
(IJERT) Vol. 11 Issue 07, July-2022. Shangping Wang, Xu Wang, and Yaling Zhang, “A
Secure Cloud Storage Framework with Access Control based on Blockchain”.

[2] E. Manjula, S. Djodiltachoumy, “Model for Prediction of Crop Yield”, International Journal
of Computational Intelligence and Informatics, Vol. 6: No. 4,March 2017

[3] Dr. Y. Jeevan Nagendra Kumar, V. Spandana,V.S. Vaishnavi,K. Neha, “Supervised


Machine learning Approach for Crop Yield Prediction in Agriculture Sector”, (ICCES
2020)IEEE Xplore ISBN: 978-1- 7281-5371-1.

[4] R.B.Saroo Raj, Ankush Rai, Ronit Dharmik, Siddharth Bhattacharjee, ”Weather
Forecasting System using Machine Learning”, International Journal of Emerging Technologies
in Engineering Research (IJETER),Volume 6, Issue 10, October(2018).

[5] Andrew Crane-Droesch,”Machine learning methods for crop yield prediction and climate
change impact assessment in agriculture”, Environ. Res. Lett. 13 (2018)114003.

[6] Potnuru Sai Nishant, Pinapa Sai Venkat, Bollu Lakshmi Avinash3, B. Jabber. “Crop Yield
Prediction based on Indian Agriculture using Machine Learning”, International Conference for
Emerging Technology (INCET) Belgaum, India. Jun 5-7, 2020

[7] Shivani Turamari, Pooja Patil, Mallappa Hallad, Manjunath Bilagi, “Weather Forecast
Prediction for Agriculture”, (IJERT) ISSN: 2278-0181 ,Special Issue - 2022.

[8] Pallavi Shankarrao Mahore, Dr. Aashish A. Bardekar, “Crop Yield Prediction using
Different Machine Learning Techniques”, International Journal of Scientific Research in
Computer Science, Engineering and Information Technology ISSN : 2456- 3307,Volume 7,
Issue 3,May-June- 2021.

You might also like