{"nbformat":4,"nbformat_minor":0,"metadata":{"colab":{"name":"Crop_Yield_Prediction_SVR.ipynb","provenance":[],"collapsed_sections":[],"authorship_tag":"ABX9TyOVQnIMQGD9h0U9dQssXilE"},"kernelspec":{"name":"python3","display_name":"Python 3"},"language_info":{"name":"python"}},"cells":[{"cell_type":"markdown","metadata":{"id":"R5QjBRaAyC_H"},"source":["# Multiple Linear Regression\n"]},{"cell_type":"markdown","metadata":{"id":"lIMTzfBSy8Vh"},"source":["## Importing the libraries"]},{"cell_type":"code","metadata":{"id":"rN03-Fe5mUhY","executionInfo":{"status":"ok","timestamp":1628941842594,"user_tz":-480,"elapsed":10,"user":{"displayName":"Avinnaash Suresh","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14Gg43tbnG3E_ve7kI59iMhn1idBD-ZqV8v0bXDut=s64","userId":"14263710632077858620"}}},"source":["import numpy as np\n","import matplotlib.pyplot as plt\n","import pandas as pd"],"execution_count":25,"outputs":[]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"aePtTVsdp2V9","executionInfo":{"status":"ok","timestamp":1628941840226,"user_tz":-480,"elapsed":64091,"user":{"displayName":"Avinnaash Suresh","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14Gg43tbnG3E_ve7kI59iMhn1idBD-ZqV8v0bXDut=s64","userId":"14263710632077858620"}},"outputId":"1e724bb7-062a-4ff1-cc74-2b6ab0a874b9"},"source":["from google.colab import drive\n","drive.mount('/content/drive')"],"execution_count":2,"outputs":[{"output_type":"stream","text":["Mounted at /content/drive\n"],"name":"stdout"}]},{"cell_type":"markdown","metadata":{"id":"Sx5g6jHGzE2_"},"source":["## Importing the dataset"]},{"cell_type":"code","metadata":{"id":"YL7Nm_VNnDiG","executionInfo":{"status":"ok","timestamp":1628941840694,"user_tz":-480,"elapsed":21,"user":{"displayName":"Avinnaash Suresh","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14Gg43tbnG3E_ve7kI59iMhn1idBD-ZqV8v0bXDut=s64","userId":"14263710632077858620"}}},"source":["dataset = pd.read_csv('/content/drive/MyDrive/Omdena/Local - Malaysia/Malaysia Chapter/Improving Food Security and Crop Yield in Malaysia with Machine Learning/Task 4 - Crop Yield Prediction/Dataset/data_crop_yield.csv')\n","X = dataset.iloc[:, :-1].values\n","y = dataset.iloc[:, -1].values"],"execution_count":3,"outputs":[]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/","height":414},"id":"u2Q5VuTxjoX2","executionInfo":{"status":"ok","timestamp":1628941840695,"user_tz":-480,"elapsed":20,"user":{"displayName":"Avinnaash Suresh","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14Gg43tbnG3E_ve7kI59iMhn1idBD-ZqV8v0bXDut=s64","userId":"14263710632077858620"}},"outputId":"baa6984e-5267-4188-ced1-9d9156f05aef"},"source":["dataset"],"execution_count":4,"outputs":[{"output_type":"execute_result","data":{"text/html":["
| \n"," | Crop | \n","Precipitation (mm day-1) | \n","Specific Humidity at 2 Meters (g/kg) | \n","Relative Humidity at 2 Meters (%) | \n","Temperature at 2 Meters (C) | \n","Yield | \n","
|---|---|---|---|---|---|---|
| 0 | \n","Cocoa, beans | \n","2248.92 | \n","17.72 | \n","83.40 | \n","26.01 | \n","11560 | \n","
| 1 | \n","Cocoa, beans | \n","1938.42 | \n","17.54 | \n","82.11 | \n","26.11 | \n","11253 | \n","
| 2 | \n","Cocoa, beans | \n","2301.54 | \n","17.81 | \n","82.79 | \n","26.24 | \n","9456 | \n","
| 3 | \n","Cocoa, beans | \n","2592.35 | \n","17.61 | \n","85.07 | \n","25.56 | \n","9321 | \n","
| 4 | \n","Cocoa, beans | \n","2344.72 | \n","17.61 | \n","84.12 | \n","25.76 | \n","8800 | \n","
| ... | \n","... | \n","... | \n","... | \n","... | \n","... | \n","... | \n","
| 151 | \n","Rubber, natural | \n","2308.51 | \n","18.27 | \n","83.65 | \n","26.47 | \n","6721 | \n","
| 152 | \n","Rubber, natural | \n","2410.13 | \n","18.58 | \n","83.45 | \n","26.81 | \n","6248 | \n","
| 153 | \n","Rubber, natural | \n","2967.41 | \n","18.67 | \n","85.48 | \n","26.46 | \n","6842 | \n","
| 154 | \n","Rubber, natural | \n","2333.46 | \n","18.50 | \n","84.85 | \n","26.43 | \n","5571 | \n","
| 155 | \n","Rubber, natural | \n","2109.34 | \n","18.51 | \n","83.52 | \n","26.72 | \n","5903 | \n","
156 rows × 6 columns
\n","| \n"," | Precipitation (mm day-1) | \n","Specific Humidity at 2 Meters (g/kg) | \n","Relative Humidity at 2 Meters (%) | \n","Temperature at 2 Meters (C) | \n","Yield | \n","
|---|---|---|---|---|---|
| count | \n","156.000000 | \n","156.000000 | \n","156.000000 | \n","156.00000 | \n","156.000000 | \n","
| mean | \n","2486.498974 | \n","18.203077 | \n","84.737692 | \n","26.18359 | \n","56153.096154 | \n","
| std | \n","289.457914 | \n","0.293923 | \n","0.996226 | \n","0.26105 | \n","70421.958897 | \n","
| min | \n","1934.620000 | \n","17.540000 | \n","82.110000 | \n","25.56000 | \n","5249.000000 | \n","
| 25% | \n","2302.990000 | \n","18.030000 | \n","84.120000 | \n","26.02000 | \n","8327.750000 | \n","
| 50% | \n","2424.550000 | \n","18.270000 | \n","84.850000 | \n","26.13000 | \n","18871.000000 | \n","
| 75% | \n","2718.080000 | \n","18.400000 | \n","85.510000 | \n","26.30000 | \n","67518.750000 | \n","
| max | \n","3085.790000 | \n","18.700000 | \n","86.100000 | \n","26.81000 | \n","203399.000000 | \n","