You are on page 1of 47

Review on intelligent crop recommendation system

ABSTRACT
Crop recommendation systems for agriculture are based on various input parameters. It
proposes a hybrid model recommending plants for South Indian states by considering multiple
attributes, including soil type, rainfall, groundwater level, temperature, fertilizers, pesticides
and weather. The recommendation model classifier is built as a hybrid model usingthe learning
rule set of the device. Based on the appropriate parameters, the device will recommend the
culture. The technology-based crop recommendation tool for agriculture helps farmers to
increase crop production by recommending suitable crops for their land with the help of
geographical and climatic parameters. The proposed hybrid recommendation version is
effective in recommending suitable crops. Updating the manufacturing value of crop
production is of great importance to guide agricultural production and to inform the farmer
about changes in the market rate of the crop. The idea of this document is to implement the
method of crop selection so that this method can solve many problems for agriculture and
farmers. It improves our Indian economy by maximizing crop production. Different types of
ground conditions. Therefore, plant happiness is evaluated using a classification process. Low-
quality harvests and excessively high-quality rates are also reported through this system. Using
a set of classifiers paves the way for a better selection of predictors due to the use of several
classifiers. In addition, a classification procedure is applied to select the results of the
classifiers in an attempt to select them. This system is used to estimate the value of future crops.

1
Index

Sno Topic Page no


1 Introduction
2 Literature survey
3 Feasibility Analysis
4 System Analysis
➢ Software Requirements Specification
Document
➢ Use Case Diagram

5 Design
6 UML Diagrams

7 Data Set Description


8 Machine Learning Algorithms
9 Code
10 System Testing
11 Output Screen

12 Conclusion

2
INTRODUCTION

A major contribution to the Indian financial machine is made by agriculture. Many households
in India are directly or indirectly dependent on agriculture. Therefore, agriculture is an
important part of India and defines who we are as rural people. Most of India's farming
population relies on their intuition to decide which plants to plant in a particular season. They
generally follow ancestral parameters and agricultural patterns without realizing that
production depends on the climate, modern activities and soil conditions. Therefore, it is
difficult for the farmer to be responsible for all his choices due to the infinity of elements. A
wrong or wrong choice of farmer support will greatly impact India's agricultural finance system
and wider enjoyment in this area. A combination of device-aware algorithms, traditional and
scientifically collected soil parameters, and weather data can help set the right optimum crop
on the farm.

As we all know, agriculture is the driving force behind Indian financial instruments. Farming
is an important occupation in India. More than 60% of the land in the United States of America
is used for agriculture, which supports 1.3 billion people [1]. Agriculture is the cultivation of
plants and animals. Agriculture drove civilization upwards in India. We need soil to grow
plants. As a final result, soil is an important factor in agriculture. Soil suitability is important
for proper flour production. It provides important nutrients, water, and oxygen and supports
the roots. Soil is the base of the food machine and surrounds all the flowers used in food
preparation. Different types of soil are available in India. They are burnt soil (cotton, rice),
black soil (sugarcane, sunflower), red soil (maize, ragi), laterite soil (beans, tea, coffee) etc.
Many studies were conducted to improve agricultural planning.

Crop recommendations can be made using gadget control strategies. Machine learning is a
subfield of artificial intelligence that describes the ability of a machine to imitate intelligent
human behavior. Artificial intelligence frameworks are built on top of humans to automate
complex tasks. Machine learning starts with facts, including financial transactions, humans,
or snapshots. Data is collected and processed to obtain instructions for the device control
machine. If there are more records, the software program suggests higher results. The developer
then selects an ML model to implement, inputs information, and teaches the tool to
independently discover patterns or make predictions.

3
LITERATURE SURVEY

1) “Crop Selection Method to maximize crop yield rate using machine learning
technique”

AUTHORS: Rakesh Kumar

Agriculture is the backbone of Indian financial instruments and a source of employment for
tens of millions worldwide. A perennial problem faced by Indian farmers is that they do not
select plants based on environmental conditions, resulting in a loss of productivity. This
selection support machine allows solving this problem. In our test, the AI device enables
precision farming to optimize and optimize the normal crop harvest. The firm's research
selection, Industry 4.0, proposes a solution with recommender systems using AI and a range of
algorithmic learning tools. The national set used in the artwork in this test was downloaded and
fixed from Kaggle. It consists of 08 functions with 07 neutral variables, including N, P,K,
temperature, moisture, pH and precipitation. Then SMOTE state balancing method is used for
best results. Furthermore, the authors used optimization strategies to model the overall
efficiency of smart factories. Cat Boosting (C-Boost) performed well with an accuracy cost of
99.5129, F-measure-0.9916, and Precision-zero. 9918, and Kappa-0. 8870. GNB, in contrast,
outperformed ROC-0.9569 and MCC-zero. 9569 Relational categorization, regression, and
machine learning acquisition within algorithmic speed.
2)Efficient Crop Yield and Pesticide Prediction for Improving Agricultural Economy
using Data Mining
AUTHORS: RaoraneA

A large part of the Indian population considers agriculture as their main career. Plant
manufacturing plays an important role in the United States. Regular application of abnormal or
insufficient fertilizers causes less production of pleasant plants. The proposed IoT and ML
machine is primarily functional for soil evaluation using sensors based on measuring and
observing soil parameters. This system reduces the chances of soil degradation and makes it
easier to maintain crop health. Various sensors, including soil temperature, soil moisture, pH
and NPK, are used in this machine to detect soil nutrients of soil temperature, moisture, pH and
NP. The data detected by these sensors are stored inside the microcontroller and analyzedusing
system information algorithms, like a random forest, based on the signals that are used

4
to increase the appropriate crop. have gone The challenge also includes a method that
specializes in using a neural network to determine whether a plant is diseased or not.

3) Soil Data Analysis Using Classification Techniques and Soil Attribute Prediction

AUTHORS:Jay Gholap
Agriculture is one of the most important contributors to the Indian economy. Most of India's
population is overtly or ostensibly dependent on agriculture for their livelihood. Therefore, it
is undeniable that agriculture plays a fundamental role in you. Most Indian farmers are happy
to rely on their intuition to decide which crop to plant in any given season. They find comfort
in following the best old farming strategies and concepts, unaware that crop production is
situational and depends on winning weather and soil conditions. However, no single grower
can be expected to ignore all the myriad elements that contribute to long-term production before
a consensus is reached on what to supply. A wrong or wrong priority on the part of thefarmer
can lead to undesirable consequences in his rural financial system and neighborhood.
Combining big data analysis and device insights can help alleviate this problem. In this article,
we introduce a nifty device called AgroConsultant, which provides Indian farmers with
complete data based on planting season, geographical area of their fields, soil properties, and
environmental factors along with temperature and rainfall.
4) “Smart Farming Using Machine Learning”

AUTHORS :Dr. ShubhamPawar

India is a predominantly agricultural America, and agriculture is important in the Indian


economy and people's lives. Crops are recommended based on soil, climate, moisture, rainfall
and various variables to increase agricultural production. Now bless not only the fans but you
too. And makes it easier to keep food prices low. This document allows using machine learning
methods such as Random Forest and Decision TYee to predict which crops are suitable for
which soil types based on statistical units.

5) ”Crop recommendation system for precision agriculture”

AUTHORS: S. Pudumalar
The three simple things essential to a person's survival are food, safe shelter and clothing.
The latter two have amazing clinical momentum in the latest technological era.

5
Unfortunately, agriculture is still considered a deeply human subject. Most farmers areilliterate
and have little or no scientific experience in agriculture. Therefore, they must rely on a
successful and well-thought-out method of luckily evaluating, which wastes time andresources.
Our tool specializes in building a predictive model to recommend the most suitableflowers for
production on a particular farm based entirely on multiple parameters. It can be beneficial for
farmers to be more productive and efficient without wasting their supplies and grow the most
viable plants.

6
FEASIBILITY STUDY
A feasibility study is a detailed evaluation that considers all the key elements of a
proposed project that you can use to determine its chances of success. It can generally describe
the success of a business in terms of return on investment, which means that the challenge
generates enough revenue to justify financing. However, on the plus or minus side,
it can identify various important elements, network responses, and environmental
influences. Although feasibility research can assist project managers in assessing risks and
undoing a course of action, they must consider several steps before proceeding.

The feasibility study has three main aspects into account.

1. ECONOMIC FEASIBILITY
It is a cost-benefit analysis of the project being tested and assessing whether it is feasible to
proceed. This period is designed to assess and analyze the mission's ability to supportdecision-
making by objectively identifying the associated powers, liabilities, possibilities andthreats, the
resources required to execute the task, and assessing the likelihood of this happening.
2. TECHNICAL FEASIBILITY
Technical feasibility is the formal method of evaluating whether or not the production of a
product or service is technically feasible. Before launching a new presentation or acquiring a
client company, planning and preparing for each step of the process is critical. Technical
feasibility allows determining the effectiveness of the proposed plan by analyzing the method
that includes equipment, squeezing, weaving, labor, and logistics.

3. SOCIAL FEASIBILITY
Social Feasibility is one of the feasibility considerations that believes individuals'
approval of the product to be released. Represents the impact on users of the preface of the new
machine about whether there was a requirement for attendants retraining. Explains how to
provide user association beforehand customizations are broadcasted.

7
SYSTEM ANALYSIS

EXISTING SYSTEM:

Agriculture is an important part of the world and the backbone of the Republic of India. The
situation in agriculture is dire. The results of temperature patterns and their uncertainty have
made most agricultural plants mature in production. Accurate crop growth forecasting is an
important factor in crop forecasting management. Such forecasts will delay federal industries
in their generation offerings. ML is a method for finding new models from large statistical
units. Various regression techniques can be used, including random forest, linear regression,
choice tree regression, multinomial regression, and support vector regression. Area and
production are stored within the climatic information produced by vital statistics. This work
studies ML regressions for deciding crop yield indicators through precision evaluation of a pair
of systems with a general improvement percentage of 3.6% compared to several existing
strategies.

DISADVANTAGES OF EXISTING SYSTEM:

➢ Low Efficzency.

➢ We cannot predict the recommended crops.


➢ In existing system, we cannot used any deeplearning algorithms.

Algorithm: Random Forest

PROPOSED SYSTEM:

To get rid of the aforementioned disadvantages, we recommend that you use a smart tool for
crop recommendations, which takes into account all the appropriate parameters, combined with
the conditions of temperature, rainfall, area and soil, it is expected to be suitable for cultivation.
This machine is mainly concerned with the appearance of the first function of AgroConsultant,
which is the transfer of crop advice to farmers' algorithms In addition to providing income
assessment of cultivated plants in unique cases that are presented to the person Easy and reliable
visualization for identification and crop planning.

8
ADVANTAGES OF PROPOSED SYSTEM:

1. Reduction of problems can be done by implementing new techniques on agriculture


2. This application helps them to predict the yield.
3. This will help the farmers which crop to be selected for their land or the region

Algorithms:

Support Vector Machine,and Naive Bayes ,Decision Tree,Linear Regression, K-Nearest


Neighbor and Neural Network

Software Requirements Specification Document

A crop recommendation system in machine learning is designed to suggest suitable crops to


farmers based on various factors such as soil conditions, climate, available resources, and
market demand. The goal is to optimize crop selection and increase productivity.

To develop a crop recommendation system, you can follow these general steps:

Data Collection: Gather data related to soil characteristics, climate conditions, historical crop
yield, nutrient levels, pest and disease occurrences, and other relevant factors. This data can be
collected from various sources, such as agricultural research institutions, government
databases, and local farming communities.
Preprocessing: Clean and preprocess the collected data to ensure its quality and remove any
inconsistencies or outliers. This step may involve data cleaning, handling missing values, data
normalization, and feature engineering.
Feature Selection: Identify the most relevant features that will influence crop
recommendations. These features may include soil pH, temperature, rainfall, nutrient levels,
crop rotation history, and market prices. Feature selection techniques like correlation analysis
or information gain can be applied to choose the most informative features.
Model Selection: Select an appropriate machine learning model for the recommendation
system. Several models can be employed, including decision trees, random forests, support
vector machines (SVM), or deep learning models like neural networks. The choice of model
depends on the complexity of the problem and the available data.
Model Training: Split the dataset into training and testing sets. Use the training set to train the
selected machine learning model by fitting the data and adjusting the model's parameters. This
9
process involves feeding the model with input features and the corresponding output (crop
recommendations) and optimizing the model's performance using techniques such as gradient
descent or backpropagation.
Model Evaluation: Evaluate the trained model's performance using the testing dataset. Metrics
such as accuracy, precision, recall, and F1-score can be used to measure the model's
effectiveness in recommending suitable crops.
Deployment: Once the model's performance is satisfactory, deploy it as an application or
integrate it into an existing agricultural system. Farmers can input their specific conditions, and
the system will provide crop recommendations based on the trained model.

A software requirements specification (SRS) is a description of a software


system to be developed. It lays out functional and non-functional requirements, and may
include a set of use cases that describe user interactions that the software must provide. In order
to fully understand one’s project, it is very important that they come up with a SRS listing out
their requirements, how are they going to meet it and how will they complete the project. It
helps the team to save upon their time as they are able to comprehend how are going to go
aboutthe project. Doing this also enables the team to find out about the limitations and risks
early on. Requirement is a condition or capability to which the system must conform.
Requirement Management is a systematic approach towards eliciting, organizing and
documenting the requirements of the system clearly along with the applicable attributes. The
elusive difficulties of requirements are not always obvious and can come from any number of
sources.

FUCTIONAL REQUIREMENTS

Functional Requirement defines a function of a software system and how the system must
behave when presented with specific inputs or conditions. These may include calculations, data
manipulation and processing and other specific functionality. Following are the functional
requirements on the system:

1. All the data must be in the same format as a structured da


2. The data collected will be vectorized and sent across to the classifier

Non Functional Requirements

Non functional requirements are the requirements which are not directly concerned with the
specific function delivered by the system. They specify the criteria that can be used to judge

10
the operation of a system rather than specific behaviours. They may relate to emergent system
properties such as reliability, response time and store occupancy. Non functional requirements
arise through the user needs, because of budget constraints, organizationalpolicies and the
need for interoperability with other software and hardware systems.

Product Requirements

Correctness: It followed a well-defined set of procedures and rules to engage a conversation


with the user and a pre-trained classification model to compute also rigorous testing is
performed to confirm the correctness of the data. Modularity: The complete product is broken
up into many modules and well-defined interfaces are developed to explore the benefit of
flexibility of the product.

Robustness: This software is being developed in such a way that the overall performance is
optimized and the user can expect the results within a limited time with utmost relevancy and
correctness. Non functional requirements are also called the qualities of a system. These
qualities can be divided into execution quality and evolution quality. Execu- tion qualities are
security and usability of the system which are observed during run time, whereas evolution
quality involves testability, maintainability, extensibility or scalability

Organizational Requirements

The standards defined by we are used to develop the application which is the standard used by
the developers. Design Methods: Design is one of the important stages in the software
engineering process. This stage is the first step in moving from problem to the solution domain.
In other words, starting with what is needed design takes us to work how to satisfy the needs.

Basic Operational Requirements The customers are those that perform the eight primary
functions of systems engineering, with special emphasis on the operator as the key customer.
Operational requirements will define the basic need and, at a minimum, will be related to these
following points:

• Mission profile or scenario: It describes about the procedures used to accomplish mission
objective. It also finds out the effectiveness or efficiency of the system.

• Performance and related parameters: It points out the critical system parameters to

11
accomplish the mission.

• Utilization environments: It gives a brief outline of system usage. Finds out appropriate
environments for effective system operation.

• Operational life cycle: It defines the system lifetime.

Software Requirements:

• Operating System : Windows operating System 7/8/10


• Programming : Python, Django
• Deep Learning. :Support vector machine, Decision tree, Neural network
• Convolutional Neural Network.

Hardware Requirements:

• Processor : Intel
• Hard Disk : Min 160 GB
• Ram : Min 4GB
• Monitor : LED/LCD

12
➢ USE CASE DIAGRAM

Use case diagrams are generally known as behavioral descriptions that can be used to
explain the quick and difficult actions (use cases) that some devices or structures (issues) must
or can impose in cooperation with one or more external clients of the device (actors). Each use
case must provide a valued and preferred outcome for exceptional actors or stakeholders within
the system.

13
PYTHON INTRODUCTION

Python is easy to understand and a functional programming language to learn. It has an


efficient login structure and a reliable and simple approach to object-oriented programming.

Pythons,s modern syntax, intuitive scripting, and parsed nature make it an excellent language
for scripting and the rapid development of multi-region software on most architectures.

The Mega-style Python compiler and library are accessible as a demo or in binary for all main
stages for free from the Python website https://www.Python.Org/ and are free to distribute. The
excellent website also contains doubts and suggestions for various uncompressed Python
modules, packages, tools, 1/3 uncompressed components, and other documentation.

The Python compiler is easily extended with new functions and types of reports that run in C
or C++ (or other languages that can be called from C). Python is also appropriate as an
allowance language for customizable requests.

This instructible presents the reader casually to the main principles and landscapes of the
Python language and tool. It is helpful to have an accessible Python interpreter to enjoy the
applause, but all the examples are self-contained, allowing the researcher to learn effectively
offline.

Why to Learn Python?


Python is a high-level, text-based, cooperating, object-oriented language. Python is intended to
be fully human-legible. Major terms are often used in English because special languages use
punctuation and have much less grammatical structure than exceptional languages.

Python is important for learners and professionals to become an excellent software developer,
especially while at the same time being involved in the field of Internet improvement. I will
list some of the most important benefits of mastering Python:

Python is interpreted: Python is managed by the compiler at run time. You don't want to buy
the software before you go; It's miles like PERL and PHP.

Interactive Python: You can sit in the spark of Python and instantly interact with the compiler
to write your applications.

14
Python is a language for beginners: Python is an excellent language for beginners-level
programmers and benefits to develop a variability of packages, ranging from simple text
gratified dispensation to browsers and video games.

CHARACTERISTICS OF PYTHON

• Following are the main features of Python programming:

• Supports realistic and established programming approaches in adding to OOP.

• It can be used as a programming language or translated directly into secondary code


to create excellent programs.

• It has excellent dynamic information and makes it easy to check active species.

• Facilitates the automatic left-over chain.

• Easily covered with C, C++, COM, CORBA and Java.

History of Python

• Guido van Rossum developed the Python language at the US National Research
Institute for Mathematics and Informatics in the Netherlands in the late 1980s and early 1990s.

• Python comes from many languages, including ABC, Modula-3, C, C++, Algol-6,
Smalltalk, Unix shell, and micro script languages.

• Copyright by Python. Like Perl, the Python port code is now licensed under the GNU
General Public License (GPL).

• Python is now maintained at the Institute using an Intermediate Enhancement Kit,


although Guido van Rossum was instrumental in guiding its development.

Features of Python Language

Python's structures include −

• Ease of Learning: Python has some key phrases, a bot structure, and a unique syntax.
Allows the researcher to check the language rapidly.

• Ease of reading: Python code is described in addition to being viewed by the eye.

15
• Ease of maintenance: Easy to maintain reasonable Python supply code.

• Large and modern library: Most of the Python library is probably very moveable and
has a mobile platform, similar to UNIX, Windows.

• Interactive Mode: Python helps in cooperating method, which allows you to experiment
and debug pieces of code interactively.

• Portable: Python can track on a range of hardware systems and has the same edge on
all platforms.

• Expandable: We will add low-level components to the Python translator. These


modules allow developers to introduce or modify their devices to make them more
environmentally friendly.

• Databases: Python offers interfaces for all core business databases.

• GUI Programming: Python supports GUI packages that can be built and ported to many
Windows system calls, libraries, and systems, including Windows MFC, Macintosh, and Unix
X Window System.

• Scalable: Python offers a better look and feels for larger packages of scripts

Tkinter API :

Tkinter is the actual Python way of creating graphical user interfaces (GUIs), and it's covered
in all of my favorite Python distros. It's the only framework built into my favorite Python
library.

This Python framework delivers an interface to the Tk toolkit and acts as an object-oriented
thin layer on top of Tk. Tk Toolkit is a cross-platform set of graphical management, also known
as user interface elements, for building application interfaces.

This framework provides Python clients an easy way to create GUI agents that allow the use
of UI elements defined in the Tk Toolkit. Tk-Tools can create buttons, menus, fact fields, and
much more. In the Python tool. Once created, these graphic traders can collaborate or interact
with unique skills, abilities, strategies, stats or UI factors.

16
HTML :

HTML stands for Hypertext Markup Language. It is a widely used markup linguistic for web
pages. It permits creating and structuring of segments, paragraphs, and hyperlinks utilizing
HTML operators (the building blocks of a website), including tags and characteristics.

HTML has many use cases, most notably:

Web Development: Developers utilized HTML code to shape how a browser demonstrations
web page elements that contain text content, hyperlinks, and media files.

Internet navigation: Users can simply navigate between related pages and sites and insert
hyperlinks as HTML is used closely to embed links.

Web docume:ts. HTML allows the document to be prepared and formatted correspondingly
to Microsoft Word. It should also be noted that HTML is not always an option as a
programming language, as it can no longer generate dynamic features. It is now measured a
valid Internet audience. The World Wide Web Consortium (W3C) upholds and develops the
HTML specification, although it is updated daily.

CSS :

Cascading Style Sheets (CSS), called CSS, is a simple strategy language that simplifies creating
attractive websites.

CSS is concerned with the look and feel of a part of a web page on the Internet. With CSS, you
can manage text content shading, font, column size, formatting, traditional snapshots or colours
used, layout design, display changes for specific devices and display sizes, and other results.

CSS is comfortable to know and understand, but it delivers efficient handling of the flow of an
HTML record. CSS is often confused with HTML or XHTML markup languages.

CSS is designed and supported by a group in the W3C known as the CSS Working Group. The
CSS process set produces files called specs. When the specification is expressed and formally
authorised by W3C members, it becomes advice.

17
These confirmed specifications are named suggestions because the W3C does not support the
actual performance of the language. Separate companies and organizations create this program.

Javascript :

JavaScript is a dynamic programming language for special computer systems. It is lightweight


and suitable for application as part of web pages whose packages allow custom scripts to
interact with people and create dynamic pages. It is an interpreted programming language with
object-oriented capabilities.

JavaScript was first named LiveScript, but Netscape changed its name to JavaScript, probably
because I laughed with Java. JavaScript was first considered in Netscape 2.Zero in 1995 under
the name LiveScript. Half of the specified language reason is integrated into Netscape, Internet
Explorer and various Internet browsers.

Client-side JavaScript is the most widely used form of the language. The script must be omitted
or referenced in the browser's HTML input to interpret the code.

JavaScript's forward leak mechanism offers many benefits over traditional CGI server scripts.
For example, you can use JavaScript to confirm that the customer entered a valid email address
in the form question.

JavaScript code ends even when the consumer submits the form; If all inputs are valid, they
can be sent to the web server.

JavaScript can inspire client-initiated mathematical activities, including button clicks, link
navigation, and movements initiated with the help of some other character, both explicitly
and implicitly.

LIBRARIES :

Beautiful Soup:

Beautiful Soup is a Python library for buying information from HTML and XML files. It works
with your favourite parser to provide intuitive ways to navigate, view, and create parse trees.
This usually saves programmers hours or days of work.

18
This guide suggests all the simple capabilities of four beautiful soups through examples. I'll
show you the library's intent, how it works, how to use it, how to do what you want it to do,
and what to do if it doesn't meet your expectations..

Pandas :

Python Pandas is an open-source library that provides real and efficient manipulation in Python.
This academy is designed for all amateurs and experts.

It is used for statistical analysis in Python and was developed with the help of Wes McKinney
in 2008. Our international software provides all the basic and advanced ideas of Python Pandas,
including Numpy, Data Operation, and Time Series.

Open CV:

OpenCV is a large open-source library for digital computing, prediction, and testing of
hardware and image processing systems. OpenCV supports many programming languages
except Python, C++, Java, etc. You can create animations and images to understand someone's
devices, faces, or fonts. When combined with several libraries, as well as the Numpy library,
which is highly optimized for numerical operations, the number of weapons in your arsenal
will increase; Something you can do in Numpy can be combined withOpenCV.

Seaborn :

Seaborn is a great visual library for graph data pictures in Python. It provides normal patterns
and exceptional color palettes to make your data plots attractive. It is constructed entirely on
the Matplotlib library and is carefully combined into the Pandas data structures.

Seaborn's goal is to make fiction a vital part of discovering truth and knowledge. Provides APIs
that focus on the dataset, so we scroll through summary visualizations of equal variables to
get a better knowledge of the dataset.

Sklearn :

sklearn is an open-view Python library that extends various algorithms for system domain, pre-
processing, Go validation, and visualization through a unified interface. A simple and
environmentally friendly device for data mining and statistical analysis. It includes various
separations, regression, clustering algorithms, auxiliary vector machines, random forests,

19
gradient optimization, fitting strategies, and more. It is available to everyone and can be reused
in certain contexts. Based on NumPy pico, SciPy and Matplotlib. Freely available and
commercially available: BSD license.

Wxpython :

Python offers the wxpython module that allows us to create a user-friendly GUI. It's an open-
source module, so it's free for miles for anyone and anyone to use, and the source code is
available for anyone to view and customize.

It is a GUI toolkit for the Go platform for Python; Phoenix Edition Phoenix is the most superior
next generation of wxPython, specializing in speed, storage, and scalability.

Numpy:

NumPy is a widely used matrix processing package. The multidimensional array object
provides high performance and tools for employed with these selections. It is the basic package
for medical calculating with Python. It is open-source software. It includes various features
besides these important features.

Besides its obvious clinical benefit, NumPy can also be used as an effective multidimensional
box with global records. Any type of dataset can be described using Numpy, allowing NumPy
to be seamlessly and quickly integrated with a rich type of database.

Python-Data Base Communication

MySQL is an open-source interactive SQL database organization system. MySQL is one of the
high-quality RDBMS units used mainly for the growth of many web-based programs. MySQL
is advanced, marketable and compatible with MySQL AB, a Swedish company. This tutorial
will provide a quick start to MySQL and make you feel comfortable with MySQL
programming.

MySQL Database

MySQL is a fast and easy-to-use database management device used by many organizations,
large and small. MySQL is developed, marketed and supported by MySQL AB, a Swedish
company. MySQL has become very popular for several good reasons:

20
• MySQL has been modified to be released under an open-source license. So you don't
need to pay anything to use it.

• MySQL is a powerful program in itself. It caters to a huge subset of the more


expensive and powerful database software.

• MySQL takes advantage of the existing form of the popular SQL Stats.

• MySQL runs on many commercial languages and architectures, including PHP,


PERL, C, C++, JAVA, etc.

• MySQL works out of the box and works correctly regardless of large loggers.

21
SYSTEM DESIGN

SYSTEM ARCHITECTURE
System Architecture a) Crop Recommendation This module can be implemented by these
method. Datasets can be acquired from kaggle to train and test the data for tillage.Values are
taken by the following site-specific factors are required of users: pH, N, P, and K (all of them
in%), temperature (in °C), relative humidity (in%), and rainfall (in mm).The ensemble model
with majority voting method serves as the basis for the recommendation system. These are
the component models: SVM, Random Forest, Naive Bayes,KNN. After the model is trained,
a .pkl file is created.In order to suggest the crop based on input, a.pkl file is imported. Then
user can get the predicted crop based on their inputs.

22
23
UML DIAGRAMS

Unified Modelling Language (UML) is the language of the way to presentation diagrams in
software engineering. The primary purpose of UML is to describe a modern approach to
imagine the way the tool is designed. They are very similar to the schemes utilized in other
production fields.
UML is not a programming language; it is a graphical language alternative. We utilise UML
diagrams to represent system behaviour and figure. UML designates software engineers,
entrepreneurs, and hardware engineers with modelling, structure, and research. The Object
Management Group (OMG) followed the Standard Modelling Language benchmark in 1997.
OMG has always controlled it with this in mind. The International Organization for
Standardization (ISO) disseminated UML as an authorized option in 2005. The UML has been
modified over time and is regularly revisited.
CLASS DIAGRAM:

The class diagram is static and represents the program's continuous view. A class diagram is
not always the best quality for visualizing, describing and reporting the unique components of
the tool but also for creating executable code to enforce the program. An Class diagram
describes the properties and operations of the separation as well as the device boundaries. Level
diagrams are often used in object-oriented modelling structures because they can be nice UML
diagrams easily tuned for object-oriented languages
.

24
SEQUENCE DIAGRAM:

The sequence diagram illustrates the relations among objects in sequential ordering, the order
in which these relations inhabit an area. We can also utilize proper schemas of presentations or
suitable procedures to consult a sequence diagram. Sequence diagrams define how and in what
order the objects occur on the machine. Software developers and organizations generally
utilize these diagrams to record and analyses the appetites of new and existing systems.

25
ACTIVITY DIAGRAM:

We use of activity diagram is to show management flow on the device. We can also use a hobby
chart to indicate the steps involved in implementing the use case—a copy of concatenated and
synchronized actions using action graphs. So, we visualize the workflow using a hobby chart.
The hobby scheme specializes in going conditions with the flow and

sequence in which it occurs. We define or describe what reasons a specific occasion to use an
activity diagram.

26
DATABASE DESIGN:

Suggested Uses for SQLite:

• Internet of Things database. SQLite is a common desire for the database engine in cell
phones, PDAs, MP3 players, TV boxes and many other digital devices. SQLite has a
small code footprint, which makes it particularly reliable for green usage of memory,
disk space, and bandwidth. Now it does not require any updates from the database
administrator.
• Design an application report. Use an SQLite database instead of using open () to
comment out the XML, JSON, CSV, or some exact disk document layout your
application uses. You'll avoid hiding and troubleshooting from a scanner, your records
will be easily accessible in a hive, and your updates will be transactional.
• Site database. Because it requires no configuration and stores logs in regular disk
documents, SQLite is a popular database for small and medium-sized websites.
• An opportunity for an RDBMS organization. SQLite is often used as an RDBMS proxy
for demos or testing. SQLite is fast and requires no configuration, which eliminates
many scanning problems and makes demos great and easy.

27
Data Set Description
For the system, we are using various datasets all downloaded for government website

and kaggle.

Datasets include:-

Cost of cultivation per ha dataset for major crops in each state

Yield dataset

Modal price of crops

Standard price of crops

Soil nutrient content dataset

Rainfall Temperature dataset

Yield Dataset: This dataset contains yield for 16 major crops grown across all

the states in kg per hectare.Yield of 0 indicates that the crop is not cultivated

in the respective state.

• Cost of Cultivation dataset:This dataset provides the cost of cultivation

for eachcrop in Rs. per hectare.

• Modal price of crops: This dataset gives the average market prices

for thosecrops over a period of two months

• Standard price of crops:This dataset gives the current market price of the

cropsin Rs per hectare .

• Soil nutrient content dataset:This dataset has five columns with the

attributesin the order-State,Nitrogen content,Phosophorous

content,Potassium content

• and average ph.The nutrient content is represented with encoded


alphabetsVL,L,M,H,VHwith the meaning:

28
VL -Very Low

L-Low

M-Medium

H-High

VH-Very high

• Rainfall Temperature dataset:This dataset contains crops,max and min rainfall,max and min
temprature,max and min rainfall and ph values.

29
Machine Learning Algorithms

K-Nearest Neighbor Classifier

KNN is a type of supervised machine learning that can be used to solve a wide range of issues.
Classification and regression are examples of challenges that can be addressed. The number of
nearest neighbours to a newly

Decision Tree

Decision Trees (DTs) comes under supervised learnin for classification and regression. A tree
representation is used to solve the problem, with each leaf node representing a class label.
and the tree's interior node represents attributes.

Entropy:

H(S) = – Pi(S) log2 Pi(S) (2)

Information Gain:

IG(S,A) = H(S) – vValues(A)( |Sv|/S) H(Sv) (3)

Naive Bayes

The Bayes theorem is used to create a simple probablistic classifier called Naive Bayes.Naive
Bayes classifiers assume that the value of one feature is independent of the value ofany
other feature given the class variable.

P(A|B) = (P(B|A) * P(A) )/P(B) (4)

SUPPORT VECTOR MACHINE

A crop recommendation system based on Support Vector Machines (SVM) is a machine


learning algorithm that can

predict which crops are best suited to a particular area based on various factors such as soil
type, climate, and water

30
availability. SVM is a powerful classification algorithm that can handle high-dimensional
datasets with a relatively

small number of observations, making it an ideal choice for crop recommendation systems.

SVC (Support Vector Classifier) is a type of machine learning algorithm that falls under the
category of supervised

learning. It is a variant of the Support Vector Machine (SVM) algorithm that is used for
classification tasks.SVC works

by finding the hyper plane that best separates the different classes in the data. This
hyperplane is chosen such that it

maximizes the margin between the classes, i.e., the distance between the hyperplane and the
nearest data points of each

class. Once the hyperplane is found, SVC can classify new data points by determining which
side of the hyperplane

they lie on.

SVC is a powerful algorithm that can handle both linear and non-linear classification tasks. It
can also handle highdimensional data and works well with small to medium-sized datasets.
One of the advantages of SVC is that it is less

prone to over fitting than other classification algorithms, as it maximizes the margin between
classes.

In Python, SVC is implemented in the scikit-learn library, which provides a range of tools for
machine learning tasks.

The SVC class in scikit-learn provides a range of hyper parameters that can be tuned to
optimize the algorithm's

performance, such as the regularization parameter and the kernel function.Overall, a crop
recommendation system

31
based on SVM and SVC can be a valuable tool for farmers to optimize crop yields, reduce
waste, and increase profits

while contributing to sustainable agriculture practices.

32
SOURCE CODE

User side views.py

fromdjango.http import HttpResponse

fromdjango.shortcuts import render

fromdjango.contrib import messages

# Create your views here.

defuser_login_check(request):

context = {'form': UserLoginForm()}

ifrequest.method == 'POST':

print('=000=' * 40, request.POST)

form = UserLoginForm(request.POST)

print('VALID:', form.is_valid())

ifform.is_valid():

username = form.cleaned_data.get('username')

password = form.cleaned_data.get('password')

print('UserName:', username)

print('Password:', password)

try:

user = UserRegistrationModel.objects.get(username=username, password=password)

print("User Object", user.status)

status = user.status

if status == 'activated':

request.session['username'] = user.username

33
request.session['password'] = user.password

return render(request, 'users/user_home.html')

else:

messages.success(request, 'Your A/C has not been activated by admin.')

return render(request, 'user_login.html', context)

except Exception as e:

print("Got Exception: ", e)

pass

messages.error(request, 'Invalid username or password.')

context = {'form': UserLoginForm()}

return render(request, 'user_login.html', context)

defuser_register_action(request):

ifrequest.method == 'POST':

form = UserRegistrationForm(request.POST)

ifform.is_valid():

form.save()

messages.success(request, 'Your request has been submitted, Admin will get back to you
soon.')

context = {"form": UserRegistrationForm()}

return render(request, 'register.html', context)

else:

messages.error(request, 'Email Already Exists.')

context = {

34
'form': UserRegistrationForm()

return render(request, 'register.html', context)

defadd_data(request):

return render(request, 'users/add_data.html'

defcrop_prediction(request):

ifrequest.method == 'POST':

N = request.POST.get('nitrogen')

P = request.POST.get('Phosphorous')

K = request.POST.get('Pottasium')

ph = request.POST.get('ph')

rainfall = request.POST.get('Rainfall')

def fertilizer(request):

import pandas as pd

importos

fromdjango.conf import settings

path = os.path.join(settings.MEDIA_ROOT, 'fertilizer.csv')

df = pd.read_csv(path)

df = df[['Crop', 'N', 'P', 'K', 'pH', 'soil_moisture']]

df = df.head(96).to_html

return render(request, 'users/fertilizer.html', {'dat': df})

35
SYSTEM TESTING

SYSTEM TEST

The most important goal of system testing is to identify errors in programming. Testing tries
to find every possible defect or disorder in a commodity product. Provides a strategy for
checking the overall performance of components, sub-assemblies, assemblies, and the latest
product. It is how the software works to ensure that the software engine meets consumers'
desires and expectations and stops failing in unacceptable ways. There are different types of
opinions. Each test type addresses your exact validation needs.

TYPES OF TESTS:
System testing is a degree of software testing in which complete and integrated software is
examined. This test is to assess the machine's compliance with the requirements.

In system testing, the integration that checks for previous components is taken as input. The
purpose of the integrity check is to identify any violations between the devices grouped. System
tests detect faults in both embedded devices and throughout the method. The result ofa device
test is the behavior detected by a problem or system during the scan.
TYPES OF TESTING

Various types of system testings are shown in below :

➢ Acceptance testing
➢ System testing
➢ Integration testing
➢ Unit testing

TYPES OF SOFTWARE TESTING:

ACCEPTANCE TEST

In the Acceptance test, a test method that is performed to determine whether or not the program
system meets the required specifications. The primary reason for this verification is to assess
the device's compliance with business requirements and verify whether the miles have met the
specified delivery criteria for end users.

36
SYSTEM TESTING

System tests are usually run with the help of a team, and this is unbiased to the upgrade group
so you can measure the first class of the fair system. It includes both functional and non-
functional tests.

INTEGRATION TESTING

When completing the reputation of unit testing, units or module that provides a batch for
integration testing will be included. The purpose of integration tests is to confirm practice,
performance, and reliability between compact units.
UNIT TESTING

In unit testing, a test method that is used to test individual units and it is to determine if there
are any problems with the developer himself. It indicates useful correction for independent
units.
FUNCTIONAL TEST
Functional tests provide methodological presentations that demonstrate that the capabilities
examined are available in particular with commercial assistance, technical desires, device
documentation, and people manuals.

Functional testing is aimed at subsequent devices:

Systems/Procedures: interfacing systems or procedures must be invoked.

37
Sample test cases

38
LINEAR REGRESSION:
Linear regression fits a straight-line between rainfall, temperature, pH, and production which would
return a y-pred value for each crop.
In the end, the crops are sorted based on the y- or value returned by the linear regression model using
quick sort giving the crop with the best score first in the list.
NEURAL NETWORK:
Our implementation of the neural network is facilitated with the help of the Keras module.
A sequential model is implemented with 3 input layers and 15 output layers which gives the
sustainability of each 15 crops given the input in terms of state, month, and soil.
RESULTS AND PERFORMANCE ANALYSIS
The proposed system is implemented along with two algorithms namely, Linear regression and Neural
network using Pandas, Numpy, Tensorflow, Keras and Sickitlearn libraries, tools, and Python as the
programming language. Whereas both the algorithms are based on supervised learning.
The results are analysed and are being compared with crop recommendation using K Nearest
Neighbour, K Nearest Neighbour with K Nearest Neighbour with cross validation, Decision Tree,
Naive Bayes and Support Vector Machine [13] in terms of accuracy.

39
Fig.3: Regression model output

Fig. 4: Crop recommendation

Fig.5: Input for the predictor

40
Fig.6: Crop Sustainability prediction values

Fig. 7: Comparison of proposed system with other


machinelearning algorithm

TABLE 1: CROP RECOMMENDATION ACCURACY

S.No Algorithms Accuracy

1 Decision Tree 81%

2 K Nearest Neighbour 85%

K Nearest Neighbour
3 88%
with cross validation

4 Linear Regression Model 88.26%

5 Naive Bayes 82%

6 Neural Network 89.88%


7 Support Vector Machine 78%

41
SCREEN SHOTS

Home page:

User register:

42
User Add Data

Add data final results:

43
User view data

User view dataset

44
Admin home page:

Admin activate users:

45
User login

User home page

46
CONCLUSION

This machine allows the farmer to choose the right crop through the supply Ideas that ordinary
farmers do not have and therefore diminish Possibility of bad harvest and increase in
productivity. In addition, it is prohibited incurred losses. The gadget can be extended to the
web. It can be reached by tens of millions of growers in the United States. We can Obtaining
an accuracy of 89.88 percent from the Neurological Society and 88.26% accuracy of the
linear regression model

47

You might also like