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

Agricultural Crop Recommendations based on

Productivity and Season


A PROJECT REPORT
Submitted to

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY ANANTAPUR,


ANANTHAPURAMU
In partial fulfilment of the requirementS for the award of the degree of
BACHELOR OF TECHNOLOGY
IN
COMPUTER SCIENCE AND ENGINEERING
By

18BF1A0524 C Reddi Nikhitha


18BF1A0517 B Sai Yogeeswar Reddy
18BF1A0529 Dasari Vaishnavi
18BF1A0534 Elapa Pavan
Under the Esteemed Guidance of
M. Vikram, M.E., (Ph.D)
Associate Professor

Department of Computer Science and Engineering


SRI VENKATESWARA COLLEGE OF ENGINEERING
Permanent Affiliation to JNTUA & Approved by AICTE Recognized under Sections 2(f) & 12(B) of
UGC act 1956.Accredited by NBA, New Delhi & NAAC Bangalore with ‘A’ Grade, Tirupati-
517507, Chittoor, A.P.
2018-2022
SRI VENKATESWARA COLLEGE OF ENGINEERING
Permanent Affiliation to JNTUA & Approved by AICTE Recognized under Sections 2(f) &
12(B) of UGC act 1956.Accredited by NBA, New Delhi & NAAC Bangalore with ‘A’ Grade,
Tirupati-517507, Chittoor, A.P.

Department of Computer Science and Engineering

CERTIFICATE
This is to certify that the project entitled “AGRICULTURAL CROP
RECOMMENDATIONS BASED ON PRODUCTIVITY AND SEASON” is a
bonafide work done by “C Reddi Nikhitha 18BF1A0524, B Sai Yogeeswar Reddy
18BF1A0517, Dasari Vaishnavi 18BF1A0529, Elapa Pavan 18BF1A0534”, in
partial fulfilment of the requirements for the award of the degree of Bachelor of
Technology in Computer Science and Engineering from Jawaharlal Nehru
Technological University Anantapur, Anantapauramu during the year 2021-2022.

Project Guide Head of the Department


M. Vikram Dr. R Swathi
M.E., (Ph.D) M.Tech, Ph.D(CSE)
Associate Professor Associate Professor

Department of CSE Department of CSE

SV College of Engineering. SV College of Engineering.

Tirupati – 517 507 Tirupati – 517 507

Viva-Voice date:

Internal Examiner External Examiner


DECLARATION

We hereby declare that the project report entitled “AGRICULTURAL CROP

RECOMMENDATIONS BASED ON PRODUCTIVITY AND SEASON” done


by us under the esteemed guidance of M. Vikram, M.E., (Ph.D), Associate Professor and
is submitted in partial fulfilment of the requirements for the award of the Bachelor’s of Technology
in Computer Science and Engineering.

Date : C Reddi Nikhitha(18BF1A0524)


Place : B Sai Yogeeswar Reddy(18BF1A0517)
Dasari Vaishnavi(18BF1A0529)
Elapa Pavan(18BF1A0534)
ACKNOWLEDGEMENT

We are thankful to our guide M. Vikram, M.E., (Ph.D), Associate Professor for his
valuable guidance and encouragement. His helping attitude and suggestions have helped us in
the successful completion of the project.

We are thankful to project coordinator Dr. P. Dileep Kumar Reddy, Associate Professor
for his guidance and regular schedules.

We would like to express our gratefulness and sincere thanks to Dr. R Swathi, Head,
Dept of CSE, for her kind help and encouragement during the course of our study and in the
successful completion of the project work.

We have great pleasure in expressing our hearty thanks to our beloved Principal Dr.
N. Sudhakar Reddy for spending his valuable time with us to complete this project.

Successful completion of any project cannot be done without proper support and
encouragement. We sincerely thank the Management for providing all the necessary facilities
during the course of study.

We would like to thank our parents and friends, who have the greatest contributions in
all our achievements, for the great care and blessings in making us successful in all our
endeavors.

C Reddi Nikhitha(18BF1A0524)

B Sai Yogeeswar Reddy(18BF1A0517)

Dasari Vaishnavi(18BF1A0529)

Elapa Pavan(18BF1A0534)
CONTENTS

ABSTRACT ⅰ

LIST OF ABBREVATIONS ⅱ

LIST OF FIGURES ⅲ

CHAPTER 1 INTRODUCTION 01

CHAPTER 2 PROJECT DESCRIPTION 03


2.1 Problem Definition
2.2 Project Details

CHAPTER 3 ENVIRONMENTS 04
3.1 Operating System Compatibility
3.2 Hardware Requirements
3.3 Data Centre Requirements
3.4 Software Requirements

CHAPTER 4 FEASIBILITY STUDY 33


4.1 Operational Feasibility
4.2 Economic Feasibility
4.3 Technical Feasibility

CHAPTER 5 SYSTEM ANALYSIS 34


5.1 Existing System
5.1.1 Disadvantages of Existing System
5.2 Proposed System
5.2.1 Advantages of Proposed system
5.3 Analysis

CHAPTER 6 SYSTEM ARCHITECTURE 36


6.1 Architecture
6.1.1 Service Provider
6.1.2 End User
6.2 UML Diagrams
6.2.1 Use case Diagram
6.2.1.1 Use case Diagram for Service Provider
6.2.1.2 Use case Diagram for End User
6.2.2 Class Diagram
6.2.3 Sequence Diagram
6.2.4 Collaboration Diagram
6.2.5 Activity Diagram
6.2.5.1 Activity Diagram for Service Provider
6.2.5.2 Activity Diagram for End User
6.2.6 Deployment Diagram

CHAPTER 7 SYSTEM IMPLEMENTATION 58


7.1 Performance Evaluation
7.2 Service Provider
7.3 End User

CHAPTER 8 TESTING 59
8.1 Testing Principles
8.2 Testing Strategy and Approach
8.3 Testing Objectives
8.3.1 Black Box Testing

CHAPTER 9 SAMPLE SOURCE CODE 66

CHAPTER 10 RESULTS 79

CHAPTER 11 CONCLUSION & FUTURE ENHANCEMENTS 85

CHAPTER 12 BIBLIOGRAPHY 86
ABSTRACT

Most Parts in India faces uncertainty in agriculture which decreases its production. With more
population and area, more productivity should be achieved but it cannot be reached. Farmers have
words-of-mouth in past decades but now it cannot be used due to climatic factors. Agricultural factors
and parameters make the data to get insights about the Agri-facts. Growth of IT world drives some
highlights in Agriculture Sciences to help farmers with good agricultural information. Intelligence of
applying modern technological methods in the field of agriculture is desirable in this current scenario.
Machine Learning Techniques develops a well-defined model with the data and helps us to attain
predictions. Agricultural issues like crop prediction, rotation, water requirement, fertilizer
requirement and protection can be solved. Due to the variable climatic factors of the environment,
there is a necessity to have a efficient technique to facilitate the crop cultivation and to lend a hand
to the farmers in their production and management. This may help upcoming agriculturalists to have
a better agriculture. A system of recommendations can be provided to a farmer to help them in crop
cultivation with the help of data mining. To implement such an approach, crops are recommended
based on its climatic factors and quantity. Data Analytics paves a way to evolve useful extraction
from agricultural database. Crop Dataset has been analyzed and recommendation of crops is done
based on productivity and season


LIST OF ABBREVATIONS

1. AR Agricultural Recommendation
2. UML Unified Modelling Language
3. XML eXtensible Markup Language
4. API Application Program Interface
5. CSV Comma-Separated Values
6. UI User Interface
7. URL Uniform Resource Locator
8. PAR Per Acre Results


LIST OF FIGURES

FIG NO FIG NAME PAGE NO

6.1 ARCHITECTURE 37

6.2.1 Use Case Diagram 45

6.2.2 Class Diagram 48

6.2.3 Sequence Diagram 51

6.2.4 Collaboration Diagram 52

6.2.5 Activity Diagram 55

6.2.6 Deployment Diagram 57

iii
Agricultural Crop Recommendations based on Productivity and Season

CHAPTER-1
INTRODUCTION
Tamil Nadu being 7th largest area in India has 6th largest population. It is t e leading
producer of agriculture products. Agriculture is the main occupation of Tamil Nadu people.
Agriculture has a sound tone in this competitive world. Cauvery is the main source of water.
Cauvery delta regions are called as rice bowl of Tamil Nadu. Rice is the major crop grown in Tamil
Nadu. Other crops like Paddy, Sugarcane, Cotton, Coconut and groundnut are grown. Bio-
fertilizers are produced efficiently. Many areas Farming acts as major source of occupation

Agriculture makes a dramatic impact in the economy o f a country. Due to the change of
natural factors, Agriculture farming is degrading now-a days. Agriculture directly depends on the
environmental factors such as sunlight, humidity, soil type, rainfall, Maximum and Minimum
Temperature, climate, fertilizers, pesticides etc. Knowledge of proper harvesting of crops is in
need to bloom in Agriculture. India has seasons of

1. Winter which occurs from December to March


2. Summer season from April to June
3. Monsoon or rainy season lasting from July to September and
4. post-monsoon or autumn season occurring from October to November.

Due to the diversity of season and rainfall, assessment of suitable crops to cultivate
is necessary. Farmers face major problems such as crop management, expected crop yield an
productive yield from the crops. Farmers or cultivators need proper assistant regarding crop
cultivation as now-a-days many fresh youngsters are interested in agriculture

Impact of IT sector in assessing real world problem is moving at a faster rate. Data
is increasing day by day in field of agriculture. With the advancement in Internet o f Things, there
are ways to grasp huge data in field of Agriculture. There is a need of a system to have obvious
analyzes of data of agriculture and extract or use useful information from the spreading data. To
get insights from data, it has to be learnt.

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


1
Agricultural Crop Recommendations based on Productivity and Season

Extracting knowledge from the data set is the process of mining. It aims to give accurate
results to farmers. It finds hidden patterns. It discovers useful knowledge from the tremendous data
set. It is one of the processes in Knowledge Discovery in Databases (KDD). Apart from the KDD
process, in recent days with the development in IT world, Machine Learning has emerged to handle
big volume of data and involves high performance computing too. Application of Machine
Learning in Agriculture peaks up day by day. Machine Learning techniques are used in crop
management, livestock management, water management and soil management recommendation
algorithm. They provide personalized products in E-Commerce. These recommendation concepts
are used in agriculture in this project to provide crops to sow. Simple Data Analytics is used on
crop dataset and personalization of agricultural crops are suggested to famers.

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


2
Agricultural Crop Recommendations based on Productivity and Season

CHAPTER-2
PROJECT DESCRIPTION

2.1 PROBLEM DEFINITION


Due to the diversity of season and rainfall, assessment of suitable crops to cultivate is necessary.
Farmers face major problems such as crop management, expected crop yield an productive yield
from the crops. Farmers or cultivators need proper assistant regarding crop cultivation as now-a-
days many fresh youngsters are interested in agriculture Impact of IT sector in assessing real world
problem is moving at a faster rate. Data is increasing day by day in field of agriculture. With the
advancement in Internet o f Things, there are ways to grasp huge data in field of Agriculture. There
is a need of a system to have obvious analyzes of data of agriculture and extract or use useful
information from the spreading data. To get insights from data, it has to be learnt.
2.2 PROJECT DETAILS

The Project aims to give accurate results to farmers. It finds hidden patterns. It discovers
useful knowledge from the tremendous data set. It is one of the processes in Knowledge Discovery
in Databases (KDD). Apart from the KDD process, in recent days with the development in IT
world, Machine Learning has emerged to handle big volume of data and involves high performance
computing too. Application of Machine Learning in Agriculture peaks up day by day. Machine
Learning techniques are used in crop management, livestock management, water management and
soil management recommendation algorithm. They provide personalized products in E-
Commerce. These recommendation concepts are used in agriculture in this project to provide crops
to sow. Simple Data Analytics is used on crop dataset and personalization of agricultural crops are
suggested to famers.

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


3
Agricultural Crop Recommendations based on Productivity and Season

CHAPTER-3
ENVIRONMENTS
3.1. OPERATING SYSTEM COMPATIBILITY
Both 32-bit and 64-bit OS versions are supported. Enterprise Control Room operating system
compatibility Enterprise Control Room can be installed on machines running the following
operating systems.

3.2 HARDWARE REQUIREMENTS


➢ Processor- Intel (R) Core (TM) i3-4200U

➢ CPU - 1.6GHz

➢ RAM:4 GB

➢ Hard Disk: 500 GB.

3.3 DATA CENTER REQUIREMENTS


DATABASE REQUIREMENTS
The list of supported databases, database server type, version, hardware, and operating system
requirements, and database backup and recovery requirements.
3.4 SOFTWARE REQUIREMENTS
❖ Operating system : Windows 10.

❖ Coding Language : Python.

❖ Front-End : Html, css, javascript.

❖ Back-End : Django-ORM

❖ Data Base : MySQL (WAMP Server).

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


4
Agricultural Crop Recommendations based on Productivity and Season

Introduction to Python Technology


Python is a high-level, interpreted, interactive and object-oriented scripting language. Python
is designed to be highly readable. It uses English keywords frequently where as other languages
use punctuation, and it has fewer syntactical constructions than other languages.

• Python is Interpreted: Python is processed at runtime by the interpreter. You do not need
to compile your program before executing it. This is similar to PERL and PHP.

• Python is Interactive: You can actually sit at a Python prompt and interact with the
interpreter directly to write your programs.

• Python is Object-Oriented: Python supports Object-Oriented style or technique of


programming that encapsulates code within objects.

• Python is a Beginner's Language: Python is a great language for the beginner-level


programmers and supports the development of a wide range of applications from simple
text processing to WWW browsers to games.

History of Python

Python was developed by Guido van Rossum in the late eighties and early nineties at the National
Research Institute for Mathematics and Computer Science in the Netherlands.

Python is derived from many other languages, including ABC, Modula-3, C, C++, Algol-68,
SmallTalk, and Unix shell and other scripting languages.

Python is copyrighted. Like Perl, Python source code is now available under the GNU General
Public License (GPL).

Python is now maintained by a core development team at the institute, although Guido van
Rossum still holds a vital role in directing its progress.

Python Features
Python's features include:

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


5
Agricultural Crop Recommendations based on Productivity and Season

• Easy-to-learn: Python has few keywords, simple structure, and a clearly defined syntax.
This allows the student to pick up the language quickly.

• Easy-to-read: Python code is more clearly defined and visible to the eyes.

• Easy-to-maintain: Python's source code is fairly easy-to-maintain.

• A broad standard library: Python's bulk of the library is very portable and cross-
platform compatible on UNIX, Windows, and Macintosh.

• Interactive Mode: Python has support for an interactive mode which allows interactive
testing and debugging of snippets of code.

• Portable: Python can run on a wide variety of hardware platforms and has the same
interface on all platforms.

• Extendable: You can add low-level modules to the Python interpreter. These modules
enable programmers to add to or customize their tools to be more efficient.

• Databases: Python provides interfaces to all major commercial databases.

• GUI Programming: Python supports GUI applications that can be created and ported to
many system calls, libraries and windows systems, such as Windows MFC, Macintosh,
and the X Window system of Unix.

• Scalable: Python provides a better structure and support for large programs than shell
scripting.

Python has a big list of good features:

• It supports functional and structured programming methods as well as OOP.

• It can be used as a scripting language or can be compiled to byte-code for building large
applications.

• It provides very high-level dynamic data types and supports dynamic type checking.

• IT supports automatic garbage collection.

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


6
Agricultural Crop Recommendations based on Productivity and Season

• It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java.

ARITHMETIC OPERATORS

Operator Description Example

+ Addition Adds values on either side of the operator. a+b=


30

- Subtraction Subtracts right hand operand from left hand operand. a–b=-
10

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


7
Agricultural Crop Recommendations based on Productivity and Season

* Multiplies values on either side of the operator a*b=


Multiplication 200

/ Division Divides left hand operand by right hand operand b/a=2

% Modulus Divides left hand operand by right hand operand and returns b%a=
remainder 0

** Exponent Performs exponential (power) calculation on operators a**b =10


to the
power 20

// Floor Division - The division of operands where the result is the 9//2 = 4
quotient in which the digits after the decimal point are removed. But and
if one of the operands is negative, the result is floored, i.e., rounded 9.0//2.0
away from zero (towards negative infinity): = 4.0, -
11//3 = -
4, -
11.0//3 =
-4.0

ASSIGNMENT OPERATOR

Operator Description Example

= Assigns values from right side operands to left side operand c=a+b
assigns
value of a
+ b into c

+= Add AND It adds right operand to the left operand and assign the result to c += a is
equivalent

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


8
Agricultural Crop Recommendations based on Productivity and Season

left operand to c = c +
a

-= Subtract It subtracts right operand from the left operand and assign the c -= a is
AND result to left operand equivalent
to c = c -
a

*= Multiply It multiplies right operand with the left operand and assign the c *= a is
AND result to left operand equivalent
to c = c *
a

/= Divide AND It divides left operand with the right operand and assign the result c /= a is
to left operand equivalent
to c = c /
ac /= a is
equivalent
to c = c /
a

%= Modulus It takes modulus using two operands and assign the c %= a is equivalent to
AND result to left operand c=c%a

**= Exponent Performs exponential (power) calculation on operators c **= a is equivalent


AND and assign value to the left operand to c = c ** a

//= Floor It performs floor division on operators and assign c //= a is equivalent to
Division value to the left operand c = c // a

IDENTITY OPERATOR

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


9
Agricultural Crop Recommendations based on Productivity and Season

Operator Description Example

is Evaluates to true if the variables on either side of x is y,


the operator point to the same object and false here is results
otherwise. in 1 if id(x)
equals id(y).

is not Evaluates to false if the variables on either side of x is not y,


the operator point to the same object and true here is
otherwise. not results in
1 if id(x) is
not equal to
id(y

COMPARISON OPERATOR

Operator Description Example

& Binary AND Operator copies a bit to the result if it exists in both (a & b)
operands (means
0000 1100)

| Binary OR It copies a bit if it exists in either operand. (a | b) = 61


(means
0011 1101)

^ Binary XOR It copies the bit if it is set in one operand but not both. (a ^ b) = 49
(means
0011 0001)

~ Binary Ones It is unary and has the effect of 'flipping' bits. (~a ) = -61
Complement (means
1100 0011
in 2's
complement

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


10
Agricultural Crop Recommendations based on Productivity and Season

form due to
a signed
binary
number.

<< Binary Left Shift The left operands value is moved left by the number of bits a << 2 =
specified by the right operand. 240 (means
1111 0000)

>> Binary Right Shift The left operands value is moved right by the number of a >> 2 = 15
bits specified by the right operand. (means
0000 1111)

LOGICAL OPERATOR

Operator Description Example

and Logical If both the operands are true then condition (a and b)
AND becomes true. is true.

or Logical OR If any of the two operands are non-zero then (a or b)


condition becomes true. is true.

not Logical Used to reverse the logical state of its operand. Not(a
NOT and b) is
false.

Membership Operators

Operator Description Example

In Evaluates to true if it finds a variable in the specified sequence x in y, here in


and false otherwise. results in a 1 if x
is a member of

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


11
Agricultural Crop Recommendations based on Productivity and Season

sequence y.

not in Evaluates to true if it does not finds a variable in the specified x not in y, here
sequence and false otherwise. not in results in a
1 if x is not a
member of
sequence y.

Python Operators Precedence

Operator Description

** Exponentiation (raise to the power)

~+- Complement, unary plus and minus (method names for the last two
are +@ and -@)

* / % // Multiply, divide, modulo and floor division

+- Addition and subtraction

>> << Right and left bitwise shift

& Bitwise 'AND'

^| Bitwise exclusive `OR' and regular `OR'

<= < > >= Comparison operators

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


12
Agricultural Crop Recommendations based on Productivity and Season

<> == != Equality operators

= %= /= //= -= += *= Assignment operators


**=

is is not Identity operators

in not in Membership operators

not or and Logical operators

LIST

The list is a most versatile data type available in Python which can be written as a list of comma-
separated values (items) between square brackets. Important thing about a list is that items in a list
need not be of the same type.

Creating a list is as simple as putting different comma-separated values between square brackets.
For example −

list1 = ['physics', 'chemistry', 1997, 2000];


list2 = [1, 2, 3, 4, 5 ];
list3 = ["a", "b", "c", "d"]

Basic List Operations


Lists respond to the + and * operators much like strings; they mean concatenation and repetition
here too, except that the result is a new list, not a string.

Python Expression Results Description

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


13
Agricultural Crop Recommendations based on Productivity and Season

len([1, 2, 3]) 3 Length

[1, 2, 3] + [4, 5, 6] [1, 2, 3, 4, 5, 6] Concatenation

['Hi!'] * 4 ['Hi!', 'Hi!', 'Hi!', 'Hi!'] Repetition

3 in [1, 2, 3] True Membership

for x in [1, 2, 3]: print x, 123 Iteration

Built-in List Functions & Methods:


Python includes the following list functions −

SN Function with Description

1 cmp(list1, list2)

Compares elements of both lists.

2 len(list)

Gives the total length of the list.

3 max(list)

Returns item from the list with max value.

4 min(list)

Returns item from the list with min value.

5 list(seq)

Converts a tuple into list.

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


14
Agricultural Crop Recommendations based on Productivity and Season

Python includes following list methods

SN Methods with Description

1 list.append(obj)

Appends object obj to list

2 list.count(obj)

Returns count of how many times obj occurs in list

3 list. extend(seq)

Appends the contents of seq to list

4 list.index(obj)

Returns the lowest index in list that obj appears

5 list.insert(index, obj)

Inserts object obj into list at offset index

6 list.pop(obj=list[-1])

Removes and returns last object or obj from list

7 list.remove(obj)

Removes object obj from list

8 list.reverse()

Reverses objects of list in place

9 list.sort([func])

Sorts objects of list, use compare function if given

TUPLES

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


15
Agricultural Crop Recommendations based on Productivity and Season

A tuple is a sequence of immutable Python objects. Tuples are sequences, just like lists. The
differences between tuples and lists are, the tuples cannot be changed unlike lists and tuples use
parentheses, whereas lists use square brackets.

Creating a tuple is as simple as putting different comma-separated values. Optionally we can put
these comma-separated values between parentheses also. For example −

tup1 = ('physics', 'chemistry', 1997, 2000);

tup2 = (1, 2, 3, 4, 5 );
tup3 = "a", "b", "c", "d";

The empty tuple is written as two parentheses containing nothing −

tup1 = ();

To write a tuple containing a single value you have to include a comma, even though there is only
one value −

tup1 = (50,);

Like string indices, tuple indices start at 0, and they can be sliced, concatenated, and so on.

• Accessing Values in Tuples:


To access values in tuple, use the square brackets for slicing along with the index or indices to
obtain value available at that index. For example –

tup1 = ('physics', 'chemistry', 1997, 2000);

tup2 = (1, 2, 3, 4, 5, 6, 7 );

print "tup1[0]: ", tup1[0]


print "tup2[1:5]: ", tup2[1:5]

When the code is executed, it produces the following result −

tup1[0]: physics
tup2[1:5]: [2, 3, 4, 5]

S V COLLEGE OF ENGINEERING , DEPARTMENT OF CSE


16
Agricultural Crop Recommendations based on Productivity and Season

Updating Tuples:
Tuples are immutable which means you cannot update or change the values of tuple elements.
We are able to take portions of existing tuples to create new tuples as the following example
demonstrates −

tup1 = (12, 34.56);


tup2 = ('abc', 'xyz');
tup3 = tup1 + tup2;
print tup3

When the above code is executed, it produces the following result −

(12, 34.56, 'abc', 'xyz')

Delete Tuple Elements


Removing individual tuple elements is not possible. There is, of course, nothing wrong with
putting together another tuple with the undesired elements discarded.

To explicitly remove an entire tuple, just use the del statement. For example:

tup = ('physics', 'chemistry', 1997, 2000);


print tup
del tup;
print "After deleting tup : "
print tup

Basic Tuples Operations:


Python Expression Results Description

len((1, 2, 3)) 3 Length

S V COLLEGE OF ENGINEERING , DEPARTMENT OF CSE


17
Agricultural Crop Recommendations based on Productivity and Season

(1, 2, 3) + (4, 5, 6) (1, 2, 3, 4, 5, 6) Concatenation

('Hi!',) * 4 ('Hi!', 'Hi!', 'Hi!', 'Hi!') Repetition

3 in (1, 2, 3) True Membership

for x in (1, 2, 3): print x, 123 Iteration

Built-in Tuple Functions

SN Function with Description

1
cmp(tuple1, tuple2):Compares elements of both tuples.

2
len(tuple):Gives the total length of the tuple.

3
max(tuple):Returns item from the tuple with max value.

4
min(tuple):Returns item from the tuple with min value.

5
tuple(seq):Converts a list into tuple.

DICTIONARY
Each key is separated from its value by a colon (:), the items are separated by commas, and the
whole thing is enclosed in curly braces. An empty dictionary without any items is written with
just two curly braces, like this: {}.

Keys are unique within a dictionary while values may not be. The values of a dictionary can be
of any type, but the keys must be of an immutable data type such as strings, numbers, or tuples.

S V COLLEGE OF ENGINEERING , DEPARTMENT OF CSE


18
Agricultural Crop Recommendations based on Productivity and Season

Accessing Values in Dictionary:

To access dictionary elements, you can use the familiar square brackets along with the key to
obtain its value. Following is a simple example −

dict = {'Name': 'Zara', 'Age': 7, 'Class': 'First'}

print "dict['Name']: ", dict['Name']


print "dict['Age']: ", dict['Age']

Result –

dict['Name']: Zara
dict['Age']: 7

Updating Dictionary
We can update a dictionary by adding a new entry or a key-value pair, modifying an existing
entry, or deleting an existing entry as shown below in the simple example −

dict = {'Name': 'Zara', 'Age': 7, 'Class': 'First'}

dict['Age'] = 8; # update existing entry


dict['School'] = "DPS School"; # Add new entry
print "dict['Age']: ", dict['Age']
print "dict['School']: ", dict['School']

Result −

dict['Age']: 8
dict['School']: DPS School

Delete Dictionary Elements


We can either remove individual dictionary elements or clear the entire contents of a dictionary.
You can also delete entire dictionary in a single operation.

S V COLLEGE OF ENGINEERING , DEPARTMENT OF CSE


19
Agricultural Crop Recommendations based on Productivity and Season

To explicitly remove an entire dictionary, just use the del statement. Following is a simple
example –

dict = {'Name': 'Zara', 'Age': 7, 'Class': 'First'}

del dict['Name']; # remove entry with key 'Name'


dict.clear(); # remove all entries in dict
del dict ; # delete entire dictionary

print "dict['Age']: ", dict['Age']


print "dict['School']: ", dict['School']

Built-in Dictionary Functions & Methods –

Python includes the following dictionary functions −

SN Function with Description

1
cmp(dict1, dict2)

Compares elements of both dict.

2
len(dict)

Gives the total length of the dictionary. This would be equal to the number of items in the dictionary.

3
str(dict)

Produces a printable string representation of a dictionary

S V COLLEGE OF ENGINEERING , DEPARTMENT OF CSE


20
Agricultural Crop Recommendations based on Productivity and Season

Python includes following dictionary methods −

SN Methods with Description

1 dict.clear():Removes all elements of dictionary dict

2 dict. Copy():Returns a shallow copy of dictionary dict

3 dict.fromkeys():Create a new dictionary with keys from seq and values set to value.

4 dict.get(key, default=None):For key key, returns value or default if key not in dictionary

5 dict.has_key(key):Returns true if key in dictionary dict, false otherwise

6 dict.items():Returns a list of dict's (key, value) tuple pairs

7 dict.keys():Returns list of dictionary dict's keys

8 dict.setdefault(key, default=None):Similar to get(), but will set dict[key]=default if key is not


already in dict

9 dict.update(dict2):Adds dictionary dict2's key-values pairs to dict

10 dict.values():Returns list of dictionary dict's values

A function is a block of organized, reusable code that is used to perform a single, related action.
Functions provide better modularity for your application and a high degree of code reusing.
Python gives you many built-in functions like print(), etc. but you can also create your own
functions. These functions are called user-defined functions.

S V COLLEGE OF ENGINEERING , DEPARTMENT OF CSE


21
Agricultural Crop Recommendations based on Productivity and Season

Defining a Function

Simple rules to define a function in Python.

• Function blocks begin with the keyword def followed by the function name and
parentheses ( ( ) ).

• Any input parameters or arguments should be placed within these parentheses. You can
also define parameters inside these parentheses.

• The first statement of a function can be an optional statement - the documentation string
of the function or docstring.

• The code block within every function starts with a colon (:) and is indented.

• The statement return [expression] exits a function, optionally passing back an expression
to the caller. A return statement with no arguments is the same as return None.

def functionname( parameters ):


"function_docstring"
function_suite
return [expression]

Calling a Function
Defining a function only gives it a name, specifies the parameters that are to be included in the
function and structures the blocks of code.Once the basic structure of a function is finalized, you
can execute it by calling it from another function or directly from the Python prompt. Following
is the example to call printme() function −

# Function definition is here


def printme( str ):
"This prints a passed string into this function"
printme("Again second call to the same function")

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


22
Agricultural Crop Recommendations based on Productivity and Season

When the above code is executed, it produces the following result −

I'm first call to user defined function!


Again second call to the same function

Function Arguments

You can call a function by using the following types of formal arguments:

• Required arguments

• Keyword arguments

• Default arguments

• Variable-length arguments

Scope of Variables

All variables in a program may not be accessible at all locations in that program. This depends
on where you have declared a variable.

The scope of a variable determines the portion of the program where you can access a particular
identifier. There are two basic scopes of variables in Python −

Global variables Local variables

Global vs. Local variables

Variables that are defined inside a function body have a local scope, and those defined outside
have a global scope.

This means that local variables can be accessed only inside the function in which they are
declared, whereas global variables can be accessed throughout the program body by all functions.
When you call a function, the variables declared inside it are brought into scope. Following is a
simple example –

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


23
Agricultural Crop Recommendations based on Productivity and Season

total = 0; # This is global variable.


# Function definition is here
def sum( arg1, arg2 ):
# Add both the parameters and return them."
total = arg1 + arg2; # Here total is local variable.
print "Inside the function local total : ", total
return total;
sum( 10, 20 );
print "Outside the function global total : ", total

Result −

Inside the function local total : 30


Outside the function global total : 0

A module allows you to logically organize your Python code. Grouping related code into a module
makes the code easier to understand and use. A module is a Python object with arbitrarily named
attributes that you can bind and reference.Simply, a module is a file consisting of Python code. A
module can define functions, classes and variables. A module can also include runnable code.

Example:
The Python code for a module named aname normally resides in a file named aname.py. Here's
an example of a simple module, support.py

def print_func( par ):

print "Hello : ", par

return

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


24
Agricultural Crop Recommendations based on Productivity and Season

The import Statement

The import has the following syntax:

import module1[, module2[,... moduleN]

When the interpreter encounters an import statement, it imports the module if the module is
present in the search path. A search path is a list of directories that the interpreter searches before
importing a module. For example, to import the module support.py, you need to put the following
command at the top of the script −

A module is loaded only once, regardless of the number of times it is imported. This prevents the
module execution from happening over and over again if multiple imports occur.

Packages in Python

A package is a hierarchical file directory structure that defines a single Python application
environment that consists of modules and sub packages and sub-sub packages.

Consider a file Pots.py available in Phone directory. This file has following line of source code −

def Pots():
print "I'm Pots Phone"

Similar way, we have another two files having different functions with the same name as above

• Phone/Isdn.py file having function Isdn()

• Phone/G3.py file having function G3()

Now, create one more file init .py in Phone directory −

• Phone/ init .py

To make all of your functions available when you've imported Phone,to put explicit import
statements in init .py as follows –

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


25
Agricultural Crop Recommendations based on Productivity and Season

from Pots import Pots


from Isdn import Isdn
from G3 import G3

After you add these lines to init .py, you have all of these classes available when you import
the Phone package.

# Now import your Phone Package.


import Phone
Phone.Pots()
Phone.Isdn()
Phone.G3()

RESULT:

I'm Pots Phone


I'm 3G Phone
I'm ISDN Phone

In the above example, we have taken example of a single functions in each file, but you can keep
multiple functions in your files. You can also define different Python classes in those files and
then you can create your packages out of those classes.

This chapter covers all the basic I/O functions available in Python.

Printing to the Screen

The simplest way to produce output is using the print statement where you can pass zero or more
expressions separated by commas. This function converts the expressions you pass into a string
and writes the result to standard output as follows −

print "Python is really a great language,", "isn't it?"

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


26
Agricultural Crop Recommendations based on Productivity and Season

Result:

Python is really a great language, isn't it?

Reading Keyboard Input

Python provides two built-in functions to read a line of text from standard input, which by default
comes from the keyboard. These functions are −

• raw_input

• input

The raw_input Function

The raw_input([prompt]) function reads one line from standard input and returns it as a string
(removing the trailing newline).

str = raw_input("Enter your input: ");


print "Received input is : ", str

This prompts you to enter any string and it would display same string on the screen. When I typed
"Hello Python!", its output is like this −

Enter your input: Hello Python


Received input is : Hello Python

The input Function

The input([prompt]) function is equivalent to raw_input, except that it assumes the input is a valid
Python expression and returns the evaluated result to you.

str = input("Enter your input: ");


print "Received input is : ", str

This would produce the following result against the entered input –

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


27
Agricultural Crop Recommendations based on Productivity and Season

Enter your input: [x*5 for x in range(2,10,2)]


Recieved input is : [10, 20, 30, 40]

Opening and Closing Files

Until now, you have been reading and writing to the standard input and output. Now, we will see
how to use actual data files.

Python provides basic functions and methods necessary to manipulate files by default. You can
do most of the file manipulation using a file object.

The open Function

Before you can read or write a file, you have to open it using Python's built-in open() function.
This function creates a file object, which would be utilized to call other support methods
associated with it.

Syntax
file object = open(file_name [, access_mode][, buffering])

Here are parameter details:

• file_name: The file_name argument is a string value that contains the name of the file that
you want to access.

• access_mode: The access_mode determines the mode in which the file has to be opened,
i.e., read, write, append, etc. A complete list of possible values is given below in the table.
This is optional parameter and the default file access mode is read (r).

• buffering: If the buffering value is set to 0, no buffering takes place. If the buffering value
is 1, line buffering is performed while accessing a file. If you specify the buffering value
as an integer greater than 1, then buffering action is performed with the indicated buffer
size. If negative, the buffer size is the system default(default behavior).

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


28
Agricultural Crop Recommendations based on Productivity and Season

Here is a list of the different modes of opening a file −

Modes Description

R Opens a file for reading only. The file pointer is placed at the beginning of the file. This is the
default mode.

Rb Opens a file for reading only in binary format. The file pointer is placed at the beginning of the
file. This is the default mode.

r+ Opens a file for both reading and writing. The file pointer placed at the beginning of the file.

rb+ Opens a file for both reading and writing in binary format. The file pointer placed at the
beginning of the file.

W Opens a file for writing only. Overwrites the file if the file exists. If the file does not exist,
creates a new file for writing.

Wb Opens a file for writing only in binary format. Overwrites the file if the file exists. If the file does
not exist, creates a new file for writing.

w+ Opens a file for both writing and reading. Overwrites the existing file if the file exists. If the file
does not exist, creates a new file for reading and writing.

wb+ Opens a file for both writing and reading in binary format. Overwrites the existing file if the file
exists. If the file does not exist, creates a new file for reading and writing.

A Opens a file for appending. The file pointer is at the end of the file if the file exists. That is, the
file is in the append mode. If the file does not exist, it creates a new file for writing.

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


29
Agricultural Crop Recommendations based on Productivity and Season

Ab Opens a file for appending in binary format. The file pointer is at the end of the file if the file
exists. That is, the file is in the append mode. If the file does not exist, it creates a new file for
writing.

a+ Opens a file for both appending and reading. The file pointer is at the end of the file if the file
exists. The file opens in the append mode. If the file does not exist, it creates a new file for
reading and writing.

ab+ Opens a file for both appending and reading in binary format. The file pointer is at the end of the
file if the file exists. The file opens in the append mode. If the file does not exist, it creates a new
file for reading and writing.

The file Object Attributes

Once a file is opened and you have one file object, you can get various information related to that
file.

Here is a list of all attributes related to file object:

Attribute Description

file.closed Returns true if file is closed, false otherwise.

file.mode Returns access mode with which file was opened.

file.name Returns name of the file.

file.softspace Returns false if space explicitly required with print, true otherwise.

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


30
Agricultural Crop Recommendations based on Productivity and Season

Example
# Open a file
fo = open("foo.txt", "wb")
print "Name of the file: ", fo.name
print "Closed or not : ", fo.closed
print "Opening mode : ", fo.mode
print "Softspace flag : ", fo.softspace

This produces the following result −

Name of the file: foo.txt


Closed or not : False
Opening mode : wb
Softspace flag : 0

The close() Method

The close() method of a file object flushes any unwritten information and closes the file object,
after which no more writing can be done. Python automatically closes a file when the reference
object of a file is reassigned to another file. It is a good practice to use the close() method to close
a file.

Syntax
fileObject.close();

Example
# Open a file
fo = open("foo.txt", "wb")
print "Name of the file: ", fo.name
# Close opend file
fo.close()

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


31
Agricultural Crop Recommendations based on Productivity and Season

Result −

Name of the file: foo.txt

Reading and Writing Files

The file object provides a set of access methods to make our lives easier. We would see how to
use read() and write() methods to read and write files.

The write() Method

The write() method writes any string to an open file. It is important to note that Python strings
can have binary data and not just text.The write() method does not add a newline character ('\n')
to the end of the string Syntax

fileObject.write(string);

Here, passed parameter is the content to be written into the opened file. Example

# Open a file
fo = open("foo.txt", "wb")
fo.write( "Python is a great language.\nYeah its great!!\n");
# Close opend file
fo.close()

The above method would create foo.txt file and would write given content in that file and finally
it would close that file. If you would open this file, it would have following content.

Python is a great language.

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


32
Agricultural Crop Recommendations based on Productivity and Season

CHAPTER-4
FEASIBILITY STUDY

An important outcome of preliminary investigation is the determination that the system request is
feasible. This is possible only if it is feasible within limited resource and time. The different
feasibilities that have to be analyzed are
• Operational Feasibility
• Economic Feasibility
• Technical Feasibility

4.1 Operational Feasibility


Operational Feasibility deals with the study of prospects of the system to be developed.
This system operationally eliminates all the tensions of the Admin and helps him in effectively
tracking the project progress. This kind of automation will surely reduce the time and energy,
which previously consumed in manual work. Based on the study, the system is proved to be
operationally feasible.

4.2 Economic Feasibility

Economic Feasibility or Cost-benefit is an assessment of the economic justification for a


computer based project. As hardware was installed from the beginning & for lots of purposes thus
the cost on project of hardware is low. Since the system is a network based, any number of
employees connected to the LAN within that organization can use this tool from at anytime. The
Virtual Private Network is to be developed using the existing resources of the organization. So the
project is economically feasible.

4.3 Technical Feasibility

According to Roger S. Pressman, Technical Feasibility is the assessment of the technical


resources of the organization. The organization needs IBM compatible machines with a graphical
web browser connected to the Internet and Intranet. The system is developed for platform
Independent environment. Java Server Pages, JavaScript, HTML, SQL server and Web Logic
Server are used to develop the system. The technical feasibility has been carried out. The system
is technically feasible for development and can be developed with the existing facility.

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


33
Agricultural Crop Recommendations based on Productivity and Season

CHAPTER-5
SYSTEM ANALYSIS
5.1 EXISTING SYSTEM

❖ Many crop prediction yield models have been developed. Clustering approaches such as k-
means, kmeans++ are used to perform grouping of data as clusters to predict crop yield is
used. In existing system provided a system to have management of pesticides for crop
cultivation using data mining process. Essential parameter for agriculture analysis is nature
of soil. Diverse varieties of soil are available in this India. Crops are cultivated depending
on the type of soil in the land. The role of soil in improving crop cultivation is discussed.
Data mining techniques are applied to analyze the soil parameter.
❖ JRip, J48 and Naive Bayes techniques are applied which produces more reliable results in
analyzing red and Black soil. Impact of parameters of agriculture in crop management is
studied to improve productivity. Neural networks, soft computing, big data and fuzzy logic
methods are being used to examine the agricultural factors.
❖ In Existing approach developed a SNN model to have a spatiotemporal analysis with crop
estimation. An automatic system to gather the information about soil nature, weather
conditions was developed with clustering techniques to extract the knowledge and use it
by farmers in crop cultivation.

5.1.1 DISADVANTAGES OF EXISTING SYSTEM

1) An existing system’s recommendation is based on soil and not based on Crop


Recommendation Based on Production.
2) Farmers will be given recommendation by considering not the season of crop production.
5.2 PROPOSED SYSTEM

Prediction of crops was done according to farmer’s experience in the past years. Although farmer’s
knowledge sustains, agricultural factors has been changed to astonishing level. There comes a need
to indulge engineering effect in crop prediction. Data mining plays a novel role in agriculture
research. This field uses historical data to predict; such techniques are neural networks, K-nearest
Neighbor. K-means algorithm does not use historical data but predicts based on-computing centers
of the samples and forming clusters. Computational cost of algorithm acts as a major issue. Use of

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


34
Agricultural Crop Recommendations based on Productivity and Season

Artificial Neural Network is a boon to agriculture field which computes accurately even with more
input. An architecture developed uses input; selects needed features; classification and association
rule mining is applied and visualized.

Statistical Methodologies has been used to predict its crop production. Shakil Ahamed applied
clustering and classification techniques on 15 districts of Bangladesh to recommend for yield and
planting of crops. Factors implementing crop yield were considered. They are
a. Environmental factors-rainfall, humidity, Minimum and maximum temperature
b. Biotic factors-soil pH and salinity
c. Area factors-irrigated or cultivated
5.2.1 ADVANTAGES OF PROPOSED SYSTEM

1) Recommendation system acts as a good engine to provide suitable items to users considering
other factors. This is extended to have its support to agricultural sector
2) An exact recommendation based on Recommend based on production.

5.3 ANALYSIS

In recent days with the development in IT world, Machine Learning has emerged to handle
big volume of data and involves high performance computing too. Application of Machine
Learning in Agriculture peaks up day by day. Machine Learning techniques are used in crop
management, livestock management, water management and soil management recommendation
algorithm. They provide personalized products in E-Commerce. These recommendation concepts
are used in agriculture in this project to provide crops to sow. Simple Data Analytics is used on
crop dataset and personalization of agricultural crops are suggested to famers.

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


35
Agricultural Crop Recommendations based on Productivity and Season

CHAPTER-6
SYSTEM ARCHITECTURE

A system architecture is the conceptual model that defines the structure, behavior, and
more views of a system. An architecture description is a formal description and representation of
a system, organized in a way that supports reasoning about the structures and behaviors of the
system.
It is Architecture Description Language which helps to describe the entire system
architecture. So it is a much broader topic. System architecture can be broadly categorized into
centralized and decentralized architectural organizations.
System architecture is the fundamental and unifying system structure defined in terms
of system elements, interfaces, processes, constraints and behaviors. System architecture
comprises the major physical properties, style, structure, interactions, and purpose of a system.
System design is the process of defining the architecture, modules, interfaces, and data
for a system to satisfy specified requirements.
The major elements of a system are architecture, modules, components, interfaces and
data.

Elements of a System
▪ Architecture - This is the conceptual model that defines the structure, behavior andmore
views of a system. We can use flowcharts to represent and illustrate the architecture.
▪ Modules - These are components that handle one specific task in a system. Acombination
of the modules make up the system.
▪ Components - This provides a particular function or group of related functions. Theyare
made up of modules.
▪ Interfaces - This is the shared boundary across which the components of the system
exchange information and relate.
▪ Data - This the management of the information and data flow.

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


36
Agricultural Crop Recommendations based on Productivity and Season

6.1 ARCHITECTURE

Service Provider
Login,

View Crop Data Sets,


Browse Agriculture Data Sets and
Web Server Accepting all Train & Test,
Information Datasets View Trained and Tested Accuracy in
Results Storage Bar Chart,
Accessin View Trained and Tested
g Data
Accuracy Results,
Process all
user View All Crop Yield and
queries Production Prediction,

Store and retrievals Download Predicted Data Sets,


View All Remote Users, View Crop Yield
Prediction Per Acre Results.

WEB
Database

Remote User

REGISTER AND LOGIN,


PREDICT CROP YIELD AND
PRODUCTION, VIEW YOUR
PROFILE.

Fig 6.1 System Architecture

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


37
Agricultural Crop Recommendations based on Productivity and Season

6.1.1 Service Provider

In this module, the Service Provider has to login by using valid user name and password. After
login successful he can do some operations such as View Crop Data Sets, Browse Agriculture Data
Sets and Train & Test, View Trained and Tested Accuracy in Bar Chart, View Trained and Tested
Accuracy Results, View All Crop Yield and Production Prediction, Download Predicted Data Sets,
View All Remote Users, View Crop Yield Prediction Per Acre Results..

6.1.2 End User


In this module, there are n numbers of users are present. User should register before doing any
operations. Once user registers, their details will be stored to the database. After registration
successful, he has to login by using authorized user name and password. Once Login is successful
user will do some operations like Post Crops Data Sets, Predict Crop Yield And Production, View
Your Profile.

6.2 UML DIAGRAMS

The Unified Modelling Language (UML) is a standard language for specifying, visualizing,
constructing, and documenting the artifacts of software systems, as well asfor business modeling
and other non-software systems. The UML represents a collection of best engineering practices
that have proven successful in the modeling of large and complex systems. The UML is a very
important part of developing objects oriented software and the software development process. The
UML uses mostly graphical notations to express the design of software projects. Using the UML
helps project teams communicate, explore potential designs, and validate the architectural design
of the software.

As the strategic value of software increases for many companies, the industry looks for
techniques to automate the production of software and to improve quality and reduce cost and time-
to-market. These techniques include component technology, visual programming, patterns and
frameworks. Businesses also seek techniques to manage the complexity of systems as they increase
in scope and scale. In particular, they recognize the need to solve recurring architectural problems,
such as physical distribution, concurrency, replication, security, load balancing and fault tolerance.

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


38
Agricultural Crop Recommendations based on Productivity and Season

Additionally, the development for the World Wide Web, while making some things
simpler, has exacerbated these architectural problems. The Unified Modeling Language(UML) was
designed to respond to these needs. Simply, Systems design refers to the process of defining the
architecture, components, modules, interfaces, and data for a system to satisfy specified
requirements which can be done easily through UML diagrams.

Contents of UML
In general, a UML diagram consists of the following features:
➢ Entities: These may be classes, objects, users or systems behaviors.
➢ Relationship Lines that model the relationships between entities in the system.
➢ Generalization -- a solid line with an arrow that points to a higher abstraction of the
present item.
➢ Association -- a solid line that represents that one entity uses another entity as part of its
behavior.
➢ Dependency -- a dotted line with an arrowhead that shows one entity depends on the
behavior of another entity.

Goals of UML

A picture is worth a thousand words, this idiom absolutely fits describing UML. Object-oriented
concepts were introduced much earlier than UML. At that point of time, there were no standard
methodologies to organize and consolidate the object-oriented development. It was then that
UML came into picture.

There are a number of goals for developing UML but the most important is to define some general
purpose modeling language, which all modelers can use and it also needs to be made simple to
understand and use.

UML diagrams are not only made for developers but also for business users, common people, and
anybody interested to understand the system. The system can be a software or non-software

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


39
Agricultural Crop Recommendations based on Productivity and Season

system. Thus it must be clear that UML is not a development method rather it accompanies with
processes to make it a successful system.

In conclusion, the goal of UML can be defined as a simple modeling mechanism to model all
possible practical systems in today’s complex environment.

A Conceptual Model of UML

To understand the conceptual model of UML, first we need to clarify what is a conceptual model?
and why a conceptual model is required?

• A conceptual model can be defined as a model which is made of concepts and their
relationships.

• A conceptual model is the first step before drawing a UML diagram. It helps to understand
the entities in the real world and how they interact with each other.

As UML describes the real-time systems, it is very important to make a conceptual model and
then proceed gradually. The conceptual model of UML can be mastered by learning the following
three major elements −

• UML building blocks

• Rules to connect the building blocks

• Common mechanisms of UML

Object-Oriented Concepts

UML can be described as the successor of object-oriented (OO) analysis and design.

An object contains both data and methods that control the data. The data represents the state of
the object. A class describes an object and they also form a hierarchy to model the real-world
system. The hierarchy is represented as inheritance and the classes can also be associated in
different ways as per the requirement.

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


40
Agricultural Crop Recommendations based on Productivity and Season

Objects are the real-world entities that exist around us and the basic concepts such as abstraction,
encapsulation, inheritance, and polymorphism all can be represented using UML.

UML is powerful enough to represent all the concepts that exist in object-oriented analysis and
design. UML diagrams are representation of object-oriented concepts only. Thus, before learning
UML, it becomes important to understand OO concept in detail.

Following are some fundamental concepts of the object-oriented world −

• Objects − Objects represent an entity and the basic building block.

• Class − Class is the blue print of an object.

• Abstraction − Abstraction represents the behavior of an real world entity.

• Encapsulation − Encapsulation is the mechanism of binding the data together and hiding
them from the outside world.

• Inheritance − Inheritance is the mechanism of making new classes from existing ones.

• Polymorphism − It defines the mechanism to exists in different forms.

OO Analysis and Design

OO can be defined as an investigation and to be more specific, it is the investigation of objects.


Design means collaboration of identified objects.

Thus, it is important to understand the OO analysis and design concepts. The most important
purpose of OO analysis is to identify objects of a system to be designed. This analysis is also done
for an existing system. Now an efficient analysis is only possible when we are able to start
thinking in a way where objects can be identified. After identifying the objects, their relationships
are identified and finally the design is produced.

The purpose of OO analysis and design can described as −

• Identifying the objects of a system.

• Identifying their relationships.

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


41
Agricultural Crop Recommendations based on Productivity and Season

• Making a design, which can be converted to executables using OO languages.

There are three basic steps where the OO concepts are applied and implemented. The steps can
be defined as

OO Analysis → OO Design → OO implementation using OO languages

The above three points can be described in detail as −

• During OO analysis, the most important purpose is to identify objects and describe them
in a proper way. If these objects are identified efficiently, then the next job of design is
easy. The objects should be identified with responsibilities. Responsibilities are the
functions performed by the object. Each and every object has some type of responsibilities
to be performed. When these responsibilities are collaborated, the purpose of the system
is fulfilled.

• The second phase is OO design. During this phase, emphasis is placed on the requirements
and their fulfilment. In this stage, the objects are collaborated according to their intended
association. After the association is complete, the design is also complete.

• The third phase is OO implementation. In this phase, the design is implemented using OO
languages such as Java, C++, etc.

Role of UML in OO Design

UML is a modeling language used to model software and non-software systems. Although UML
is used for non-software systems, the emphasis is on modeling OO software applications. Most
of the UML diagrams discussed so far are used to model different aspects such as static, dynamic,
etc. Now whatever be the aspect, the artifacts are nothing but objects.

Hence, the relation between OO design and UML is very important to understand. The OO
design is transformed into UML diagrams according to the requirement. Before understanding
the UML in detail, the OO concept should be learned properly. Once the OO analysis and design

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


42
Agricultural Crop Recommendations based on Productivity and Season

is done, the next step is very easy. The input from OO analysis and design is the input to
UML diagrams.

In this project, basic UML diagrams have been explained

1) Use Case Diagram


2) Class Diagram
3) Sequence Diagram
4) Collaboration Diagram
5) Activity Diagram
6) Deployment Diagram

6.2.1 Use case diagram


A use case diagram in the Unified Modelling Language (UML) is a type of behavioral
diagram defined by and created from a Use-case analysis. Its purpose is to present a graphical
overview of the functionality provided by a system in terms.
A use case is a methodology used in system analysis to identify, clarify, and organize
system requirements. The use case is made up of a set of possible sequences of interactions
between systems and users in a particular environment and related to a particular goal. It consists
of a group of elements (for example, classes and interfaces) that can be used together in a way that
will have an effect larger than the sum of the separate elements combined. The use case should
contain all system activities that have significance to the users. A use case can be thought of as a
collection of possible scenarios related to a particular goal, indeed, the use case and goal are
sometimes considered to be synonymous. The main purpose of a use case diagram is to show what
system functions are performed for which actor. Roles of the actors in the system can be depicted.
Parts of Use Case Diagram
➢ System boundary boxes (optional)

A rectangle is drawn around the use cases, called the system boundary box, to indicate the
scope of system. Anything within the box represents functionality that is in scope and anything
outside the box is not Relationships.

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


43
Agricultural Crop Recommendations based on Productivity and Season

➢ Include
In one form of interaction, a given use case may include another. "Include is a Directed
Relationship between two use cases, implying that the behavior of the included use case is inserted
into the behavior of the including use case”.

The first use case often depends on the outcome of the included use case. This is useful for
extracting truly common behaviors from multiple use cases into a single description. The notation
is a dashed arrow from the including to the included use case, with the label "«include»". This usage
resembles a macro expansion where the included use case behavior is placed inline in the base use
case behavior. There are no parameters or return values. To specify the location in a flow of events
in which the base use case includes the behavior of another, you simply write include followed by

the name of use case you want to include, as in the following flow for track order.

➢ Extend

In another form of interaction, a given use case (the extension) may extend another. This
relationship indicates that the behavior of the extension use case may be inserted in the extended
use case under some conditions. The notation is a dashed arrow from the extension to the extended
use case, with the label "«extend»". The notes or constraints may be associated with this
relationship to illustrate the conditions under which this behavior will be executed. Modelers use
the «extend» relationship to indicate use cases that are "optional" to the base use case. Depending on
the modeler’s approach "optional" may mean "potentially not executed with the base use case" or
it may mean" not required to achieve the base use case goal".
➢ Associations
Associations between actors and use cases are indicated in use case diagrams by solid lines.
An association exists whenever an actor is involved with an interaction described by a use case.
Associations are modelled as lines connecting use cases and actors to one another, with an optional
arrowhead on one end of the line. The arrowhead is often used to indicate the direction of the initial
invocation of the relationship or to indicate the primary actor within the use case. The arrowheads
imply control flow and should not be confused with data flow.

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


44
Agricultural Crop Recommendations based on Productivity and Season

STEPS TO DRAW USE CASES

• Identifying Actor

• Identifying Use cases

6.2.1.1 Use case Diagram for Service Provider

Login

View User Uploaded crop


Data set Details

Train Model with SVM


Logistic
Regression

View Trained &


Tested Accuracy
result

View all Crop Yield


and production
Service
provider
View all Users

Download predicted Data set

View crop yield prediction


per Acre results

Log Out

Fig 6.2.1.1 Use case Diagram for Service Provider

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


45
Agricultural Crop Recommendations based on Productivity and Season

6.2.1.2 Use case Diagram for End User

Register / Login

Browse & Upload Crop


Dataset

Enter crop yield details

Predict crop yield based


on
input
End user

View profile

Log out

Fig 6.2.1.2 Use case Diagram for End User

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


46
Agricultural Crop Recommendations based on Productivity and Season

6.2.2 Class Diagram

UML class diagrams model static class relationships that represent the fundamental
architecture of the system. Note that these diagrams describe the relationships between classes, not
those between specific objects instantiated from those classes. Thus the diagram applies to all the
objects in the system. It represents the static view of an application. Class diagram describes the
attributes and operations of a class and also the constraints imposed on the system. It shows a
collection of classes, interfaces, associations, collaborations, and constraints.

A class diagram consists of the following features:

➢ Classes: These titled boxes represent the classes in the system and contain information
about the name of the class, fields, methods and access specifies. Abstract roles of the
Class in the system can also be indicated
➢ Interfaces: These titled boxes represent interfaces in the system and contain information
about the name of the interface and its methods. Relationship Lines that model the
relationships between classes and interfaces in the system.
➢ Dependency: A dotted line with an open arrowhead that shows one entity depends on the
behavior of another entity. Typical usages are to represent that one class instantiates
another or that it uses the other as an input parameter. It is defined as a relation between
two classes, where one class depends on another class but another class may or may not
depend on the first class. So any change in one of the classes may affect the functionality
of the other class, that depends on the first one.
➢ Aggregation: Represented by an association line with a hollow diamond at the tail end. An
aggregation models the notion that one object uses another object without "owning" it and
thus is not responsible for its creation or destruction. In Aggregation, both the entries can
survive individually which means ending one entity will not affect the other entity.
➢ Inheritance: A solid line with a solid arrowhead that points from a sub-class toa
super class or from a sub-interface to its super-interface. In Aggregation, both the
entries can survive individually which means ending one entity will not affect the
other entity.
➢ Implementation: A dotted line with a solid arrowhead that points from a class to
the interface that it implement .

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


47
Agricultural Crop Recommendations based on Productivity and Season

➢ Composition: Represented by an association line with a solid diamond at the tail end. A
composition models the notion of one object "owning" another and thus being responsible
for the creation and destruction of another object. It is a restricted form of Aggregation in
which two entities are highly dependent on each other.

Fig 6.2.2 Class Diagram

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


48
Agricultural Crop Recommendations based on Productivity and Season

6.2.3 Sequence Diagram

A sequence diagram in Unified Modelling Language (UML) is a kind of interaction


diagram that shows how processes operate with one another and in what order. It is a construct of
a Message Sequence Chart. A Sequence diagram depicts the sequence of actions that occur in a
system. The invocation of methods in each object, and the order in which the invocation occurs is
captured in a Sequence diagram. This makes the Sequence diagram a very useful tool to easily
represent the dynamic behavior of a system.

Elements of sequence diagram

The sequence diagram is an element that is used primarily to showcase the interaction that
occurs between multiple objects. This interaction will be shown over certain period of time.
Because of this, the first symbol that is used is one that symbolizes the object.
➢ Lifeline
A lifeline will generally be generated, and it is a dashed line that sits vertically, and the top
will be in the form of a rectangle. This rectangle is used to indicate both the instance and the class.
If the lifeline must be used to denote an object, it will be underlined.
➢ Messages
To showcase an interaction, messages will be used. These messages will come in the form
of horizontal arrows, and the messages should be written on top of the arrows. If the arrow has a
full head, and it’s solid, it will be called a synchronous call. If the solid arrow has a stick head, it
will be an asynchronous call. Stick heads with dash arrows are used to represent return messages.
➢ Objects
Objects will also be given the ability to call methods upon themselves, and they can add net
activation boxes. Because of this, they can communicate with others to show multiple levels of
processing. Whenever an object is eradicated or erased from memory, the "X" will be drawn at the
lifeline's top, and the dash line will not be drawn beneath it. This will often occur as a result of a
message. If a message is sent from the outside of the diagram, it can be used to define a message
that comes from a circle that is filled in. Within a UML based model, a Super step is a collection of
steps which result from outside stimuli.ac

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


49
Agricultural Crop Recommendations based on Productivity and Season

Uses of Sequence diagram


The following are the uses of sequence diagram-
• Used to model and visualize the logic behind a sophisticated function,
operation or procedure.
• They are also used to show details of UML use case diagrams.
• Used to Understand the detailed functionality of current or
future systems.
• Visualize how messages and tasks move between objects or
Components in a system.
• A sequence diagram is the most commonly used interaction diagram.
• Sequence diagrams shows the sequence of messages passed between
objects.
• Sequence diagrams can also show the control structures between objects.
• A sequence diagram consists of a group of objects that are represented by
lifelines, and the messages that they exchange over time during the
interaction.

Steps to create sequence diagram


The following are the steps to create sequence diagram-

• Set the stage for the interaction by identifying which objects


play a role in interaction.

• Set the lifetime for each object.

• Start with the message that initiates the interaction.

• Visualize the nesting of messages or the points in time


during actual computation.

• Specify time and space constraints, adorn each message with


timing mark and attach suitable time or space constraints.

• Specify the flow of control more formally, attach pre and post
conditions to each message.

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


50
Agricultural Crop Recommendations based on Productivity and Season

Service provider Data base End user

Login
Register / Login
1.View user uploaded crop Data set Details

2.Train Model with SVM logistic regression

3.View trained & tested Accuracy result

4.View all crop yiled and production

5.View all users

6.Download predicted Data set

7.View crop yield prediction per Acre result

8.Browse & upload crop Data set

9.Enter crop yield Details

10.Predict Crop yield based on input

11.View profile

Fig 6.2.3 Sequence Diagram

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


51
Agricultural Crop Recommendations based on Productivity and Season

6.2.4 Collaboration Diagram

In collaboration diagram the method call sequence is indicated by some numbering technique as
shown below. The number indicates how the methods are called one after another. We have taken
the same order management system to describe the collaboration diagram. The method calls are
similar to that of a sequence diagram. But the difference is that the sequence diagram does not
describe the object organization whereas the collaboration diagram shows the object organization.
The four major components of a collaboration diagram are objects, actors, links, and messages.

View user uploaded crop Data set


Details
Train Model with SVM logistic
regression
View trained & Tested Accuracy
Result
View all crop yield & production
View all users
Download predicted Data set
View crop yield prediction per Acre
1:
results
: Service : Data : End
provider base user
Browse & upload crop Data set
Enter crop yield Details 2:
Predict crop yield based on input
View profile

Fig 6.2.4 Collaboration Diagram

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


52
Agricultural Crop Recommendations based on Productivity and Season

6.2.5 Activity Diagram


Activity diagram is another important diagram in UML to describe dynamic aspects of the
system. Activity diagram is basically a flow chart to represent the flow form one activity to another
activity. The activity can be described as an operation of the system. So the control flow is drawn
from one operation to another. This flow can be sequential, branched or concurrent. Activity
diagrams deals with all type of flow control by using different elements like fork, join etc. An
activity diagram is a behavioral diagram i.e. it depicts the behavior of the system. The purpose of
an activity diagram can be described as – draw the activity flow of a system, describe the sequence
from one activity to another and then describe the parallel, branched and concurrent flow of the
system.
How to draw Activity Diagram?
Activity diagrams are mainly used as a flow chart consists of activities performed by the system.
But activity diagram are not exactly a flow chart as they have some additional capabilities. These
additional capabilities include branching, parallel flow, swim lane etc. Before drawing an activity
diagram we must have a clear understanding about the elements used in activity diagram. The main
element of an activity diagram is the activity itself. An activity is a function performed by the
system. After identifying the activities we need to understand how they are associated with
constraints and conditions. So before drawing an activity diagram we should identify the following
elements. Once the below mentioned parameters are identified, we need to make a mental layout
of the entire flow. This mental layout is then transformed into an activity diagram.

• Activities
• Association
• Conditions
• Constraints

The following are the basic notational elements that can be used to make up a diagram:
Initial state
An initial state represents a default vertex that is the source for a single transition to the default
state of a composite state. There can be at most one initial vertex in a region. The outgoing
transition from the initial vertex may have a behavior, but not a trigger or guard. It is represented
by Filled circle, pointing to the initial state.

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


53
Agricultural Crop Recommendations based on Productivity and Season

Final state
A special kind of state signifying that the enclosing region is completed. If the enclosing
region is directly contained in a state machine and all other regions in the state machine also are
completed, then it means that the entire state machine is completed.

It is represented by Hollow circle containing a smaller filled circle, indicating the final
state.
Rounded rectangle
It denotes a state. Top of the rectangle contains a name of the state. Can contain a horizontal
line in the middle, below which the activities that are done in that state are indicated.
Arrow
It denotes transition. The name of the event (if any) causing this transition labels the arrow
body.
Where to use Activity Diagrams?
Activity diagram is suitable for modelling the activity flow of the system. An application
can have multiple systems. Activity diagram also captures these systems and describes the flow
from one system to another. This specific usage is not available in other diagrams.
Activity diagram can be used for-
• Modelling work flow by using activities.
• Modelling business requirements.
• High level understanding of the system’s functionalities.
• Investigating business requirements at a later stage.

Steps To Construct Activity Diagram


• Identify the preconditions of the workflow

• Collect the abstractions that are involved in the operations

• Beginning at the operation’s initial state, specify the activities and actions.

• Use branching to specify conditional paths and iterations

• Use forking & joining to specify parallel flows of control.

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


54
Agricultural Crop Recommendations based on Productivity and Season

6.2.5.1 Activity Diagram for Service Provider

Login
Invalid

Check
Valid

View user uploaded crop data set


Details

Train model with SVM Logistic regressions

View Trained & Tested Accuracy result

View all crop yield and production

View all users

Download predicted Data set

View crop yield prediction per acre result

Log Out

Fig 6.2.5.1 Activity Diagram for Service Provider

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


55
Agricultural Crop Recommendations based on Productivity and Season

6.2.5.2 Activity Diagram for End User

Register & Login

Invalid

Check
Valid

Browse & upload crop data


set

Enter crop yield Details

Predict crop yield based on


Input

View profile

Log Out

Fig 6.2.5.2 Activity Diagram for End User

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


56
Agricultural Crop Recommendations based on Productivity and Season

6.2.6 Deployment Diagram

Deployment diagram represents the deployment view of a system. It is related to the


component diagram. Because the components are deployed using the deployment diagrams. A
deployment diagram consists of nodes. Nodes are nothing but physical hardware used to deploy
the application.

Service End user


provider

Data Base

Fig 6.2.6 Deployment Diagram

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


57
Agricultural Crop Recommendations based on Productivity and Season

CHAPTER-7
SYSTEM IMPLEMENTATION

7.1 PERFORMANCE EVALUATION

Crop production depends on many agricultural parameters. Proposed work is based on the
production of crops in previous years, crops can be recommended to the farmers. This kind of
suggestions will make farm er to know that whether that particular is yielding a good production
in recent years. Production of crops may become less due to any crop disease, water problem and
many other factors. While considering about the production, farmers may get knowledge about
which crop is in high volume in the market in that year. Based on this farmer can take decision of
trend on crops in recent years. Farmers will be given recommendation by considering the season
of crop production. Agriculture Dataset were taken that contains fields like crop year, crop name,
District, Season, A rea cultivated and production. Recommendations were given to user based on
the production of crops, season when the crops cultivated.

7.2 Service Provider


In this module, the Service Provider has to login by using valid user name and password. After
login successful he can do some operations such as View Crop Data Sets, Browse Agriculture Data
Sets and Train & Test, View Trained and Tested Accuracy in Bar Chart, View Trained and Tested
Accuracy Results, View All Crop Yield and Production Prediction, Download Predicted Data Sets,
View All Remote Users, View Crop Yield Prediction Per Acre Results..

7.3 End User


In this module, there are n numbers of users are present. User should register before doing any
operations. Once user registers, their details will be stored to the database. After registration
successful, he has to login by using authorized user name and password. Once Login is successful
user will do some operations like Post Crops Data Sets, Predict Crop Yield And Production, View
Your Profile.

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


58
Agricultural Crop Recommendations based on Productivity and Season

CHAPTER-8
TESTING
8.1 TESTING PRINCIPLES:
The purpose of testing is to discover errors. Testing is the process of trying to discover every
conceivable fault or weakness in a work product. It provides a way to check the functionality of
components, subassemblies, assemblies and/or a finished product It is the process of exercising
software with the intent of ensuring that the
Software system meets its requirements and user expectations and does not fail in an
unacceptable manner. There are various types of test. Each test type addresses a specific testing
requirement.
Unit testing:

Unit testing involves the design of test cases that validate that the internal program logic is
functioning properly, and that program inputs produce valid outputs. All decision branches and
internal code flow should be validated. It is the testing of individual software units of the
application .it is done after the completion of an individual unit before integration. This is a
structural testing, that relies on knowledge of its construction and is invasive. Unit tests perform
basic tests at component level and test a specific business process, application, and/or system
configuration. Unit tests ensure that each unique path of a business process performs accurately to
the documented specifications and contains clearly defined inputs and expected results. This is a
structural testing, that relies on knowledge of its construction and is invasive. It is a software
development process in which the smallest testable parts of an application, called units, are
individually and independently scrutinized for proper operation.

Integration testing:

Integration tests are designed to test integrated software components to determine if they actually
run as one program. Testing is event driven and is more concerned with the basic outcome of
screens or fields. Integration tests demonstrate that although the components were individually
satisfaction, as shown by successfully unit testing, the combination of components is correct and
consistent. Integration testing is specifically aimed at exposing the problems that arise from the
combination of components. It is a type of software testing in which the different units, modules
or components of a software application are tested as a combined entity.

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


59
Agricultural Crop Recommendations based on Productivity and Season

Functional testing:

Functional tests provide systematic demonstrations that functions tested are available as specified
by the business and technical requirements, system documentation, and user manuals.

Functional testing is centered on the following items:

Valid Input : identified classes of valid input must be accepted.

Invalid Input : identified classes of invalid input must be rejected.

Functions : identified functions must be exercised.

Output : identified classes of application outputs must be exercised.

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

Organization and preparation of functional tests is focused on requirements, key functions, or


special test cases. In addition, systematic coverage pertaining to identify Business process flows;
data fields, predefined processes, and successive processes must be considered for testing. Before
functional testing is complete, additional tests are identified and the effective value of current tests
is determined. It is a type of software testing that validates the software system against the
functional requirements/specifications. The purpose of Functional tests is to test each function of
the software application, by providing appropriate input, verifying the output against the functional
requirements.

System testing:

System testing ensures that the entire integrated software system meets requirements. It tests a
configuration to ensure known and predictable results. An example of system testing is the
configuration oriented system integration test. System testing is based on process descriptions and
flows, emphasizing pre-driven process links and integration points.
Types of System testing:
• Performance testing
• Load testing
• Stress testing
• Scalability testing

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


60
Agricultural Crop Recommendations based on Productivity and Season

8.2 TESTING STRATEGY and APPROACH:


Field testing will be performed manually and functional tests will be written in detail.

8.3 TESING OBJECTIVES:

• All field entries must work properly.


• Pages must be activated from the identified link.
• The entry screen, messages and responses must not be delayed.

Features to be tested:

• Verify that the entries are of the correct format


• No duplicate entries should be allowed
• All links should take the user to the correct page.

Integration Testing:

Integration tests are designed to test integrated software components to determine if they
actually run as one program.

Software integration testing is the incremental integration testing of two or more integrated
software components on a single platform to produce failures caused by interface defects.

The task of the integration test is to check that components or software applications, e.g.
components in a software system or – one step up – software applications at the company level
– interact without error.

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


61
Agricultural Crop Recommendations based on Productivity and Season

Test Results:

All the test cases mentioned above passed successfully. No defects encountered.

Acceptance Testing:

User Acceptance Testing is a critical phase of any project and requires significant participation by
the end user. It also ensures that the system meets the functional requirements.

Test Results:

All the test cases mentioned above passed successfully. No defects encountered.

8.3.1 WHITE BOX TESTING:

White Box Testing is a testing in which in which the software tester has knowledge of the inner
workings, structure and language of the software, or at least its purpose. It is purpose. It is used to
test areas that cannot be reached from a black box level. This techniques analyze the internal
structures, internal design, code structure and the working of the software rather than just the
functionality as in black box testing.
It is also called glass box testing or clear box testing or structural testing.
Working process of white box testing:
The following describes the working process of white box testing-
• Input: Requirements, Functional specifications, design documents, source code.
• Processing: Performing risk analysis for guiding through the entire process.
• Proper test planning: designing test cases so as to cover entire code. Execute rinse-
repeat until error-free software is reached. Also, the results are communicated.
• Output: Preparing final report of the entire testing process.
Cyclomatic Complexity:

It is a measure that provides an idea of the logical complexity of a program.

• Cyclomatic complexity coincides with the number of regions of the flow graph.
• The cyclomatic complexity, V(G), of a flow graph G, is defined as V(G) = Edges – Nodes
+2
• The cyclomatic complexity, V(G), of a flow graph G, is also defined as V(G) = predicate

nodes + 1

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


62
Agricultural Crop Recommendations based on Productivity and Season

From the flow graph of the figure, the cyclomatic complexity would be:

• Since the graph has four regions, V(G) = 4

• Since the graph has 11 edges and 9 nodes, V(G) = 11 – 9 – 2 = 4

• Since the graph has 3 predicate nodes, V(G) = 3 + 1 = 4

From the value of cyclomatic complexity we obtain the number of independent


paths, which give us a limit value for the number of tests we have to design. In
the example, the number of independent roads is 4, and the independent roads are:

• 1–11

• 1–2–3–4–5–10–1–11

• 1–2–3–6–7–9–10–1–11

• 1–2–3–6–8–9–10–1–11

S V COLLEGE OF ENGINEERING , DEPARTMENT OF CSE


63
Agricultural Crop Recommendations based on Productivity and Season

Test Design steps through the basic path:

• Obtain the flow graph, from the design or module code.

• Obtain the cyclomatic complexity of the flow graph.

• Define the basic set of independent paths.

• Determine the test cases that allow execution of each previous paths.

• Execute each test case and verify that the results are as expected.

8.3.1 BLACK BOX TESTING:

Black Box Testing is testing the software without any knowledge of the inner workings, structure or
language of the module being tested. Black box tests, as most other kinds of tests, must be written from a
definitive source document, such as specification or requirements document, such as specification or
requirements document. It is a testing in which the software under test is treated, as a black box .you
cannot “see” into it. The test provides inputs and responds to outputs without considering how the software
works.

S V COLLEGE OF ENGINEERING , DEPARTMENT OF CSE


64
Agricultural Crop Recommendations based on Productivity and Season

This technique usually considers the state, outputs, and inputs of a system during a specific period.

Based on the type of software that is tested, it checks for the behavioral changes of a system
in a particular state or another state while maintaining the same inputs.

The test cases for this technique are created by checking the sequence of transitions and state
or events among the inputs.

The whole set of test cases will have the traversal of the expected output values and all states.

S V COLLEGE OF ENGINEERING , DEPARTMENT OF CSE


65
Agricultural Crop Recommendations based on Productivity and Season

CHAPTER-9
SAMPLE SOURCE CODE

Design.html
<!DOCTYPE html>
{% load static %}
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Remote User</title>
<link href="https://fonts.googleapis.com/css?family=Russo+One" rel="stylesheet">
<style>
body{background: url("{% static 'bg.jpg' %}");
background-size:cover;
font-family: 'Russo One', sans-serif;
background-color: #000000;
}
h1{
color:white;
}
.topnav {
overflow: hidden;
background-color: #812;
}

.topnav a {
float: left;
color: #FFFFFF;
text-align: center;

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


66
Agricultural Crop Recommendations based on Productivity and Season

padding: 14px 16px;


text-decoration: none;
font-size: 17px;
}
.topnav a:hover {
background-color: #ddd;
color: black;
}
.topnav a.active {
background-color: #8e4fd1;
color: white;
}
.style1 {color: #FF0000}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>
<body>

<h1 align="center" class="style1">Agricultural Crop Recommendations based on Productivity


and Season</h1>

<div class="topnav">
<a class="active" href="{% url 'Add_DataSet_Details' %}">POST CROPS DATA SETS</a>
<a href="{% url 'Predict_Crop_Yiled_OnDataSets' %}">PREDICT CROP YIELD AND
PRODUCTION </a>
<a href="{% url 'ViewYourProfile' %}">VIEW YOUR PROFILE</a>
<a href="{% url 'login' %}">LOGOUT</a>
</div>

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


67
Agricultural Crop Recommendations based on Productivity and Season

<div class="mainholder">
{% block userblock %}
{% endblock %}
</div>
</body>
</html>
Login.html
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet"
id="bootstrap-css">
{% load static %}
<!DOCTYPE html>

<html lang="en">

<title>Login</title>

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

<head>

<link rel="icon" href="images/icon.png" type="image/x-icon" />

<link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet">


<link href="https://fonts.googleapis.com/css?family=Righteous"
rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Fredoka+One" rel="stylesheet">

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


68
Agricultural Crop Recommendations based on Productivity and Season

<style>
body {background: url("{% static 'bg.jpg' %}");
}
.container-fluid {padding:50px;}
.container{background-color:white;padding:50px; }
#title{font-family: 'Fredoka One', cursive;
}
.text-uppercase{
font-family: 'Righteous', cursive;

}
.style1 {color: #FF0000}
.style4 {color: #FF0000; font-weight: bold; }
.style5 {
font-family: 'Righteous', cursive;
color: #FF0000;
font-weight: bold;
}
</style>
</head>
<body>
<div class="container-fluid">
<div >
<h2 class="style1 text-center" id="title"><strong>Agricultural Crop
Recommendations based on Productivity and Season
</strong></h2>
<p class="text-center">

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


69
Agricultural Crop Recommendations based on Productivity and Season

<span class="style4"><small id="passwordHelpInline" class="text-muted">Recommender


System, Machine Learning and Data Science, Knowledge Discovery in Databases, Naive Bayes
</small></span> </p>
<hr>
<div class="row">
<div class="col-md-5">
<form role="form" method="POST" >
{% csrf_token %}
<fieldset>
<p class="text-uppercase pull-
center">&nbsp;</p>
</fieldset>
</form>
</div>

<div class="col-md-2">
<! null >
</div>

<div class="col-md-5">
<form method="POST" role="form">
{% csrf_token %}

<fieldset>
{% load static %}
<img src="{% static '/login.jpg' %}" alt="My
image">
<p class="style5"> Login Using Your
Account: </p>

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


70
Agricultural Crop Recommendations based on Productivity and Season

<div class="form-group">
<input type="text"
name="username" class="form-control input-lg" placeholder="User Name" required>
</div>
<div class="form-group">
<input type="password"
name="password" class="form-control input-lg" placeholder="Password" required>
</div>
<div>
<input type="submit"
name="submit1" class="btn btn-md" value="sign_in">
</div></br>

<p class="style5"> Login Using Your


Account: </p>

<div>

<button class="btn btn-lg "><a href="{% url


'serviceproviderlogin' %}">SERVICE PROVIDER</a></button>
<button class="btn btn-lg "><a href="{% url 'Register1'
%}">REGISTER</a></button>
</div>
</fieldset>
</form>
</div>
</div>
</div>

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


71
Agricultural Crop Recommendations based on Productivity and Season

</div>
</body>
</html>
Register.html
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet"
id="bootstrap-css">

{% load static %}

<!DOCTYPE html>

<html lang="en">

<title>Register Your Details</title>

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

<style type="text/css">
<!--
.style1 {

color: #FF0000;
font-weight: bold;
}
-->
</style>
<head>

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


72
Agricultural Crop Recommendations based on Productivity and Season

<link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet">


<link href="https://fonts.googleapis.com/css?family=Righteous"
rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Fredoka+One" rel="stylesheet">
<style>
body {background: url("{% static 'bg.jpg' %}");
}
.container-fluid {padding:50px;}
.container{background-color:white;padding:50px; }
#title{font-family: 'Fredoka One', cursive;
}
.text-uppercase{
font-family: 'Righteous', cursive;

}
</style>
</head>
<body>

<div class="container-fluid">
<div>
<h2 class="text-center style1" id="title">Agricultural Crop
Recommendations based on Productivity and Season
</h2>
<p class="text-center">
<span class="style1"><small id="passwordHelpInline"
class="text-muted">Recommender System, Machine Learning and Data Science, Knowledge
Discovery in Databases, Naive Bayes

</small></span></p>

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


73
Agricultural Crop Recommendations based on Productivity and Season

<hr>
<div class="row">
<div class="col-md-5">
<form role="form" method="POST" >
{% csrf_token %}
<fieldset>
{% load static %}
<img src="{% static '/Register.jpg' %}" alt="My
image"><br>
<span class="style1">REGISTER YOUR
DETAILS HERE !!! </span>
<div class="form-group">
<input type="text"
name="username" id="username" placeholder="User Name" required>
</div>

<div class="form-group">
<input type="email" name="email"
id="email" placeholder="Email Address" required>

</div>
<div class="form-group">
<input type="password"
name="password" id="password" placeholder="Password" required>
</div>
<div class="form-group">
<input type="number"
name="phoneno" id="phoneno" placeholder="Mobile Number" required>
</div>
<div class="form-group">

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


74
Agricultural Crop Recommendations based on Productivity and Season

<input type="text" name="country" id="country" placeholder="Country" required>


</div>
<div class="form-group">
<input type="text" name="state"
id="state" placeholder="State" required>
</div>
<div class="form-group">
<input type="text" name="city"
id="city" placeholder="City" required>

</div>

<div class="form-check">
<label class="form-check-label"></label>
</div>
<div>
<input type="submit"
class="btn btn-lg btn-primary" name="submit" value="sign_up" >
</div>

</fieldset>
<div><br>
<button class="btn btn-lg "><a href="{% url
'login' %}">User Login</a></button>

</div>
</form>
</div>

<div class="col-md-2">
<! null >
</div>

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


75
Agricultural Crop Recommendations based on Productivity and Season

<div class="col-md-5"> </div>


</div>
</div>

</div>
</body>
</html>
ViewYourProfile.html
{% extends 'RUser/design.html' %}
{% block userblock %}
<link rel="icon" href="images/icon.png" type="image/x-icon" />
<link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Righteous"
rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Fredoka+One" rel="stylesheet">
<style>
body {background-color:#000000;}
.container-fluid {padding:50px;}
.container{background-color:white;padding:50px; }
#title{font-family: 'Fredoka One', cursive;
}
.text-uppercase{
font-family: 'Righteous', cursive;

}
.style1 {
color: #FF0000;
font-weight: bold;

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


76
Agricultural Crop Recommendations based on Productivity and Season

}
</style>
<body>
<div class="container-fluid">
<div class="container">

<div class="row">
<div class="col-md-5">
<form role="form" method="POST" >
{% csrf_token %}
<fieldset>
<p class="text-uppercase pull-center
style1">YOUR PROFILE DETAILS !!! </p>
<hr>
<div class="form-group">
<P><span class="style1">USER NAME</span> =
{{object.username}}</P>
</div>
<div class="form-group">
<P><span class="style1">EMAIL</span> = {{object.email}}</P>
</div>

<div class="form-group">
<P><span class="style1">PASSWORD</span> = {{object.password}}</P>
</div>

<div class="form-group">
<p><span class="style1">MOBILE NO</span> = {{object.phoneno}}</p>

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


77
Agricultural Crop Recommendations based on Productivity and Season

</div>
<div class="form-group">
<p><span class="style1">COUNTRY</span> = {{object.country}}</p>
</div>
<div class="form-group">
<p><span class="style1">STATE</span> = {{object.state}}</p>

</div>
<div class="form-group">
<p><span class="style1">CITY</span> = {{object.city}}</p>

</div>
</fieldset>
</form>
</div>

<div class="col-md-2">
<! null >
</div>
</div>
</div>
</div>
{% endblock %}

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


78
Agricultural Crop Recommendations based on Productivity and Season

CHAPTER-10
RESULTS
Below figure shows the program running on pycharm.

Fig 1. Running Program on Pycharm


If we run the program on pycharm, home page will be displayed. Below figure shows the
home page of Agricultural Crop Recommendations based on Productivity and Season.

Fig 2. Home Page

S V COLLEGE OF ENGINEERING , DEPARTMENT OF CSE


79
Agricultural Crop Recommendations based on Productivity and Season

Below figure shows the admin login page of Agricultural Crop Recommendations based on
Productivity and Season. Here service Provider will login.

Fig 3. Admin Login Page


Below figure shows the user registration page of Agricultural Crop Recommendations based on
Productivity and season. Here user can register.

Fig 4. User Registration

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


80
Agricultural Crop Recommendations based on Productivity and Season

Below figure shows the user login page of Agricultural Crop Recommendations based on
Productivity and Season. Here user will login.

Fig 5. User Login


Below figure shows the post crop dataset of Agricultural Crop Recommendations based on
Productivity and Season. Here user uploaded crop dataset will be displayed.

Fig 6. Post Crop Dataset

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


81
Agricultural Crop Recommendations based on Productivity and Season

Here user uploaded crop dataset will be trained with Logistic Regression.

Fig 7. Train Crop Dataset with Logistic Regression


Here user uploaded crop dataset will be trained with K Neighbours Classifier.

Fig 8. Train Crop Dataset with K Neighbours Classifier

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


82
Agricultural Crop Recommendations based on Productivity and Season

Below figure shows the labelled data after training with ML algorithms.

Fig 9. Labelled Data after training with ML Algorithms


Below figure shows the trained and test accuracy results of Agricultural Crop Recommendations
based on Productivity and Season. Here trained and test accuracy results will be displayed.

Fig 10. Trained and Test Accuracy Results

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


83
Agricultural Crop Recommendations based on Productivity and Season

Below figure shows the predict crop yield of Agricultural Crop Recommendations based on
Productivity and Season. Here user will upload the crop details to predict his crop yield.

Fig 11. Predict Crop Yield


Below figure shows the crop yield details of Agricultural Crop Recommendations based on
Productivity and Season. Here user can view his yield prediction and production prediction.

Fig 12. Crop Yield Details

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


84
Agricultural Crop Recommendations based on Productivity and Season

CHAPTER-11

CONCLUSION & FUTURE ENHANCEMENTS

CONCLUSION
In this project, significance of management of crops was studied vastly. Farmers need assistance
with recent technology to grow their crops. Proper prediction of crops can be informed to
agriculturists in time basis. Many Machine Learning techniques have been used to analyze the
agriculture parameters. Some of the techniques in different aspects of agriculture are studied by a
literature study. Blooming Neural networks, soft computing techniques plays significant part in
providing recommendations. Considering the parameter like production and season, more
personalized and relevant recommendations can be given.

FUTURE ENHANCEMENTS
In future, Blooming Neural networks, Soft computing techniques plays significant part in
providing recommendations. Considering the parameter like production and season, more
personalized and relevant recommendations can be given to farmers which makes them to yield
good volume of production

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


85
Agricultural Crop Recommendations based on Productivity and Season

CHAPTER-12
BIBLIOGRAPHY

[1] U. Paschen, C. Pitt, and J. Kietzmann, ‘‘Artificial intelligence: Building blocks and an
innovation typology,’’ Bus. Horizons, vol. 63, no. 2, pp. 147–155, Mar. 2020.
[2] P. Yu, Z. Xia, J. Fei, and S. K. Jha, ‘‘An application review of artificial intelligence in
prevention and cure of COVID-19 pandemic,’’ Comput., Mater. Continua, vol. 65, no. 1, pp. 743–
760, 2020.
[3] L. Shen, X. Chen, Z. Pan, K. Fan, F. Li, and J. Lei, ‘‘No-reference stereoscopic image quality
assessment based on global and local content characteristics,’’ Neurocomputing, vol. 424, no. 2,
pp. 132–142, Feb. 2021.
[4] H. Beck, ‘‘Banking is essential, banks are not. The future of financial intermediation in the
age of the Internet,’’ Netnomics, vol. 3, no. 1, pp. 7–22, 2001.
[5] G. N. F. Weiss, K. Pelger, and A. Horsch, ‘‘Mitigating adverse selection in P2P lending–
empirical evidence from prosper.com,’’ SSRN Electron. J., vol. 19, no. 7, pp. 65–93, 2010.
[6] Y. Houston, C. Jongrong, J. H. Cliff, and H. Y. Chih, ‘‘E-commerce, R&D, and productivity:
Firm-level evidence from Taiwan,’’ Inf. Econ. Policy, vol. 18, no. 5, pp. 561–569, 2013.
[7] F. Allen, J. Mcandrews, and P. Strahan, ‘‘E-finance: An introduction,’’ Center Financial Inst.
Work. Papers, vol. 22, no. 1, pp. 25–27, 2012.

S V COLLEGE OF ENGINEERING, DEPARTMENT OF CSE


86

You might also like