Crop Prediction using Machine Learning Approaches

— As we know the fact that, India is the second largest population country in the world and majority of people in India have agriculture as their occupation. Farmers are growing same crops repeatedly without trying new verity of crops and they are applying fertilizers in random quantity without knowing the deficient content and quantity. So, this is directly affecting on crop yield and also causes the soil acidification and damages the top layer. So, we have designed the system using machine learning algorithms for betterment of farmers. Our system will suggest the best suitable crop for particular land based on content and weather parameters. And also, the system provides information about the required content and quantity of fertilizers, required seeds for cultivation. Hence by utilizing our system farmers can cultivate a new variety of crop, may increase in profit margin and can avoid soil pollution.


INTRODUCTION
Agriculture is one of the important occupation practiced in India. It is the broadest economic sector and plays a most important role in the overall development of the country. More than 60% of the land in the country is used for agriculture in order to suffice the needs of 1.3 billion people Thus adopting new agriculture technologies is very important. This will be leads the farmers of our country towards profit [1]. Prior crop prediction and yield prediction was performed on the basis of farmers experience on a particular location. They will prefer the prior or neighborhood or more trend crop in the surrounding region only for their land and they don't have enough of knowledge about soil nutrients content such as nitrogen, phosphorus, potassium in the land. Being this as the current situation without the rotation of the crop and apply an inadequate amount of nutrients to soil it leads to reduce in the yield and soil pollution (soil acidification) and damages the top layer. Considering all these problems takes into the account we designed the system using a machine learning for betterment of the farmer. Machine learning(ML) is a game changer for agriculture sector. Machine learning is the part of artificial intelligence, has emerged together with bigdata technologies and high-performance computing to create new opportunities for data intensive science in the multi-disciplinary agritechnology domain. In the Agriculture field machine learning for instance is not a mysterious trick or magic, it is a set of well define model that collect specific data and apply specific algorithms to achieve expected results [7].
The designed system will recommend the most suitable crop for particular land. Based on weather parameter and soil content such as Rainfall, Temperature, Humidity and pH. They are collected from V C Farm Mandya, Government website and weather department. The system takes the required input from the farmers or sensors such as Temperature, Humidity and pH. This all inputs data applies to machine learning predictive algorithms like Support Vector Machine (SVM) [5] and Decision tree [6] to identify the pattern among data and then process it as per input conditions. The system recommends the crop for the farmer and also recommends the amount of nutrients to be add for the predicted crop. The system has some other specification like displaying approximated yield in q/acre, required seed for cultivation in kg/acre and the market price of the crop.

II. LITERATURE SURVE
Ashwani kumar Kushwaha [2] describes crop yield prediction methods and a suggest suitable crop so that it will improve the profit for the farmer and quality of the agriculture sector. In this paper for crop yield prediction they obtain large volume data, it's been called as big data (soil and weather data) using Hadoop platform and agro algorithm. Hence based repository data will predict the suitability crop for particular condition and improvement crop quality. Girish L [3] describe the crop yield and rain fall prediction using a machine learning method. In this paper they gone through a different machine learning approaches for the prediction of rainfall and crop yield and also mention the efficiency of a different machine learning algorithm like liner regression, SVM, KNN method and decision tree. In that algorithm they conclude that SVM have the highest efficiency for rainfall prediction.
Rahul katarya [4] describes the different machine learning methods used for accelerating crop yield. In this paper they gone through different artificial intelligence techniques such as machine learning algorithm, big data analysis for precision agriculture. They explain about crop recommender system using KNN, Ensemble-based Models, Neural networks, ...etc.

III. PROPOSED SYSTEM
The Proposed system will predict the most suitable crop for particular land based on soil contents and weather parameters such as Temperature, Humidity, soil PH and Rainfall.  To get an approximate dataset for the system. This dataset must contain the following attributes i)Soil PH ii) Temperature iii) Humidity iv) Rainfall v) Crop data vi) NPK values, those parameters will consider for crop prediction. For the annual rainfall prediction, we collect previous year rainfall data.

Data
Preprocessing: -After collecting datasets from various resources. Dataset must be preprocessing before training to the model. The data preprocessing can be done by various stages, begins with reading the collected dataset the process continues to data cleaning. In data cleaning the datasets contain some redundant attributes, those attributes are not considering for crop prediction. So, we have to drop unwanted attributes and datasets containing some missing values we need to drop these missing values or fill with unwanted nan values in order to get better accuracy. Then define the target for a model. After data cleaning the dataset will be split into training and test set by using sklearn library.

Machine Learning Algorithm for Prediction: -
Machine learning predictive algorithms has highly optimized estimation has to be likely outcome based on trained data. Predictive analytics is the use of data, statistical algorithms and machine learning techniques to identify the likelihood of future outcomes based on historical data. The goal is to go beyond knowing what has happened to providing a best assessment of what will happen in the future.
In our system we used supervised machine learning algorithm having subcategories as classification and regression. Classification algorithm will be most suitable for our system. The process starting with a load the external dataset contains previous year rainfall data. Then loaded dataset pre-processing takes place as discussed in Data Pre-processing section. After data pre-processing we train the model by using SVM classifier with Radial basis function(RBF) kernel. Then fitting the classifier into training set. Radial basis function can be written in the mathematical form in equation (1), Where, ||X1-X2|| = Eucliden distance between X1 & X2 = Gamma After fitting and test the model, at last this model will predict the appropriate annual rainfall. The predicted rainfall is the one of the input parameter for the crop prediction system.

B. Crop Prediction:
Crop prediction process being with the loading the external crop datasets. Once the dataset read then pre-processing will be done by various stages as discussed in Data Pre-processing section. After the data pre-processing, train the models using Decision tree classifier into training set. For a prediction of the crop, we consider a various factor such as temperature, humidity, soil PH and predicted rainfall. Those are the input parameter for a system that can be entered by manually or taken from the sensors. Predicted rainfall and input parameter values will be appended in a list. The Decision tree algorithm will predict the crop based on list data. The overall flow chart of the proposed system is shown in the figure (3).  Figure 3. Proposed System Flow chart.

Crop Recommendation:
Based on predicted rainfall, soil contents and weather parameters the system will recommend the most suitable crop for cultivation. This system also provides details about required fertilizers like Nitrogen(N), Phosphorus (P) and potassium(K) in Kg per hectare and display the required seed for a cultivation in Kg per acre for recommended crop.
This system as contain some other feature such as display the current market price and approximated yield in quintal per acre for recommended crop. Those all details will helps to farmers for choosing the most profitable crop.
IV. EXPERIMENTAL OUTCOME The proposed system recommends the best suitable crop for particular land by considering parameters as annual rainfall, temperature, humidity and soil pH. Among these parameters annual rainfall is predicted by system itself by using previous year data with SVM algorithm and other parameters are have to be entered by the user. In the output section the system displays a suitable crop, required seeds/acre, market price and approximate yield of the recommended crop and also the system takes NPK values in the input section to display the required NPK for the recommended crop.
The overall output is shown with Graphical user interface as shown in figure (4), Figure 4. Overall output with GUI We tested the system for various data set that has been collected from the different farmers for their lands conditions. Land condition's just like the land having different pH, humidity and NPK values. The predicted annual rainfall is constant for year 2020. Presently our farmers are not effectively using technology and analysis, so there may be a chance of wrong selection of crop for cultivation that will reduce their income. To reduce those type of loses we have developed a farmer friendly system with GUI, that will predict which would be the best suitable crop for particular land and this system will also provide information about required nutrients to add up, required seeds for cultivation, expected yield and market price. So, this makes the farmers to take right decision in selecting the crop for cultivation such that agricultural sector will be developed by innovative idea.

FUTURE SCOPE:
We have to collect all required data by giving GPS locations of a land and by taking access from Rain forecasting system of by the government, we can predict crops by just giving GPS location. Also, we can develop the model to avoid over and under crisis of the food.