Crop Yield Prediction Using Random Forest Algorithm
Crop Yield Prediction Using Random Forest Algorithm
Most agricultural crops have been badly affected by the effect of global climate
change in India. In terms of their output over the past 20 years. It will allow policy
makers and farmers to take effective marketing and storage steps to predict crop
yields earlier in their harvest. This project will allow farmers to capture the yield of
their crops before cultivation in the field of agriculture and thus help them make
the necessary decisions. Implementation of such a method with a web-based
graphic software that is simple to use and the machine learning algorithm can then
be distributed. The results obtained are granted access to the farmer. And yet there
are various methods or protocols for such very data analytics in crop yield
prediction, and we are able to predict agricultural productivity with guidance of all
those algorithms. It utilizes a Random Forest Algorithm. By researching such
problems and issues such as weather, temperature, humidity, rainfall, humidity,
there are no adequate solutions and inventions to resolve the situation we face. In
countries like India, even in the agricultural sector, as there are many types of
increasing economic growth. In addition, the processing is useful for forecasting
the production of crop yields.
3
TABLE OF CONTENTS
LIST OF FIGURES 6
LIST OF ABBREVATIONS 7
1 INTRODUCTION 8
2 SYSTEM ANALYSIS 9
3 REQUIREMENTS SPECIFICATION 10
3.1 Introduction 10
5 Architecture Diagram 31
6 Modules 37
4
6.1 Modules 37
7.1 Coding 38
SOURCE CODE 48
8 SCREENSHOTS 60
REFERENCES 69
5
LIST OF FIGURES
6
LIST OF SCREENSHOTS
Filling missing values data set using Pandas & NumPy
Graph for predicting future crop
Open Firebase Console
Created android app for Crop prediction
Crop Prediction
Enter the values of attributes
Input given by the user goes to the trained dataset using firebase
Predicted the crop with price
Successfully predicted crop and price
CHAPTER 1
7
INTRODUCTION
Aim:
Predict the crop type and price of the crop using machine learning methodology
with accurate results.
Synopsis:
India is the land of agriculture and it is the major source of economy. 70% of Indian
population directly relies on agriculture. The common problem existing among the young Indian
farmers is to choose the right crop based on the location, humidity, temperature, rainfall. Due to
this, they face a serious setback in productivity. Our work proposes to help farmers determine the
predict crop type and price by doing analysis on its various parameters and to suggest crops
based on the results obtained. The system uses the Classification algorithm of Random Forest to
improve the efficiency of Crop Recommendation System. The system maps the location,
temperature, humidity, pH value and rainfall to predict the list of suitable crops for the soil and it
also provides cost of the crop. Hence it leaves upon the user to decide on the crop to be sown.
CHAPTER 2
8
SYSTEM ANALYSIS
Now a day‟s, dilettante farmers are hard to understand the cultivation process, crop type,
climate change, etc. Farming is that the spine for every nation's economy. Future agriculture
depends on dilettante formers. But, the new farmers have low level knowledge in this field. So,
Machine learning help to solve this type of problems. In Existing system they provide soil type
and crop using Random Forest algorithm. But everyone can able to find a soil type easily. So, we
need to predict the crop type and predict the crop price based on Machine learning technology.
9
CHAPTER 3
REQUIREMENT SPECIFICATIONS
3.1 INTRODUCTION
Agriculture is the backbone of India. As we known, food stands first in the basic need of
survival; agriculture sector needs to be given the highest preference in development. Indian
agriculture sector accounts for 18 percent of Indian agriculture gross domestic product (GDP)
and provides employment to 50% of the country‟s workforce. The main reason for considered
Agriculture sector is because it plays an important role in developing the country‟s economy.
The proposed System uses the Crop Selection as the area of research, since it the first and most
important step in the process of agricultural development and the success of this step guarantees
the result of production. Agriculture development provides assistance to the crop producers with
the help of various agricultural resources. As a result, it provides high productivity with low
consumption of resources.
Crop production may also be an advanced development that is affected by the
input parameters of soil and condition. Process parameters of agriculture vary from area to area
and producer to producer. It may also be a discouraging challenge to collect such information in
an even larger room. The Indian Meteoric Department, however, tabulates the environmental
condition information collected in the Republic of India at each 1sq.m space in various
components of the district. The huge sets of such information are often used to predict their
effect on that district or place's main crops. Within the agriculture or related sciences field, there
are entirely different foretelling methodologies developed and evaluated by researchers around
the globe. Some studies of that type are: In alternative countries, agricultural researchers have
shown that attempts to increase crop yield by pro-pesticide state maximization have been carried
out. Driven strategies for dangerously high chemical use have been introduced. The association
between chemical use and crop yield has been stated in these studies[1]. Agriculture is a partner
trade sector that has gained significantly in recent years from the growth of detector technology,
information science, and machine learning (ML) techniques.
10
3.2 HARDWARE AND SOFTWARE SPECIFICATION
initially designed by Guido van Rossum in 1991 and developed by Python Software Foundation.
It was mainly developed for emphasis on code readability, and its syntax allows programmers to
Python is a programming language that lets you work quickly and integrate systems more
efficiently.
It is used for:
11
web development (server-side),
software development,
mathematics,
System scripting.
Why Python?
Python works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc).
Python has a simple syntax similar to the English language.
Python has syntax that allows developers to write programs with fewer lines than some
other programming languages.
Python runs on an interpreter system, meaning that code can be executed as soon as it is
written. This means that prototyping can be very quick.
Python can be treated in a procedural way, an object-orientated way or a functional way.
Good to know
The most recent major version of Python is Python 3, which we shall be using in this
tutorial. However, Python 2, although not being updated with anything other than
security updates, is still quite popular.
Python 2.0 was released in 2000, and the 2.x versions were the prevalent releases until
December 2008. At that time, the development team made the decision to release version
3.0, which contained a few relatively small but significant changes that were not
backward compatible with the 2.x versions. Python 2 and 3 are very similar, and some
12
This makes for a quicker development cycle because you just type in your code and run
it, without the intermediate compilation step.
One potential downside to interpreted languages is execution speed. Programs that are
compiled into the native language of the computer processor tend to run more quickly
than interpreted programs. For some applications that are particularly computationally
intensive, like graphics processing or intense number crunching, this can be limiting.
In practice, however, for most programs, the difference in execution speed is measured in
milliseconds, or seconds at most, and not appreciably noticeable to a human user. The
expediency of coding in an interpreted language is typically worth it for most
applications.
For all its syntactical simplicity, Python supports most constructs that would be expected
in a very high-level language, including complex dynamic data types, structured and
functional programming, and object-oriented programming.
Additionally, a very extensive library of classes and functions is available that provides
capability well beyond what is built into the language, such as database manipulation or
GUI programming.
Python accomplishes what many programming languages don‟t: the language itself is
simply designed, but it is very versatile in terms of what you can accomplish with it.