From b925da7b34256247247450662a7e4b9ec3fd2804 Mon Sep 17 00:00:00 2001 From: Parth Salian Date: Mon, 5 Sep 2022 17:41:01 +0530 Subject: [PATCH 1/6] demo commit --- Salian/details.txt | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Salian/details.txt diff --git a/Salian/details.txt b/Salian/details.txt new file mode 100644 index 0000000..a5656a0 --- /dev/null +++ b/Salian/details.txt @@ -0,0 +1,2 @@ +Name - Parth Salian +Email - parthsalian19@gmail.com \ No newline at end of file From 989d10f8245ea84725af1f509f390b7908582cf0 Mon Sep 17 00:00:00 2001 From: Parth Salian Date: Mon, 5 Sep 2022 17:53:37 +0530 Subject: [PATCH 2/6] Demo Commit --- Salian/details.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Salian/details.txt b/Salian/details.txt index a5656a0..923b924 100644 --- a/Salian/details.txt +++ b/Salian/details.txt @@ -1,2 +1,4 @@ Name - Parth Salian -Email - parthsalian19@gmail.com \ No newline at end of file +Email - parthsalian19@gmail.com + +mediocure blender artist \ No newline at end of file From 02fb994bf5be9796a64c4e4f2e5b4b57fee16e90 Mon Sep 17 00:00:00 2001 From: Parth-Salian <108936377+Parth-Salian@users.noreply.github.com> Date: Tue, 6 Sep 2022 07:32:01 -0700 Subject: [PATCH 3/6] Day1 Linear regression --- main.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 main.py diff --git a/main.py b/main.py new file mode 100644 index 0000000..a7f443d --- /dev/null +++ b/main.py @@ -0,0 +1,16 @@ +import matplotlib.pyplot as plt +from scipy import stats + +x = [5,7,8,7,2,17,2,9,4,11,12,9,6] +y = [99,86,87,88,111,86,103,87,94,78,77,85,86] + +slope, intercept, r, p, std_err = stats.linregress(x, y) + +def myfunc(x): + return slope * x + intercept + +mymodel = list(map(myfunc, x)) + +plt.scatter(x, y) +plt.plot(x, mymodel) +plt.show() \ No newline at end of file From 490fdd42278e39c26eb2e2ac2160ab6c72284d58 Mon Sep 17 00:00:00 2001 From: Parth-Salian <108936377+Parth-Salian@users.noreply.github.com> Date: Thu, 8 Sep 2022 21:49:21 -0700 Subject: [PATCH 4/6] Created using Colaboratory --- Salian/Day2/Linear_Regression.ipynb | 1087 +++++++++++++++++++++++++++ 1 file changed, 1087 insertions(+) create mode 100644 Salian/Day2/Linear_Regression.ipynb diff --git a/Salian/Day2/Linear_Regression.ipynb b/Salian/Day2/Linear_Regression.ipynb new file mode 100644 index 0000000..75f3e65 --- /dev/null +++ b/Salian/Day2/Linear_Regression.ipynb @@ -0,0 +1,1087 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "provenance": [], + "include_colab_link": true + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + } + }, + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "view-in-github", + "colab_type": "text" + }, + "source": [ + "\"Open" + ] + }, + { + "cell_type": "markdown", + "source": [ + "##Importing the Libraries and the Dataset\n" + ], + "metadata": { + "id": "ojdd1t_J7JQf" + } + }, + { + "cell_type": "code", + "source": [ + "import pandas as pd\n", + "import numpy as np" + ], + "metadata": { + "id": "koYWADIN0QXR" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "markdown", + "source": [ + "##Reading the Data\n", + "\n", + "### We have a selected boston housing dataset for this algorithm." + ], + "metadata": { + "id": "G8kWKa1E7RKF" + } + }, + { + "cell_type": "code", + "source": [ + "data = pd.read_csv(\"HousingData.csv\")\n", + "data.head() # displays the first 5 rows of the dataset" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 270 + }, + "id": "Xn82CuBZ025h", + "outputId": "fc10b9ab-6699-4512-85a2-0a5f4dedc2bf" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " CRIM ZN INDUS CHAS NOX RM AGE DIS RAD TAX PTRATIO \\\n", + "0 0.00632 18.0 2.31 0.0 0.538 6.575 65.2 4.0900 1 296 15.3 \n", + "1 0.02731 0.0 7.07 0.0 0.469 6.421 78.9 4.9671 2 242 17.8 \n", + "2 0.02729 0.0 7.07 0.0 0.469 7.185 61.1 4.9671 2 242 17.8 \n", + "3 0.03237 0.0 2.18 0.0 0.458 6.998 45.8 6.0622 3 222 18.7 \n", + "4 0.06905 0.0 2.18 0.0 0.458 7.147 54.2 6.0622 3 222 18.7 \n", + "\n", + " B LSTAT MEDV \n", + "0 396.90 4.98 24.0 \n", + "1 396.90 9.14 21.6 \n", + "2 392.83 4.03 34.7 \n", + "3 394.63 2.94 33.4 \n", + "4 396.90 NaN 36.2 " + ], + "text/html": [ + "\n", + "
\n", + "
\n", + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
CRIMZNINDUSCHASNOXRMAGEDISRADTAXPTRATIOBLSTATMEDV
00.0063218.02.310.00.5386.57565.24.0900129615.3396.904.9824.0
10.027310.07.070.00.4696.42178.94.9671224217.8396.909.1421.6
20.027290.07.070.00.4697.18561.14.9671224217.8392.834.0334.7
30.032370.02.180.00.4586.99845.86.0622322218.7394.632.9433.4
40.069050.02.180.00.4587.14754.26.0622322218.7396.90NaN36.2
\n", + "
\n", + " \n", + " \n", + " \n", + "\n", + " \n", + "
\n", + "
\n", + " " + ] + }, + "metadata": {}, + "execution_count": 2 + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "##Checking Null values in the dataset\n", + "\n", + "To check the null values in the dataset we use the function .isnull() and to find the sum of the null values present in our dataset we use .isnull.sum() " + ], + "metadata": { + "id": "pu1RNC8h7UBK" + } + }, + { + "cell_type": "code", + "source": [ + "data.isnull().sum()" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "Qy0oFimT4OEB", + "outputId": "6441df8d-ce40-45d5-f0f5-9cf4531548aa" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "CRIM 20\n", + "ZN 20\n", + "INDUS 20\n", + "CHAS 20\n", + "NOX 0\n", + "RM 0\n", + "AGE 20\n", + "DIS 0\n", + "RAD 0\n", + "TAX 0\n", + "PTRATIO 0\n", + "B 0\n", + "LSTAT 20\n", + "MEDV 0\n", + "dtype: int64" + ] + }, + "metadata": {}, + "execution_count": 3 + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "##Droping the null values from the dataset\n", + "\n", + "For better prediction accuracy we need to drop the rows which contains null values. So we use .dropna() function for dropping the rows which has null values." + ], + "metadata": { + "id": "lKB3Jc1u7Yqa" + } + }, + { + "cell_type": "code", + "source": [ + "data = data.dropna()" + ], + "metadata": { + "id": "770pQBsu4meq" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "data.isnull().sum() # rechecking to find whether the dataset has any null values or not" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "85hRO1Zi5ArD", + "outputId": "f8c3bead-43fe-4766-8ae7-4111543f0aaf" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "CRIM 0\n", + "ZN 0\n", + "INDUS 0\n", + "CHAS 0\n", + "NOX 0\n", + "RM 0\n", + "AGE 0\n", + "DIS 0\n", + "RAD 0\n", + "TAX 0\n", + "PTRATIO 0\n", + "B 0\n", + "LSTAT 0\n", + "MEDV 0\n", + "dtype: int64" + ] + }, + "metadata": {}, + "execution_count": 5 + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "##Checking at the dependent and the Independent variables\n", + "\n", + "Independent Variable : An independent variable is exactly what it sounds like. It is a variable that stands alone and isn't changed by the other variables you are trying to measure. For example, someone's age might be an independent variable. Other factors (such as what they eat, how much they go to school, how much television they watch) aren't going to change a person's age.\n", + "\n", + "Dependent Variable : Just like an independent variable, a dependent variable is exactly what it sounds like. It is something that depends on other factors. For example, a test score could be a dependent variable because it could change depending on several factors such as how much you studied, how much sleep you got the night before you took the test, or even how hungry you were when you took it. \n", + "\n", + "In this case we have lower status 'LSTAT' as dependent variable and 'MEDV' as independent variable" + ], + "metadata": { + "id": "7UHG0n0G7nmj" + } + }, + { + "cell_type": "code", + "source": [ + "data1= data.loc[:,['LSTAT','MEDV']]\n", + "data1.head(5)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 206 + }, + "id": "dCrO5vHu1N_c", + "outputId": "dfa6ed16-2744-490c-8c4c-0df304a1e398" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " LSTAT MEDV\n", + "0 4.98 24.0\n", + "1 9.14 21.6\n", + "2 4.03 34.7\n", + "3 2.94 33.4\n", + "5 5.21 28.7" + ], + "text/html": [ + "\n", + "
\n", + "
\n", + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
LSTATMEDV
04.9824.0
19.1421.6
24.0334.7
32.9433.4
55.2128.7
\n", + "
\n", + " \n", + " \n", + " \n", + "\n", + " \n", + "
\n", + "
\n", + " " + ] + }, + "metadata": {}, + "execution_count": 6 + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "##Visualizing the change in the variables\n", + "\n", + "Visualization is an important tool to analyze our data. With visualization we can able to understand whether our data have outliers, whether is skewed or not skewed. \n", + "\n", + "Here, we are plotting a simple graph between 'LSTAT' and 'MEDV' to check relation between them" + ], + "metadata": { + "id": "XcOxBOvz7u9L" + } + }, + { + "cell_type": "code", + "source": [ + "import matplotlib.pyplot as plt\n", + "data.plot(x='LSTAT', y='MEDV', style='o')\n", + "plt.xlabel('LSTAT')\n", + "plt.ylabel('MEDV')\n", + "plt.show()" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 279 + }, + "id": "RgSmYYEW18j0", + "outputId": "7b028994-ee5e-4dbe-b5a2-691e045cf7ae" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "display_data", + "data": { + "text/plain": [ + "
" + ], + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX4AAAEGCAYAAABiq/5QAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nO2df5Bc1XXnv2daLdQzJoyEZwkaISSTlERhWRprYqDk3QpKxfKCgTECCQU7eOMKm60kGMVoLadSK8g65UkmNsTldbbI2gHHWBpA9iBbWcvEwnbMGpKRZ2SQhZJgJFCDjQJqEqSW1Jo5+0f3G/V03/t+dL/X773u76dKpe7X78fpJ/X3nXvuOeeKqoIQQkjn0BW3AYQQQloLhZ8QQjoMCj8hhHQYFH5CCOkwKPyEENJhzInbAD+8/e1v1yVLlsRtBiGEpIp9+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YSQDoPCTwghHQaFnxBCOgwKPyGEdBgUfkII6TAo/IQQ0mFQ+AkhpMP4/9JS1NUZxu58AAAAAElFTkSuQmCC\n" + }, + "metadata": { + "needs_background": "light" + } + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "##Dividing the data into independent and dependent variables\n", + "\n", + "This is a common method for splitting the data into two variables which is further determined to predict the accuracy\n" + ], + "metadata": { + "id": "SIvcAarP71Zo" + } + }, + { + "cell_type": "code", + "source": [ + "X = pd.DataFrame(data['LSTAT'])\n", + "y = pd.DataFrame(data['MEDV'])" + ], + "metadata": { + "id": "xeLgaKx42Xce" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "markdown", + "source": [ + "##Splitting the data into train and test sets\n", + "\n", + "So, train-test split is a method for splitting the data \n", + "\n", + "This is split it into 4 parts namely:\n", + "X_train, X_test , y_train, y_test\n", + "\n", + "As in machine learning we are feeding the data to the algorithm with correct output, this data will be used by machine and will predict the values and the accuracy for the test data." + ], + "metadata": { + "id": "lek4LmAf763Y" + } + }, + { + "cell_type": "code", + "source": [ + "from sklearn.model_selection import train_test_split\n", + "X_train, X_test, y_train, y_test = train_test_split(X,y,test_size=0.3, random_state=1)" + ], + "metadata": { + "id": "SfD9hgIt2kc0" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "markdown", + "source": [ + "##Checking the shape of train and test sets\n", + "\n", + "This helps to know how much data is there in each of variable.\n", + "\n" + ], + "metadata": { + "id": "phomZpZF8AIA" + } + }, + { + "cell_type": "code", + "source": [ + "print(X_train.shape)\n", + "print(X_test.shape)\n", + "print(y_train.shape)\n", + "print(y_test.shape)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "N2fTYPlg21ug", + "outputId": "d3d21f81-9b47-4ded-fab3-ea1a605a41b1" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "(275, 1)\n", + "(119, 1)\n", + "(275, 1)\n", + "(119, 1)\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "##Training the Algorithm\n", + "\n", + "This is the core of Linear Regression.\n", + "This is the part where we are calling Linear Regression from scikit-learn \n", + "\n", + "Then we are storing the Linear Regression in a variable called regressor\n", + "\n", + "Then we are fitting the X_train, y_train in regressor." + ], + "metadata": { + "id": "xp3xDUgt8Gsg" + } + }, + { + "cell_type": "code", + "source": [ + "from sklearn.linear_model import LinearRegression\n", + "from sklearn.metrics import mean_squared_error\n", + "regressor = LinearRegression()\n", + "regressor.fit(X_train, y_train)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "dRdR2_PY3DJL", + "outputId": "f9ec3624-dffc-4b02-b826-8ccf8de88343" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "LinearRegression()" + ] + }, + "metadata": {}, + "execution_count": 11 + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "##Checking the intercept\n", + "\n", + "We are checking the intercept i.e.'c' from y=mx+c\n", + "\n", + "This line is the linear regression line from the above algorithm which we fitted." + ], + "metadata": { + "id": "ix0zsrOI8Kmu" + } + }, + { + "cell_type": "code", + "source": [ + "print(regressor.intercept_)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "xvka5e703Po6", + "outputId": "8407e598-b45f-4fe5-bb38-f790af6c53e5" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "[34.944997]\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "##Checking the slope\n", + "\n", + "This is the slope 'm' from y=mx+c" + ], + "metadata": { + "id": "7kN0DVcn8Nm0" + } + }, + { + "cell_type": "code", + "source": [ + "print(regressor.coef_)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "h0m61veV5XO8", + "outputId": "c4e15369-2446-41ac-8d2c-bdb5ad2037e2" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "[[-1.00135706]]\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "##Checking the model evaluation using RMSE\n", + "\n", + "This method helps in the evaluation of the algorithm which we had coded above. " + ], + "metadata": { + "id": "aoJ4kN368QOc" + } + }, + { + "cell_type": "code", + "source": [ + "y_train_predict = regressor.predict(X_train)\n", + "rmse = (np.sqrt(mean_squared_error(y_train, y_train_predict)))\n", + "\n", + "\n", + "print(\"The model performance for training set\")\n", + "print(\"--------------------------------------\")\n", + "print('RMSE is {}'.format(rmse))\n", + "\n", + "print(\"\\n\")" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "gV865eKw5bwh", + "outputId": "b78997a5-dec0-4cf9-ac61-579dbeba57f6" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "The model performance for training set\n", + "--------------------------------------\n", + "RMSE is 6.009611655189927\n", + "\n", + "\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "y_test_predict helps to predict the accuracy of the code" + ], + "metadata": { + "id": "FYoZnpTtEnUE" + } + }, + { + "cell_type": "code", + "source": [ + "y_test_predict = regressor.predict(X_test)\n", + "rmse = (np.sqrt(mean_squared_error(y_test, y_test_predict)))\n", + "\n", + "\n", + "print(\"The model performance for testing set\")\n", + "print(\"--------------------------------------\")\n", + "print('RMSE is {}'.format(rmse))" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "62mI6diu5dqL", + "outputId": "5ef26eac-1b6f-4860-aca6-ae5b420153f3" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "The model performance for testing set\n", + "--------------------------------------\n", + "RMSE is 6.407194718831085\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(y_test_predict)" + ], + "metadata": { + "id": "XibLSeMY62Tg", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "a9133bc6-1f5d-4878-ef5d-df1bea008f63" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "[[23.58960797]\n", + " [25.42209139]\n", + " [15.90919935]\n", + " [ 8.48914355]\n", + " [27.49490049]\n", + " [31.40019302]\n", + " [28.72656967]\n", + " [22.65834591]\n", + " [28.28597257]\n", + " [20.8258625 ]\n", + " [17.65156063]\n", + " [24.96146714]\n", + " [11.64341828]\n", + " [31.7807087 ]\n", + " [16.23964718]\n", + " [29.72792673]\n", + " [20.28512968]\n", + " [29.74795387]\n", + " [ 4.97438029]\n", + " [26.28325846]\n", + " [25.48217281]\n", + " [23.28920086]\n", + " [ 5.6152488 ]\n", + " [27.5950362 ]\n", + " [15.76900936]\n", + " [ 7.52784078]\n", + " [22.49812878]\n", + " [ 4.09318608]\n", + " [29.2973432 ]\n", + " [24.96146714]\n", + " [17.13085496]\n", + " [18.89324338]\n", + " [29.64781817]\n", + " [17.3211128 ]\n", + " [31.38016588]\n", + " [17.00067854]\n", + " [32.06108867]\n", + " [14.99796442]\n", + " [28.00559259]\n", + " [16.19959289]\n", + " [30.19856455]\n", + " [29.41750604]\n", + " [13.46588813]\n", + " [19.8044783 ]\n", + " [19.53411189]\n", + " [31.12982661]\n", + " [16.99066497]\n", + " [28.94686823]\n", + " [25.41207782]\n", + " [19.37389476]\n", + " [24.66106002]\n", + " [31.41020659]\n", + " [27.54496835]\n", + " [25.85267492]\n", + " [17.7617099 ]\n", + " [25.00152142]\n", + " [ 9.23014778]\n", + " [21.0962289 ]\n", + " [13.59606454]\n", + " [16.79039356]\n", + " [-3.07653045]\n", + " [28.18583686]\n", + " [30.48895809]\n", + " [27.23454766]\n", + " [30.08841527]\n", + " [28.66648825]\n", + " [ 0.12781213]\n", + " [26.46350273]\n", + " [13.67617311]\n", + " [18.72301268]\n", + " [27.03427625]\n", + " [28.35606756]\n", + " [19.904614 ]\n", + " [24.57093789]\n", + " [17.64154705]\n", + " [13.1354403 ]\n", + " [20.25508897]\n", + " [16.25967432]\n", + " [25.05158928]\n", + " [10.93245477]\n", + " [27.56499549]\n", + " [20.23506183]\n", + " [ 8.13866858]\n", + " [16.20960646]\n", + " [24.7712093 ]\n", + " [27.14442552]\n", + " [19.2236912 ]\n", + " [17.71164205]\n", + " [28.50627112]\n", + " [ 0.52835495]\n", + " [30.72928379]\n", + " [18.63289054]\n", + " [25.24184712]\n", + " [21.88730098]\n", + " [18.45264627]\n", + " [17.80176418]\n", + " [22.06754525]\n", + " [ 5.22471955]\n", + " [ 4.31348463]\n", + " [28.57636612]\n", + " [16.58010857]\n", + " [24.48081575]\n", + " [24.48081575]\n", + " [27.40477836]\n", + " [ 0.48830067]\n", + " [20.9259982 ]\n", + " [24.74116859]\n", + " [22.19772166]\n", + " [20.77579464]\n", + " [31.83077655]\n", + " [24.51085646]\n", + " [16.86048855]\n", + " [18.48268698]\n", + " [26.14306847]\n", + " [28.35606756]\n", + " [16.15953861]\n", + " [11.82366255]\n", + " [20.83587607]\n", + " [15.22827655]]\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [], + "metadata": { + "id": "0_6YezicFHO3" + }, + "execution_count": null, + "outputs": [] + } + ] +} \ No newline at end of file From 0633a787a4439007b1a466dd66c4e76ad14abeef Mon Sep 17 00:00:00 2001 From: Parth-Salian <108936377+Parth-Salian@users.noreply.github.com> Date: Thu, 8 Sep 2022 21:53:15 -0700 Subject: [PATCH 5/6] Created using Colaboratory --- Salian/Day3/Logistic_Regression.ipynb | 496 ++++++++++++++++++++++++++ 1 file changed, 496 insertions(+) create mode 100644 Salian/Day3/Logistic_Regression.ipynb diff --git a/Salian/Day3/Logistic_Regression.ipynb b/Salian/Day3/Logistic_Regression.ipynb new file mode 100644 index 0000000..0134da2 --- /dev/null +++ b/Salian/Day3/Logistic_Regression.ipynb @@ -0,0 +1,496 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "view-in-github", + "colab_type": "text" + }, + "source": [ + "\"Open" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "p9Q-4Rg73ndB" + }, + "source": [ + "> `Check the presentation for logistic regression before moving on to the implementation part` " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "ylBHuaTI3nPb" + }, + "outputs": [], + "source": [ + "## Logistic Regression implementation" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "xIkXN1r0Akj6" + }, + "outputs": [], + "source": [ + "import pandas as pd\n", + "import numpy as np" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "wtsdgt8XRYAx" + }, + "outputs": [], + "source": [ + "## Let's create a small sample dataset on classification (contains binary outcome)\n", + "age=[23,18,27,16,40,29,24,21,34,32]\n", + "employ=['employed','unemployed','employed','unemployed','employed','employed','unemployed','unemployed','employed','employed']\n", + "salary=[100000,0,10000,0,4000000,1500000,0,0,500000,2000000]\n", + "buy=[1,1,0,0,0,1,1,1,0,1]\n", + "\n", + "## It contains 4 columns, age,salary, employment type and last column being whether the person bought a laptop or not. (1- Yes, 0- No)\n", + "\n", + "df=pd.DataFrame(\n", + " {\n", + " 'age':age,\n", + " 'employment_type':employ,\n", + " 'salary':salary,\n", + " 'buy':buy\n", + " }\n", + ")\n", + "\n", + "## Here we are processing the categorical variables ('employed' and 'unemployed') to numerical values. \n", + "employment = pd.get_dummies(df['employment_type'], drop_first = True)\n", + "df = pd.concat([df, employment], axis = 1)\n", + "df.drop(['employment_type'], axis = 1, inplace = True)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 206 + }, + "id": "Bimm5f-Wg9Y-", + "outputId": "a7467a19-4948-4bd1-b360-ed1d8bb0307f" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " age salary buy unemployed\n", + "0 23 100000 1 0\n", + "1 18 0 1 1\n", + "2 27 10000 0 0\n", + "3 16 0 0 1\n", + "4 40 4000000 0 0" + ], + "text/html": [ + "\n", + "
\n", + "
\n", + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
agesalarybuyunemployed
02310000010
118011
2271000000
316001
440400000000
\n", + "
\n", + " \n", + " \n", + " \n", + "\n", + " \n", + "
\n", + "
\n", + " " + ] + }, + "metadata": {}, + "execution_count": 11 + } + ], + "source": [ + "df.head() # Displays the first 5 rows of the dataset" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "4c-LYGTv3kHf" + }, + "source": [ + "> - Now we want to predict whether a person is likely to buy a laptop or not on the basis of their age, salary and employment type.\n", + "- Hence we store the column we want to predict in y and the rest of the dependent features in x\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "dcPZHQQojCpW" + }, + "outputs": [], + "source": [ + "## y_data is for the single column we want to predict while x_data consists of the dependant variables (hence we remove the column 'buy' from it)\n", + "y_data = df['buy'] \n", + "x_data = df.drop('buy', axis = 1)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "oXOiTrD67zvX" + }, + "source": [ + "> Now, we split our dataset into training and testing data in the ratio if 7:3\n", + "\n", + "\n", + "---\n", + "\n", + "> ```What is Train/Test split?```\n", + "- `Training data`: It is the set of data that is used to train and make the model learn the hidden features/patterns in the data.\n", + "- `Testing data`: The test set is a separate set of data used to test the model after completing the training.\n", + "

\n", + "\n", + "> \n", + "\n", + "---\n", + ">- To know more on train-test split [click here]( https://www.youtube.com/watch?v=fwY9Qv96DJY)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "kFECcQWykCoN" + }, + "outputs": [], + "source": [ + "from sklearn.model_selection import train_test_split\n", + "x_training_data, x_test_data, y_training_data, y_test_data = train_test_split(x_data, y_data, test_size = 0.3) \n", + "# Test size is 0.3 since 30% of the data is kept for testing our model's accuracy" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "qn77Ge--8CF-" + }, + "source": [ + "### Now using sklearn library we define our logistic regression model. \n", + "*`Scikit-learn` is a free machine learning library for Python. It features various algorithms like support vector machine, random forests, and k-neighbours, and it also supports Python numerical and scientific libraries like NumPy and SciPy*" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "j1s-wCTtkHPt" + }, + "outputs": [], + "source": [ + "from sklearn.linear_model import LogisticRegression\n", + "model = LogisticRegression()" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "xuypzEK78MO-" + }, + "source": [ + "### We train the our model using our x and y training data.\n", + "> We use our trained model to predict the values of our test data (x_test_data) and store it.\n", + "\n", + "*`fit()` : It is used for model fitting. Fitting is basically equal to training. Then, after it is trained, the model can be used to make predictions, usually with a .predict() method call.*" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "6FMkDd4fkLMv" + }, + "outputs": [], + "source": [ + "model.fit(x_training_data, y_training_data)\n", + "predictions = model.predict(x_test_data)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "HNz0Of1_-og4" + }, + "source": [ + "> Now we create a confusion matrix to test the accuracy of our model\n", + "- **Confusion matrix** is used for *classfication* problems, to check the number of correct/incorrect predictions.\n", + "-It is a table that is used to define the performance of a classification algorithm. A confusion matrix visualizes and summarizes the performance of a classification algorithm\n", + "

\n", + "- " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "IcqrOcpAkONb", + "outputId": "7b63fb5c-c169-4ec0-b413-c36bac1104b6" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "[[0 2]\n", + " [1 0]]\n" + ] + } + ], + "source": [ + "from sklearn.metrics import confusion_matrix\n", + "print (confusion_matrix(y_test_data,predictions))" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "glHHhFaTSvGd" + }, + "source": [ + "\n", + "\n", + "---\n", + "\n", + "\n", + ">- As shown above \n", + "- ``` True positives ``` : 1\n", + "- ```True negatives```: 2\n", + "- Since there are no false positives/negatives the accuracy of our model is 100%\n", + "- This is usually `NOT` the case. It is very unlikely to achieve a 100% accuracy for a larger dataset with realistic values. " + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "DjSfFvWITcKw" + }, + "source": [ + "> Now we will plot a graph of logistic regression that represents the relation between age and whether a person will buy a laptop or not. " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 296 + }, + "id": "RIBpL4ZtkRmg", + "outputId": "609ea4f0-09cd-475c-cb11-6119ae804bc1" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "" + ] + }, + "metadata": {}, + "execution_count": 17 + }, + { + "output_type": "display_data", + "data": { + "text/plain": [ + "
" + ], + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEGCAYAAABo25JHAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nO3deXRW933n8fcXLSCxCaFdj9gMmFVmEdhOvMVLDBiDbWwcZ5qmM8mxe6aedk6naZOZc9KM56RN2tNpfE47Gaeum3SZGoNjTGzwEhvi2PGCxC4Wg1msDSTEjli0fOeP5wEkIRQEunoePffzOkdHugvP8733Puije3+/+7vm7oiISHgNiHcBIiISXwoCEZGQUxCIiIScgkBEJOQUBCIiIZca7wJ6Kicnx8eMGRPvMkRE+pWKiorD7p7b1bJ+FwRjxoyhvLw83mWIiPQrZnbgSst0aUhE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8vvBaZEh8QBYJiZDUnm4RCkf1IQiFyl2Jgv9wK3unuTma0DdgJX+it/AHCLu5/tmwpFro3aCESu3nDgaCwEJhF9dOZg4E4zGxEbHnhJu/XfAv7LhYlkfrau9G8KApGr9waQamY7gB8AHxEdD/4vgE+IthXsB47H1v9DoCz2JK3twO/3ecUiV0GNxSLX6cJ1/9gZwSvAC+7+SrzrErlaOiMQuX7fiz1XdxuwD1gZ53pEekRnBCIiIaczAhGRkFMQiIiEnIJARCTkFAQiIiGnIBARCbn/D1TJocjYKJYYAAAAAElFTkSuQmCC\n" + }, + "metadata": { + "needs_background": "light" + } + } + ], + "source": [ + "import seaborn as sns\n", + "sns.regplot(x=x_data['age'], y=y_data, data=df, logistic=True, ci=None)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "EoXC3xfDVBGJ" + }, + "source": [ + "- As shown in the graph, a curve is formed to seperate the 2 outcomes of our dataset.\n", + "- As depicted by the curve, ages between 15-30 are more likely to buy a new laptop\n", + "> This graph is often used to find how a feature is dependent on the value we need to predict." + ] + } + ], + "metadata": { + "colab": { + "collapsed_sections": [], + "provenance": [], + "include_colab_link": true + }, + "kernelspec": { + "display_name": "Python 3", + "name": "python3" + }, + "language_info": { + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} \ No newline at end of file From dd753ab54e3c447e18aa5ece62a483fa6a26a80d Mon Sep 17 00:00:00 2001 From: Parth-Salian <108936377+Parth-Salian@users.noreply.github.com> Date: Tue, 13 Sep 2022 20:56:23 -0700 Subject: [PATCH 6/6] Created using Colaboratory --- Random_Forest(Day 4).ipynb | 4471 ++++++++++++++++++++++++++++++++++++ 1 file changed, 4471 insertions(+) create mode 100644 Random_Forest(Day 4).ipynb diff --git a/Random_Forest(Day 4).ipynb b/Random_Forest(Day 4).ipynb new file mode 100644 index 0000000..33f76f9 --- /dev/null +++ b/Random_Forest(Day 4).ipynb @@ -0,0 +1,4471 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "view-in-github", + "colab_type": "text" + }, + "source": [ + "\"Open" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "M-dnzIcV3NYA" + }, + "source": [ + "# Random Forest Implementation\n", + "\n", + "---\n", + "\n", + "\n", + "> Random Forest is a form of Ensemble Learning that uses Bagging as an approach. \n", + "- It first selects a random subset from the data \n", + "- It creates a decision tree for that subset and evaluates it's outcome. \n", + "- It repeats the step for other random subsets. \n", + "- The final outcome is decided by `majority voting` in the case of classification problems and `average answer` (average of all the outcomes are taken) in the case of regression. \n", + "- The total number of decision trees formed by the model can be specified by us during execution. \n", + "\n", + "\n", + "\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "D4LCn7re3NYG" + }, + "outputs": [], + "source": [ + "import numpy as np\n", + "import pandas as pd" + ] + }, + { + "cell_type": "code", + "source": [ + "from google.colab import drive\n", + "drive.mount('/content/drive')" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "oNeY--p6Ccgy", + "outputId": "2fc7944c-662f-4e6f-e58a-f27ad227ad1b" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Drive already mounted at /content/drive; to attempt to forcibly remount, call drive.mount(\"/content/drive\", force_remount=True).\n" + ] + } + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "O4Sq5bEA3NYI" + }, + "outputs": [], + "source": [ + "train_data = pd.read_csv(r'/content/drive/MyDrive/Colab Notebooks/train-data.csv')\n", + "test_data = pd.read_csv(r'/content/drive/MyDrive/Colab Notebooks/test-data.csv')\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "_QYwO25Y3NYJ", + "outputId": "4ec8b4e7-7e2a-439b-92b6-6a762cbd2164" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "\n", + "RangeIndex: 5911 entries, 0 to 5910\n", + "Data columns (total 13 columns):\n", + " # Column Non-Null Count Dtype \n", + "--- ------ -------------- ----- \n", + " 0 Unnamed: 0 5911 non-null int64 \n", + " 1 Name 5911 non-null object \n", + " 2 Location 5911 non-null object \n", + " 3 Year 5911 non-null int64 \n", + " 4 Kilometers_Driven 5911 non-null int64 \n", + " 5 Fuel_Type 5911 non-null object \n", + " 6 Transmission 5911 non-null object \n", + " 7 Owner_Type 5911 non-null object \n", + " 8 Mileage 5909 non-null object \n", + " 9 Engine 5876 non-null object \n", + " 10 Power 5876 non-null object \n", + " 11 Seats 5874 non-null float64\n", + " 12 Price 5911 non-null float64\n", + "dtypes: float64(2), int64(3), object(8)\n", + "memory usage: 600.5+ KB\n" + ] + } + ], + "source": [ + "train_data.info()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 354 + }, + "id": "xHeWCBhh3NYK", + "outputId": "4f995314-93eb-4b55-80ae-883d9df74abe" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Unnamed: 0 Name Location Year \\\n", + "0 0 Maruti Wagon R LXI CNG Mumbai 2010 \n", + "1 1 Hyundai Creta 1.6 CRDi SX Option Pune 2015 \n", + "2 2 Honda Jazz V Chennai 2011 \n", + "3 3 Maruti Ertiga VDI Chennai 2012 \n", + "4 4 Audi A4 New 2.0 TDI Multitronic Coimbatore 2013 \n", + "\n", + " Kilometers_Driven Fuel_Type Transmission Owner_Type Mileage Engine \\\n", + "0 72000 CNG Manual First 26.6 km/kg 998 CC \n", + "1 41000 Diesel Manual First 19.67 kmpl 1582 CC \n", + "2 46000 Petrol Manual First 18.2 kmpl 1199 CC \n", + "3 87000 Diesel Manual First 20.77 kmpl 1248 CC \n", + "4 40670 Diesel Automatic Second 15.2 kmpl 1968 CC \n", + "\n", + " Power Seats Price \n", + "0 58.16 bhp 5.0 1.75 \n", + "1 126.2 bhp 5.0 12.50 \n", + "2 88.7 bhp 5.0 4.50 \n", + "3 88.76 bhp 7.0 6.00 \n", + "4 140.8 bhp 5.0 17.74 " + ], + "text/html": [ + "\n", + "
\n", + "
\n", + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
Unnamed: 0NameLocationYearKilometers_DrivenFuel_TypeTransmissionOwner_TypeMileageEnginePowerSeatsPrice
00Maruti Wagon R LXI CNGMumbai201072000CNGManualFirst26.6 km/kg998 CC58.16 bhp5.01.75
11Hyundai Creta 1.6 CRDi SX OptionPune201541000DieselManualFirst19.67 kmpl1582 CC126.2 bhp5.012.50
22Honda Jazz VChennai201146000PetrolManualFirst18.2 kmpl1199 CC88.7 bhp5.04.50
33Maruti Ertiga VDIChennai201287000DieselManualFirst20.77 kmpl1248 CC88.76 bhp7.06.00
44Audi A4 New 2.0 TDI MultitronicCoimbatore201340670DieselAutomaticSecond15.2 kmpl1968 CC140.8 bhp5.017.74
\n", + "
\n", + " \n", + " \n", + " \n", + "\n", + " \n", + "
\n", + "
\n", + " " + ] + }, + "metadata": {}, + "execution_count": 292 + } + ], + "source": [ + "train_data.head()" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "0GenK8SPUovo" + }, + "source": [ + "### There is some preprocessing to be done on the dataset (data cleaning, feature engineering, feature selection) \n", + "- If you know this already, skip to the model implementation section." + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "zJOwgznKVFBR" + }, + "source": [ + "# Data Preprocessing" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 337 + }, + "id": "sjP9qbgg3NYL", + "outputId": "81ad629c-a196-4400-f6b5-337b333928a6" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Name Location Year Kilometers_Driven \\\n", + "0 Maruti Wagon R LXI CNG Mumbai 2010 72000 \n", + "1 Hyundai Creta 1.6 CRDi SX Option Pune 2015 41000 \n", + "2 Honda Jazz V Chennai 2011 46000 \n", + "3 Maruti Ertiga VDI Chennai 2012 87000 \n", + "4 Audi A4 New 2.0 TDI Multitronic Coimbatore 2013 40670 \n", + "\n", + " Fuel_Type Transmission Owner_Type Mileage Engine Power Seats \\\n", + "0 CNG Manual First 26.6 km/kg 998 CC 58.16 bhp 5.0 \n", + "1 Diesel Manual First 19.67 kmpl 1582 CC 126.2 bhp 5.0 \n", + "2 Petrol Manual First 18.2 kmpl 1199 CC 88.7 bhp 5.0 \n", + "3 Diesel Manual First 20.77 kmpl 1248 CC 88.76 bhp 7.0 \n", + "4 Diesel Automatic Second 15.2 kmpl 1968 CC 140.8 bhp 5.0 \n", + "\n", + " Price \n", + "0 1.75 \n", + "1 12.50 \n", + "2 4.50 \n", + "3 6.00 \n", + "4 17.74 " + ], + "text/html": [ + "\n", + "
\n", + "
\n", + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
NameLocationYearKilometers_DrivenFuel_TypeTransmissionOwner_TypeMileageEnginePowerSeatsPrice
0Maruti Wagon R LXI CNGMumbai201072000CNGManualFirst26.6 km/kg998 CC58.16 bhp5.01.75
1Hyundai Creta 1.6 CRDi SX OptionPune201541000DieselManualFirst19.67 kmpl1582 CC126.2 bhp5.012.50
2Honda Jazz VChennai201146000PetrolManualFirst18.2 kmpl1199 CC88.7 bhp5.04.50
3Maruti Ertiga VDIChennai201287000DieselManualFirst20.77 kmpl1248 CC88.76 bhp7.06.00
4Audi A4 New 2.0 TDI MultitronicCoimbatore201340670DieselAutomaticSecond15.2 kmpl1968 CC140.8 bhp5.017.74
\n", + "
\n", + " \n", + " \n", + " \n", + "\n", + " \n", + "
\n", + "
\n", + " " + ] + }, + "metadata": {}, + "execution_count": 293 + } + ], + "source": [ + "train_data = train_data.iloc[:,1:]\n", + "train_data.head()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "ZsqnsYWA3NYM", + "outputId": "fb138823-beaa-4512-e0be-93444f8db714" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "(5911, 12)" + ] + }, + "metadata": {}, + "execution_count": 294 + } + ], + "source": [ + "train_data.shape" + ] + }, + { + "cell_type": "markdown", + "source": [ + "\n", + "\n", + "> - Identifying the columns that can be categorised into labels. \n", + "\n" + ], + "metadata": { + "id": "mSzQB6lLpGGN" + } + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "DWeL0MiN3NYO", + "outputId": "27cb22c8-745a-4fbb-b6d6-459c864be316" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "['Mumbai' 'Pune' 'Chennai' 'Coimbatore' 'Hyderabad' 'Jaipur' 'Kochi'\n", + " 'Kolkata' 'Delhi' 'Bangalore' 'Ahmedabad']\n", + "['CNG' 'Diesel' 'Petrol' 'LPG' 'Electric']\n", + "['Manual' 'Automatic']\n", + "['First' 'Second' 'Fourth & Above' 'Third']\n" + ] + } + ], + "source": [ + "\n", + "print(train_data['Location'].unique())\n", + "print(train_data['Fuel_Type'].unique())\n", + "print(train_data['Transmission'].unique())\n", + "print(train_data['Owner_Type'].unique())" + ] + }, + { + "cell_type": "markdown", + "source": [ + "\n", + "\n", + "> - Getting the number of missing values using isnull() function\n", + "\n" + ], + "metadata": { + "id": "Xpaji79apUnu" + } + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "x3ymYZqo3NYO", + "outputId": "05bc8502-d6e2-4b06-a131-83761fbe06c0" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "Name 0\n", + "Location 0\n", + "Year 0\n", + "Kilometers_Driven 0\n", + "Fuel_Type 0\n", + "Transmission 0\n", + "Owner_Type 0\n", + "Mileage 2\n", + "Engine 35\n", + "Power 35\n", + "Seats 37\n", + "Price 0\n", + "dtype: int64" + ] + }, + "metadata": {}, + "execution_count": 296 + } + ], + "source": [ + "train_data.isnull().sum()" + ] + }, + { + "cell_type": "markdown", + "source": [ + "\n", + "\n", + "> - This syntax deletes the rows that contain missing values. \n", + "- There are other various methods you can apply to handle missing values. For ex: fillna() to fill the cells with values you specify. \n", + "\n", + "\n" + ], + "metadata": { + "id": "krv0Nx11p_Sd" + } + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "VyO0UcS-3NYO" + }, + "outputs": [], + "source": [ + "train_data = train_data[train_data['Mileage'].notna()]\n", + "train_data = train_data[train_data['Engine'].notna()]\n", + "train_data = train_data[train_data['Power'].notna()]\n", + "train_data = train_data[train_data['Seats'].notna()]" + ] + }, + { + "cell_type": "markdown", + "source": [ + "\n", + "\n", + "> - Since we deleted the rows, we have to reset the index to bring back the continuity. \n", + "\n" + ], + "metadata": { + "id": "gaUUI3lXqZjk" + } + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "jn05-5VJ3NYP" + }, + "outputs": [], + "source": [ + "train_data = train_data.reset_index(drop=True)" + ] + }, + { + "cell_type": "code", + "source": [ + "train_data.head()" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 337 + }, + "id": "-qV8pkMsrNcV", + "outputId": "576d37dc-0f45-4996-bc58-6ddfbd748819" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Name Location Year Kilometers_Driven \\\n", + "0 Maruti Wagon R LXI CNG Mumbai 2010 72000 \n", + "1 Hyundai Creta 1.6 CRDi SX Option Pune 2015 41000 \n", + "2 Honda Jazz V Chennai 2011 46000 \n", + "3 Maruti Ertiga VDI Chennai 2012 87000 \n", + "4 Audi A4 New 2.0 TDI Multitronic Coimbatore 2013 40670 \n", + "\n", + " Fuel_Type Transmission Owner_Type Mileage Engine Power Seats \\\n", + "0 CNG Manual First 26.6 km/kg 998 CC 58.16 bhp 5.0 \n", + "1 Diesel Manual First 19.67 kmpl 1582 CC 126.2 bhp 5.0 \n", + "2 Petrol Manual First 18.2 kmpl 1199 CC 88.7 bhp 5.0 \n", + "3 Diesel Manual First 20.77 kmpl 1248 CC 88.76 bhp 7.0 \n", + "4 Diesel Automatic Second 15.2 kmpl 1968 CC 140.8 bhp 5.0 \n", + "\n", + " Price \n", + "0 1.75 \n", + "1 12.50 \n", + "2 4.50 \n", + "3 6.00 \n", + "4 17.74 " + ], + "text/html": [ + "\n", + "
\n", + "
\n", + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
NameLocationYearKilometers_DrivenFuel_TypeTransmissionOwner_TypeMileageEnginePowerSeatsPrice
0Maruti Wagon R LXI CNGMumbai201072000CNGManualFirst26.6 km/kg998 CC58.16 bhp5.01.75
1Hyundai Creta 1.6 CRDi SX OptionPune201541000DieselManualFirst19.67 kmpl1582 CC126.2 bhp5.012.50
2Honda Jazz VChennai201146000PetrolManualFirst18.2 kmpl1199 CC88.7 bhp5.04.50
3Maruti Ertiga VDIChennai201287000DieselManualFirst20.77 kmpl1248 CC88.76 bhp7.06.00
4Audi A4 New 2.0 TDI MultitronicCoimbatore201340670DieselAutomaticSecond15.2 kmpl1968 CC140.8 bhp5.017.74
\n", + "
\n", + " \n", + " \n", + " \n", + "\n", + " \n", + "
\n", + "
\n", + " " + ] + }, + "metadata": {}, + "execution_count": 299 + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "\n", + "\n", + "> - Since columns like Mileage, Engine, Power contain units at each row, we will split the element and only extract the first value (hence remove the units from the element). \n", + "- For prediction, it is advised to only use `float/int` values as features. Object type values don't work while training models. \n", + "- **Name** column is split so that we can extract the company name (Honda, Maruti etc) only, since model names will get too specific for prediction. \n", + "\n" + ], + "metadata": { + "id": "_eeX0KWarWd5" + } + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "7lqhBhUk3NYP" + }, + "outputs": [], + "source": [ + "for i in range(train_data.shape[0]):\n", + " ## split() function splits the values into a list wherever there are spaces. \n", + " ## Hence on specifying [0] index we can remove the units. \n", + " train_data.at[i, 'Company'] = train_data['Name'][i].split()[0] # Only company name extracted\n", + " train_data.at[i, 'Mileage(km/kg)'] = train_data['Mileage'][i].split()[0]\n", + " train_data.at[i, 'Engine(CC)'] = train_data['Engine'][i].split()[0]\n", + " train_data.at[i, 'Power(bhp)'] = train_data['Power'][i].split()[0]" + ] + }, + { + "cell_type": "markdown", + "source": [ + "\n", + "\n", + "> - Since we have extracted the company names, we can check how many of such values exist in our dataset.\n", + "\n" + ], + "metadata": { + "id": "6PlgpER-sOmt" + } + }, + { + "cell_type": "code", + "source": [ + "train_data['Company'].value_counts()" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "iMobZ_-Tq0bU", + "outputId": "c41cfdd6-b7e9-4ec2-a41a-e377214ee9f5" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "Maruti 1175\n", + "Hyundai 1058\n", + "Honda 600\n", + "Toyota 394\n", + "Mercedes-Benz 316\n", + "Volkswagen 314\n", + "Ford 294\n", + "Mahindra 268\n", + "BMW 262\n", + "Audi 235\n", + "Tata 183\n", + "Skoda 172\n", + "Renault 145\n", + "Chevrolet 120\n", + "Nissan 89\n", + "Land 57\n", + "Jaguar 40\n", + "Mitsubishi 27\n", + "Mini 26\n", + "Fiat 23\n", + "Volvo 21\n", + "Porsche 16\n", + "Jeep 15\n", + "Datsun 13\n", + "Force 3\n", + "ISUZU 2\n", + "Ambassador 1\n", + "Isuzu 1\n", + "Bentley 1\n", + "Lamborghini 1\n", + "Name: Company, dtype: int64" + ] + }, + "metadata": {}, + "execution_count": 301 + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "try" + ], + "metadata": { + "id": "C3tQn_3utCxK" + } + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "fLYzcAM73NYP", + "outputId": "15de05e4-7f37-49fc-f8e9-46d8c86e39f1" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "array(['Maruti', 'Hyundai', 'Honda', 'Audi', 'Nissan', 'Toyota',\n", + " 'Volkswagen', 'Tata', 'Land', 'Mitsubishi', 'Renault',\n", + " 'Mercedes-Benz', 'Bmw', 'Mahindra', 'Ford', 'Porsche', 'Datsun',\n", + " 'Jaguar', 'Volvo', 'Chevrolet', 'Skoda', 'Mini', 'Fiat', 'Jeep',\n", + " 'Ambassador', 'Isuzu', 'Force', 'Bentley', 'Lamborghini'],\n", + " dtype=object)" + ] + }, + "metadata": {}, + "execution_count": 302 + } + ], + "source": [ + "train_data.Company=train_data.Company.str.title() \n", + "train_data['Company'].unique()" + ] + }, + { + "cell_type": "markdown", + "source": [ + "\n", + "\n", + "> - Since the values we extracted were object type, we will convert mileage, engine and power to float values\n", + "\n" + ], + "metadata": { + "id": "XG8aBgC3tF4R" + } + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "OQLWU83W3NYQ" + }, + "outputs": [], + "source": [ + "train_data['Mileage(km/kg)'] = train_data['Mileage(km/kg)'].astype(float)\n", + "train_data['Engine(CC)'] = train_data['Engine(CC)'].astype(float)\n", + "train_data['Power(bhp)'] = train_data['Power(bhp)'].astype(float)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "-HpyBrQz3NYR", + "outputId": "2984d8aa-d1cf-484b-a41b-32d2d4f86022" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "(5872, 16)" + ] + }, + "metadata": {}, + "execution_count": 304 + } + ], + "source": [ + "train_data.shape" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 444 + }, + "id": "yiUEuNYz3NYS", + "outputId": "23e6d4be-0008-4fdb-adab-23701aa028e6" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Name Location Year Kilometers_Driven \\\n", + "0 Maruti Wagon R LXI CNG Mumbai 2010 72000 \n", + "1 Hyundai Creta 1.6 CRDi SX Option Pune 2015 41000 \n", + "2 Honda Jazz V Chennai 2011 46000 \n", + "3 Maruti Ertiga VDI Chennai 2012 87000 \n", + "4 Audi A4 New 2.0 TDI Multitronic Coimbatore 2013 40670 \n", + "\n", + " Fuel_Type Transmission Owner_Type Mileage Engine Power Seats \\\n", + "0 CNG Manual First 26.6 km/kg 998 CC 58.16 bhp 5.0 \n", + "1 Diesel Manual First 19.67 kmpl 1582 CC 126.2 bhp 5.0 \n", + "2 Petrol Manual First 18.2 kmpl 1199 CC 88.7 bhp 5.0 \n", + "3 Diesel Manual First 20.77 kmpl 1248 CC 88.76 bhp 7.0 \n", + "4 Diesel Automatic Second 15.2 kmpl 1968 CC 140.8 bhp 5.0 \n", + "\n", + " Price Company Mileage(km/kg) Engine(CC) Power(bhp) \n", + "0 1.75 Maruti 26.60 998.0 58.16 \n", + "1 12.50 Hyundai 19.67 1582.0 126.20 \n", + "2 4.50 Honda 18.20 1199.0 88.70 \n", + "3 6.00 Maruti 20.77 1248.0 88.76 \n", + "4 17.74 Audi 15.20 1968.0 140.80 " + ], + "text/html": [ + "\n", + "
\n", + "
\n", + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
NameLocationYearKilometers_DrivenFuel_TypeTransmissionOwner_TypeMileageEnginePowerSeatsPriceCompanyMileage(km/kg)Engine(CC)Power(bhp)
0Maruti Wagon R LXI CNGMumbai201072000CNGManualFirst26.6 km/kg998 CC58.16 bhp5.01.75Maruti26.60998.058.16
1Hyundai Creta 1.6 CRDi SX OptionPune201541000DieselManualFirst19.67 kmpl1582 CC126.2 bhp5.012.50Hyundai19.671582.0126.20
2Honda Jazz VChennai201146000PetrolManualFirst18.2 kmpl1199 CC88.7 bhp5.04.50Honda18.201199.088.70
3Maruti Ertiga VDIChennai201287000DieselManualFirst20.77 kmpl1248 CC88.76 bhp7.06.00Maruti20.771248.088.76
4Audi A4 New 2.0 TDI MultitronicCoimbatore201340670DieselAutomaticSecond15.2 kmpl1968 CC140.8 bhp5.017.74Audi15.201968.0140.80
\n", + "
\n", + " \n", + " \n", + " \n", + "\n", + " \n", + "
\n", + "
\n", + " " + ] + }, + "metadata": {}, + "execution_count": 305 + } + ], + "source": [ + "train_data.head()" + ] + }, + { + "cell_type": "markdown", + "source": [ + "\n", + "\n", + "> - Since we created new columns `Mileage(km/kg)`, `Engine(CC)`,`Power(bhp)` and `Company` the original columns can be dropped (**Mileage, Engine, Power and Name**)\n", + "\n" + ], + "metadata": { + "id": "z5kDymDZEAzv" + } + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "nxSIEFfD3NYS" + }, + "outputs": [], + "source": [ + "train_data.drop([\"Name\"],axis=1,inplace=True)\n", + "train_data.drop([\"Mileage\"],axis=1,inplace=True)\n", + "train_data.drop([\"Engine\"],axis=1,inplace=True)\n", + "train_data.drop([\"Power\"],axis=1,inplace=True)" + ] + }, + { + "cell_type": "markdown", + "source": [ + "\n", + "\n", + "> Now we start `feature engineering` by converting the labeled categorical data to numbers for better prediction results.\n", + "- For example, for **transmission** column we give 0 for automatic cars and 1 for manual. \n", + "- We will apply this for all the columns that have categorical variables like - **Company, Location, Fuel Type, Tranmission and Owner type**\n", + "\n" + ], + "metadata": { + "id": "VHal43XzFpyV" + } + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "5_YJKZ1e3NYT", + "outputId": "13850432-ee79-44c6-ac65-81dbeaed37b0" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "\n", + "RangeIndex: 5872 entries, 0 to 5871\n", + "Data columns (total 12 columns):\n", + " # Column Non-Null Count Dtype \n", + "--- ------ -------------- ----- \n", + " 0 Location 5872 non-null object \n", + " 1 Year 5872 non-null int64 \n", + " 2 Kilometers_Driven 5872 non-null int64 \n", + " 3 Fuel_Type 5872 non-null object \n", + " 4 Transmission 5872 non-null object \n", + " 5 Owner_Type 5872 non-null object \n", + " 6 Seats 5872 non-null float64\n", + " 7 Price 5872 non-null float64\n", + " 8 Company 5872 non-null object \n", + " 9 Mileage(km/kg) 5872 non-null float64\n", + " 10 Engine(CC) 5872 non-null float64\n", + " 11 Power(bhp) 5872 non-null float64\n", + "dtypes: float64(5), int64(2), object(5)\n", + "memory usage: 550.6+ KB\n" + ] + } + ], + "source": [ + "train_data.info()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "ny0I3u9M3NYT", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "fff858fb-fca4-4784-b082-52172a1d5a45" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "Mumbai 775\n", + "Hyderabad 718\n", + "Kochi 645\n", + "Coimbatore 629\n", + "Pune 594\n", + "Delhi 545\n", + "Kolkata 521\n", + "Chennai 476\n", + "Jaipur 402\n", + "Bangalore 347\n", + "Ahmedabad 220\n", + "Name: Location, dtype: int64" + ] + }, + "metadata": {}, + "execution_count": 308 + } + ], + "source": [ + "var = 'Location'\n", + "var1= 'Company'\n", + "train_data[var].value_counts() ## Shows the number of items the values appear in the column" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "2JO8FvjX3NYT" + }, + "outputs": [], + "source": [ + "Location = train_data[[var]]\n", + "Location = pd.get_dummies(Location,drop_first=True)\n", + "Location.head()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 299 + }, + "id": "DKgb8O_O3NYU", + "outputId": "471a7f08-51db-434a-9f30-db4082d0a9b6" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Company_Audi Company_Bentley Company_Bmw Company_Chevrolet \\\n", + "0 0 0 0 0 \n", + "1 0 0 0 0 \n", + "2 0 0 0 0 \n", + "3 0 0 0 0 \n", + "4 1 0 0 0 \n", + "\n", + " Company_Datsun Company_Fiat Company_Force Company_Ford Company_Honda \\\n", + "0 0 0 0 0 0 \n", + "1 0 0 0 0 0 \n", + "2 0 0 0 0 1 \n", + "3 0 0 0 0 0 \n", + "4 0 0 0 0 0 \n", + "\n", + " Company_Hyundai ... Company_Mini Company_Mitsubishi Company_Nissan \\\n", + "0 0 ... 0 0 0 \n", + "1 1 ... 0 0 0 \n", + "2 0 ... 0 0 0 \n", + "3 0 ... 0 0 0 \n", + "4 0 ... 0 0 0 \n", + "\n", + " Company_Porsche Company_Renault Company_Skoda Company_Tata \\\n", + "0 0 0 0 0 \n", + "1 0 0 0 0 \n", + "2 0 0 0 0 \n", + "3 0 0 0 0 \n", + "4 0 0 0 0 \n", + "\n", + " Company_Toyota Company_Volkswagen Company_Volvo \n", + "0 0 0 0 \n", + "1 0 0 0 \n", + "2 0 0 0 \n", + "3 0 0 0 \n", + "4 0 0 0 \n", + "\n", + "[5 rows x 28 columns]" + ], + "text/html": [ + "\n", + "
\n", + "
\n", + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
Company_AudiCompany_BentleyCompany_BmwCompany_ChevroletCompany_DatsunCompany_FiatCompany_ForceCompany_FordCompany_HondaCompany_Hyundai...Company_MiniCompany_MitsubishiCompany_NissanCompany_PorscheCompany_RenaultCompany_SkodaCompany_TataCompany_ToyotaCompany_VolkswagenCompany_Volvo
00000000000...0000000000
10000000001...0000000000
20000000010...0000000000
30000000000...0000000000
41000000000...0000000000
\n", + "

5 rows × 28 columns

\n", + "
\n", + " \n", + " \n", + " \n", + "\n", + " \n", + "
\n", + "
\n", + " " + ] + }, + "metadata": {}, + "execution_count": 310 + } + ], + "source": [ + "Company= train_data[[var1]]\n", + "Company = pd.get_dummies(Company,drop_first=True)\n", + "Company.head()" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "XEalpAzd3NYU" + }, + "source": [ + "- Working for Fuel_Type" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "0nz15v8k3NYU", + "outputId": "43887307-5d4c-4684-db45-ff3eaad26673" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "Diesel 3152\n", + "Petrol 2655\n", + "CNG 55\n", + "LPG 10\n", + "Name: Fuel_Type, dtype: int64" + ] + }, + "metadata": {}, + "execution_count": 311 + } + ], + "source": [ + "var = 'Fuel_Type'\n", + "train_data[var].value_counts()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 206 + }, + "id": "4mqg4kvA3NYU", + "outputId": "56b4e157-80d6-4b89-cbbb-571f29b53527" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Fuel_Type_Diesel Fuel_Type_LPG Fuel_Type_Petrol\n", + "0 0 0 0\n", + "1 1 0 0\n", + "2 0 0 1\n", + "3 1 0 0\n", + "4 1 0 0" + ], + "text/html": [ + "\n", + "
\n", + "
\n", + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
Fuel_Type_DieselFuel_Type_LPGFuel_Type_Petrol
0000
1100
2001
3100
4100
\n", + "
\n", + " \n", + " \n", + " \n", + "\n", + " \n", + "
\n", + "
\n", + " " + ] + }, + "metadata": {}, + "execution_count": 312 + } + ], + "source": [ + "Fuel_t = train_data[[var]]\n", + "Fuel_t = pd.get_dummies(Fuel_t,drop_first=True)\n", + "Fuel_t.head()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "M3HdOROX3NYU", + "outputId": "d01d1603-3afb-4437-e34b-84c258d023b4" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "Manual 4170\n", + "Automatic 1702\n", + "Name: Transmission, dtype: int64" + ] + }, + "metadata": {}, + "execution_count": 313 + } + ], + "source": [ + "var = 'Transmission'\n", + "train_data[var].value_counts()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 206 + }, + "id": "fWetvbdB3NYV", + "outputId": "620c3f4c-597f-4ffb-e94e-5b0efb1f6604" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Transmission_Manual\n", + "0 1\n", + "1 1\n", + "2 1\n", + "3 1\n", + "4 0" + ], + "text/html": [ + "\n", + "
\n", + "
\n", + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
Transmission_Manual
01
11
21
31
40
\n", + "
\n", + " \n", + " \n", + " \n", + "\n", + " \n", + "
\n", + "
\n", + " " + ] + }, + "metadata": {}, + "execution_count": 314 + } + ], + "source": [ + "Transmission = train_data[[var]]\n", + "Transmission = pd.get_dummies(Transmission,drop_first=True)\n", + "Transmission.head()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "zat3YHjB3NYV", + "outputId": "792d5d81-5fbc-4dda-9fc3-66f5cf1f45df" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "First 4839\n", + "Second 925\n", + "Third 101\n", + "Fourth & Above 7\n", + "Name: Owner_Type, dtype: int64" + ] + }, + "metadata": {}, + "execution_count": 315 + } + ], + "source": [ + "var = 'Owner_Type'\n", + "train_data[var].value_counts()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "YCVF66GX3NYV", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 206 + }, + "outputId": "18a7daa8-733d-432c-ed6f-07d220f10bc1" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Owner_Type_First Owner_Type_Fourth & Above Owner_Type_Second \\\n", + "0 1 0 0 \n", + "1 1 0 0 \n", + "2 1 0 0 \n", + "3 1 0 0 \n", + "4 0 0 1 \n", + "\n", + " Owner_Type_Third \n", + "0 0 \n", + "1 0 \n", + "2 0 \n", + "3 0 \n", + "4 0 " + ], + "text/html": [ + "\n", + "
\n", + "
\n", + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
Owner_Type_FirstOwner_Type_Fourth & AboveOwner_Type_SecondOwner_Type_Third
01000
11000
21000
31000
40010
\n", + "
\n", + " \n", + " \n", + " \n", + "\n", + " \n", + "
\n", + "
\n", + " " + ] + }, + "metadata": {}, + "execution_count": 331 + } + ], + "source": [ + "var = 'Owner_Type'\n", + "Owner = train_data[[var]]\n", + "Owner = pd.get_dummies(Owner)\n", + "Owner.head()" + ] + }, + { + "cell_type": "markdown", + "source": [ + "\n", + "\n", + "> - Using `get_dummies()` function we converted the following columns to numerical values of 0 and 1. \n", + "\n" + ], + "metadata": { + "id": "Ush5Q74oIgtc" + } + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 317 + }, + "id": "iljoF4jD3NYV", + "outputId": "aa69591a-eec2-42ee-874b-daadf64b5fe8" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Location Year Kilometers_Driven Fuel_Type Transmission Owner_Type \\\n", + "0 Mumbai 2010 72000 CNG Manual First \n", + "1 Pune 2015 41000 Diesel Manual First \n", + "2 Chennai 2011 46000 Petrol Manual First \n", + "3 Chennai 2012 87000 Diesel Manual First \n", + "4 Coimbatore 2013 40670 Diesel Automatic Second \n", + "\n", + " Seats Price Company Mileage(km/kg) ... Company_Renault Company_Skoda \\\n", + "0 5.0 1.75 Maruti 26.60 ... 0 0 \n", + "1 5.0 12.50 Hyundai 19.67 ... 0 0 \n", + "2 5.0 4.50 Honda 18.20 ... 0 0 \n", + "3 7.0 6.00 Maruti 20.77 ... 0 0 \n", + "4 5.0 17.74 Audi 15.20 ... 0 0 \n", + "\n", + " Company_Tata Company_Toyota Company_Volkswagen Company_Volvo \\\n", + "0 0 0 0 0 \n", + "1 0 0 0 0 \n", + "2 0 0 0 0 \n", + "3 0 0 0 0 \n", + "4 0 0 0 0 \n", + "\n", + " Owner_Type_First Owner_Type_Fourth & Above Owner_Type_Second \\\n", + "0 1 0 0 \n", + "1 1 0 0 \n", + "2 1 0 0 \n", + "3 1 0 0 \n", + "4 0 0 1 \n", + "\n", + " Owner_Type_Third \n", + "0 0 \n", + "1 0 \n", + "2 0 \n", + "3 0 \n", + "4 0 \n", + "\n", + "[5 rows x 58 columns]" + ], + "text/html": [ + "\n", + "
\n", + "
\n", + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
LocationYearKilometers_DrivenFuel_TypeTransmissionOwner_TypeSeatsPriceCompanyMileage(km/kg)...Company_RenaultCompany_SkodaCompany_TataCompany_ToyotaCompany_VolkswagenCompany_VolvoOwner_Type_FirstOwner_Type_Fourth & AboveOwner_Type_SecondOwner_Type_Third
0Mumbai201072000CNGManualFirst5.01.75Maruti26.60...0000001000
1Pune201541000DieselManualFirst5.012.50Hyundai19.67...0000001000
2Chennai201146000PetrolManualFirst5.04.50Honda18.20...0000001000
3Chennai201287000DieselManualFirst7.06.00Maruti20.77...0000001000
4Coimbatore201340670DieselAutomaticSecond5.017.74Audi15.20...0000000010
\n", + "

5 rows × 58 columns

\n", + "
\n", + " \n", + " \n", + " \n", + "\n", + " \n", + "
\n", + "
\n", + " " + ] + }, + "metadata": {}, + "execution_count": 317 + } + ], + "source": [ + "final_train= pd.concat([train_data,Location,Fuel_t,Transmission,Company,Owner],axis=1)\n", + "final_train.head()\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 317 + }, + "id": "IwNG1Zs_3NYV", + "outputId": "fe6b6e14-6042-4945-89d6-63e84ab4d064" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Year Kilometers_Driven Seats Price Mileage(km/kg) Engine(CC) \\\n", + "0 2010 72000 5.0 1.75 26.60 998.0 \n", + "1 2015 41000 5.0 12.50 19.67 1582.0 \n", + "2 2011 46000 5.0 4.50 18.20 1199.0 \n", + "3 2012 87000 7.0 6.00 20.77 1248.0 \n", + "4 2013 40670 5.0 17.74 15.20 1968.0 \n", + "\n", + " Power(bhp) Location_Bangalore Location_Chennai Location_Coimbatore ... \\\n", + "0 58.16 0 0 0 ... \n", + "1 126.20 0 0 0 ... \n", + "2 88.70 0 1 0 ... \n", + "3 88.76 0 1 0 ... \n", + "4 140.80 0 0 1 ... \n", + "\n", + " Company_Renault Company_Skoda Company_Tata Company_Toyota \\\n", + "0 0 0 0 0 \n", + "1 0 0 0 0 \n", + "2 0 0 0 0 \n", + "3 0 0 0 0 \n", + "4 0 0 0 0 \n", + "\n", + " Company_Volkswagen Company_Volvo Owner_Type_First \\\n", + "0 0 0 1 \n", + "1 0 0 1 \n", + "2 0 0 1 \n", + "3 0 0 1 \n", + "4 0 0 0 \n", + "\n", + " Owner_Type_Fourth & Above Owner_Type_Second Owner_Type_Third \n", + "0 0 0 0 \n", + "1 0 0 0 \n", + "2 0 0 0 \n", + "3 0 0 0 \n", + "4 0 1 0 \n", + "\n", + "[5 rows x 53 columns]" + ], + "text/html": [ + "\n", + "
\n", + "
\n", + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
YearKilometers_DrivenSeatsPriceMileage(km/kg)Engine(CC)Power(bhp)Location_BangaloreLocation_ChennaiLocation_Coimbatore...Company_RenaultCompany_SkodaCompany_TataCompany_ToyotaCompany_VolkswagenCompany_VolvoOwner_Type_FirstOwner_Type_Fourth & AboveOwner_Type_SecondOwner_Type_Third
02010720005.01.7526.60998.058.16000...0000001000
12015410005.012.5019.671582.0126.20000...0000001000
22011460005.04.5018.201199.088.70010...0000001000
32012870007.06.0020.771248.088.76010...0000001000
42013406705.017.7415.201968.0140.80001...0000000010
\n", + "

5 rows × 53 columns

\n", + "
\n", + " \n", + " \n", + " \n", + "\n", + " \n", + "
\n", + "
\n", + " " + ] + }, + "metadata": {}, + "execution_count": 318 + } + ], + "source": [ + "final_train.drop([\"Location\",\"Fuel_Type\",\"Transmission\",\"Owner_Type\",\"Company\"],axis=1,inplace=True)\n", + "final_train.head()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "Qkjb3SPQ3NYV", + "outputId": "c6aa5f68-6b22-41f4-d1c0-869df3197e9e" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "(5872, 53)" + ] + }, + "metadata": {}, + "execution_count": 319 + } + ], + "source": [ + "final_train.shape" + ] + }, + { + "cell_type": "markdown", + "source": [ + "\n", + "\n", + "> For the column `year`we subtract it's year from the current year, 2022 to let the model learn how old the car is.\n", + "\n" + ], + "metadata": { + "id": "esu4W_lQKq42" + } + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 317 + }, + "id": "8LJuRQMo3NYW", + "outputId": "6c447096-77fd-4b1d-cb2f-9dc5ab40ecca" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Year Kilometers_Driven Seats Price Mileage(km/kg) Engine(CC) \\\n", + "0 12 72000 5.0 1.75 26.60 998.0 \n", + "1 7 41000 5.0 12.50 19.67 1582.0 \n", + "2 11 46000 5.0 4.50 18.20 1199.0 \n", + "3 10 87000 7.0 6.00 20.77 1248.0 \n", + "4 9 40670 5.0 17.74 15.20 1968.0 \n", + "\n", + " Power(bhp) Location_Bangalore Location_Chennai Location_Coimbatore ... \\\n", + "0 58.16 0 0 0 ... \n", + "1 126.20 0 0 0 ... \n", + "2 88.70 0 1 0 ... \n", + "3 88.76 0 1 0 ... \n", + "4 140.80 0 0 1 ... \n", + "\n", + " Company_Renault Company_Skoda Company_Tata Company_Toyota \\\n", + "0 0 0 0 0 \n", + "1 0 0 0 0 \n", + "2 0 0 0 0 \n", + "3 0 0 0 0 \n", + "4 0 0 0 0 \n", + "\n", + " Company_Volkswagen Company_Volvo Owner_Type_First \\\n", + "0 0 0 1 \n", + "1 0 0 1 \n", + "2 0 0 1 \n", + "3 0 0 1 \n", + "4 0 0 0 \n", + "\n", + " Owner_Type_Fourth & Above Owner_Type_Second Owner_Type_Third \n", + "0 0 0 0 \n", + "1 0 0 0 \n", + "2 0 0 0 \n", + "3 0 0 0 \n", + "4 0 1 0 \n", + "\n", + "[5 rows x 53 columns]" + ], + "text/html": [ + "\n", + "
\n", + "
\n", + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
YearKilometers_DrivenSeatsPriceMileage(km/kg)Engine(CC)Power(bhp)Location_BangaloreLocation_ChennaiLocation_Coimbatore...Company_RenaultCompany_SkodaCompany_TataCompany_ToyotaCompany_VolkswagenCompany_VolvoOwner_Type_FirstOwner_Type_Fourth & AboveOwner_Type_SecondOwner_Type_Third
012720005.01.7526.60998.058.16000...0000001000
17410005.012.5019.671582.0126.20000...0000001000
211460005.04.5018.201199.088.70010...0000001000
310870007.06.0020.771248.088.76010...0000001000
49406705.017.7415.201968.0140.80001...0000000010
\n", + "

5 rows × 53 columns

\n", + "
\n", + " \n", + " \n", + " \n", + "\n", + " \n", + "
\n", + "
\n", + " " + ] + }, + "metadata": {}, + "execution_count": 320 + } + ], + "source": [ + "final_train.loc[:, \"Year\"] = final_train[\"Year\"].apply(lambda x: 2022-x)\n", + "final_train.head()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "lsCNZAxA3NYW", + "outputId": "ecd7b578-eed8-4956-f363-7c2e4c0a2107" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "Unnamed: 0 int64\n", + "Name object\n", + "Location object\n", + "Year int64\n", + "Kilometers_Driven int64\n", + "Fuel_Type object\n", + "Transmission object\n", + "Owner_Type object\n", + "Mileage object\n", + "Engine object\n", + "Power object\n", + "Seats float64\n", + "New_Price object\n", + "dtype: object" + ] + }, + "metadata": {}, + "execution_count": 321 + } + ], + "source": [ + "test_data.dtypes" + ] + }, + { + "cell_type": "markdown", + "source": [ + "\n", + "\n", + "> **Now we apply the same preprocessing code to our test data.**\n", + "\n" + ], + "metadata": { + "id": "Qz52_fSAOF9F" + } + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "kdpv91gv3NYW", + "outputId": "3c7ccec9-0c31-4c2d-b875-5b758d24b314" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Split Done\n", + "casting 1 Done\n", + "casting 2 Done\n", + "Final Test Size: (1212, 21)\n" + ] + } + ], + "source": [ + "test_data = test_data.iloc[:,1:]\n", + "\n", + "\n", + "test_data = test_data.reset_index(drop=True)\n", + "\n", + "for i in range(test_data.shape[0]):\n", + " test_data.at[i, 'Mileage(km/kg)'] = test_data['Mileage'][i].split()[0]\n", + " test_data.at[i, 'Engine'] = str(test_data['Engine'][i])\n", + " test_data.at[i, 'Engine(CC)'] = test_data['Engine'][i].split()[0]\n", + " test_data.at[i, 'Power'] = str(test_data['Power'][i])\n", + " test_data.at[i, 'Power(bhp)'] = test_data['Power'][i].split()[0]\n", + " test_data.at[i, 'Company'] = test_data['Name'][i].split()[0]\n", + "test_data.Company=test_data.Company.str.title()\n", + "print('Split Done') \n", + "test_data['Mileage(km/kg)'] = test_data['Mileage(km/kg)'].astype(float)\n", + "test_data['Engine(CC)'] = test_data['Engine(CC)'].astype(float)\n", + "print('casting 1 Done') \n", + "\n", + "position = []\n", + "for i in range(test_data.shape[0]):\n", + " if test_data['Power(bhp)'][i]=='null':\n", + " position.append(i)\n", + " \n", + "test_data = test_data.drop(test_data.index[position])\n", + "test_data = test_data.reset_index(drop=True) \n", + "\n", + "test_data['Power(bhp)'] = test_data['Power(bhp)'].astype(float)\n", + "print('casting 2 Done') \n", + "\n", + "\n", + "test_data.drop([\"Name\"],axis=1,inplace=True)\n", + "test_data.drop([\"Mileage\"],axis=1,inplace=True)\n", + "test_data.drop([\"Engine\"],axis=1,inplace=True)\n", + "test_data.drop([\"Power\"],axis=1,inplace=True)\n", + "\n", + "var = 'Location'\n", + "Location = test_data[[var]]\n", + "Location = pd.get_dummies(Location,drop_first=True)\n", + "Location.head()\n", + "\n", + "var1='Company'\n", + "Company= test_data[[var1]]\n", + "Company = pd.get_dummies(Company,drop_first=True)\n", + "\n", + "var = 'Fuel_Type'\n", + "Fuel_t = test_data[[var]]\n", + "Fuel_t = pd.get_dummies(Fuel_t,drop_first=True)\n", + "Fuel_t.head()\n", + "\n", + "var = 'Transmission'\n", + "Transmission = test_data[[var]]\n", + "Transmission = pd.get_dummies(Transmission,drop_first=True)\n", + "Transmission.head()\n", + "\n", + "test_data.loc[:, \"Year\"] = test_data[\"Year\"].apply(lambda x: 2022-x)\n", + "\n", + "var = 'Owner_Type'\n", + "Owner = test_data[[var]]\n", + "oOwner = pd.get_dummies(Owner)\n", + "\n", + "\n", + "final_test= pd.concat([test_data,Location,Fuel_t,Transmission,Owner],axis=1)\n", + "final_test.head()\n", + "\n", + "final_test.drop([\"Location\",\"Fuel_Type\",\"Transmission\",\"Company\",\"Owner_Type\"],axis=1,inplace=True)\n", + "final_test.head()\n", + "\n", + "print(\"Final Test Size: \",final_test.shape)\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "QWxX6QZx3NYW", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 299 + }, + "outputId": "3929c35c-3181-42b7-c264-43300e17251e" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Year Kilometers_Driven Seats New_Price Mileage(km/kg) Engine(CC) \\\n", + "0 8 40929 4.0 NaN 32.26 998.0 \n", + "1 9 54493 5.0 NaN 24.70 796.0 \n", + "2 5 34000 7.0 25.27 Lakh 13.68 2393.0 \n", + "3 8 29000 5.0 NaN 18.50 1197.0 \n", + "4 6 85609 7.0 NaN 16.00 2179.0 \n", + "\n", + " Power(bhp) Location_Bangalore Location_Chennai Location_Coimbatore ... \\\n", + "0 58.20 0 0 0 ... \n", + "1 47.30 0 0 1 ... \n", + "2 147.80 0 0 0 ... \n", + "3 82.85 0 0 0 ... \n", + "4 140.00 0 0 1 ... \n", + "\n", + " Location_Hyderabad Location_Jaipur Location_Kochi Location_Kolkata \\\n", + "0 0 0 0 0 \n", + "1 0 0 0 0 \n", + "2 0 0 0 0 \n", + "3 0 0 0 0 \n", + "4 0 0 0 0 \n", + "\n", + " Location_Mumbai Location_Pune Fuel_Type_Diesel Fuel_Type_LPG \\\n", + "0 0 0 0 0 \n", + "1 0 0 0 0 \n", + "2 1 0 1 0 \n", + "3 1 0 0 0 \n", + "4 0 0 1 0 \n", + "\n", + " Fuel_Type_Petrol Transmission_Manual \n", + "0 0 1 \n", + "1 1 1 \n", + "2 0 1 \n", + "3 1 1 \n", + "4 0 1 \n", + "\n", + "[5 rows x 21 columns]" + ], + "text/html": [ + "\n", + "
\n", + "
\n", + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
YearKilometers_DrivenSeatsNew_PriceMileage(km/kg)Engine(CC)Power(bhp)Location_BangaloreLocation_ChennaiLocation_Coimbatore...Location_HyderabadLocation_JaipurLocation_KochiLocation_KolkataLocation_MumbaiLocation_PuneFuel_Type_DieselFuel_Type_LPGFuel_Type_PetrolTransmission_Manual
08409294.0NaN32.26998.058.20000...0000000001
19544935.0NaN24.70796.047.30001...0000000011
25340007.025.27 Lakh13.682393.0147.80000...0000101001
38290005.0NaN18.501197.082.85000...0000100011
46856097.0NaN16.002179.0140.00001...0000001001
\n", + "

5 rows × 21 columns

\n", + "
\n", + " \n", + " \n", + " \n", + "\n", + " \n", + "
\n", + "
\n", + " " + ] + }, + "metadata": {}, + "execution_count": 323 + } + ], + "source": [ + "final_test.head()" + ] + }, + { + "cell_type": "markdown", + "source": [ + "\n", + "\n", + "> These are the final columns\n", + "\n" + ], + "metadata": { + "id": "8lhgEcU8OVb9" + } + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "nvFYPmcp3NYX", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "51442749-22d4-4764-ec05-3a253c9f80a2" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "Index(['Year', 'Kilometers_Driven', 'Seats', 'Price', 'Mileage(km/kg)',\n", + " 'Engine(CC)', 'Power(bhp)', 'Location_Bangalore', 'Location_Chennai',\n", + " 'Location_Coimbatore', 'Location_Delhi', 'Location_Hyderabad',\n", + " 'Location_Jaipur', 'Location_Kochi', 'Location_Kolkata',\n", + " 'Location_Mumbai', 'Location_Pune', 'Fuel_Type_Diesel', 'Fuel_Type_LPG',\n", + " 'Fuel_Type_Petrol', 'Transmission_Manual', 'Company_Audi',\n", + " 'Company_Bentley', 'Company_Bmw', 'Company_Chevrolet', 'Company_Datsun',\n", + " 'Company_Fiat', 'Company_Force', 'Company_Ford', 'Company_Honda',\n", + " 'Company_Hyundai', 'Company_Isuzu', 'Company_Jaguar', 'Company_Jeep',\n", + " 'Company_Lamborghini', 'Company_Land', 'Company_Mahindra',\n", + " 'Company_Maruti', 'Company_Mercedes-Benz', 'Company_Mini',\n", + " 'Company_Mitsubishi', 'Company_Nissan', 'Company_Porsche',\n", + " 'Company_Renault', 'Company_Skoda', 'Company_Tata', 'Company_Toyota',\n", + " 'Company_Volkswagen', 'Company_Volvo', 'Owner_Type_First',\n", + " 'Owner_Type_Fourth & Above', 'Owner_Type_Second', 'Owner_Type_Third'],\n", + " dtype='object')" + ] + }, + "metadata": {}, + "execution_count": 324 + } + ], + "source": [ + "final_train.columns" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "CAZvr6cKVUN9" + }, + "source": [ + "# Model training and prediction \n", + "\n", + "\n", + "> - Here we will be implementing Random Forest to predict the `price` of the used car\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "yS_fAA3v3NYX", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "e5db38cb-9fd3-4a13-d5ea-e01198a6e2b2" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "(5872, 52)" + ] + }, + "metadata": {}, + "execution_count": 325 + } + ], + "source": [ + "X = final_train.loc[:,['Year', 'Kilometers_Driven', 'Seats',\n", + " 'Mileage(km/kg)', 'Engine(CC)', 'Power(bhp)', \n", + " 'Location_Bangalore', 'Location_Chennai', 'Location_Coimbatore',\n", + " 'Location_Delhi', 'Location_Hyderabad', 'Location_Jaipur',\n", + " 'Location_Kochi', 'Location_Kolkata', 'Location_Mumbai',\n", + " 'Location_Pune', 'Fuel_Type_Diesel', 'Fuel_Type_LPG',\n", + " 'Fuel_Type_Petrol', 'Transmission_Manual','Company_Audi', 'Company_Bmw', 'Company_Bentley',\n", + " 'Company_Chevrolet', 'Company_Datsun', 'Company_Fiat', 'Company_Force',\n", + " 'Company_Ford', 'Company_Honda', 'Company_Hyundai',\n", + " 'Company_Isuzu', 'Company_Jaguar', 'Company_Jeep',\n", + " 'Company_Lamborghini', 'Company_Land', 'Company_Mahindra',\n", + " 'Company_Maruti', 'Company_Mercedes-Benz', 'Company_Mini',\n", + " 'Company_Mitsubishi', 'Company_Nissan', 'Company_Porsche',\n", + " 'Company_Renault', 'Company_Skoda', 'Company_Tata', 'Company_Toyota',\n", + " 'Company_Volkswagen', 'Company_Volvo','Owner_Type_First','Owner_Type_Fourth & Above',\n", + " 'Owner_Type_Second', 'Owner_Type_Third']]\n", + "X.shape" + ] + }, + { + "cell_type": "markdown", + "source": [ + "\n", + "\n", + "> We define our y variables as price column\n", + "\n" + ], + "metadata": { + "id": "qKNhURuJOaey" + } + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "cdN3v_cB3NYX", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 206 + }, + "outputId": "d4e46bfd-d4c1-4301-a540-98b6748132cd" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Price\n", + "0 1.75\n", + "1 12.50\n", + "2 4.50\n", + "3 6.00\n", + "4 17.74" + ], + "text/html": [ + "\n", + "
\n", + "
\n", + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
Price
01.75
112.50
24.50
36.00
417.74
\n", + "
\n", + " \n", + " \n", + " \n", + "\n", + " \n", + "
\n", + "
\n", + " " + ] + }, + "metadata": {}, + "execution_count": 326 + } + ], + "source": [ + "y = final_train.loc[:,['Price']]\n", + "y.head()" + ] + }, + { + "cell_type": "markdown", + "source": [ + "\n", + "\n", + "> We will split the training data to 80% training and 20% validation data to check the accuracy of our model.\n", + "- `random_state` function is used to randomize the train/test split, if we don't specify a number, each time we run the code the train/test split will occur randomly thus affecting the accuracy. \n", + "- You can try changing the random_state to reach the perfect accuracy. \n", + "\n" + ], + "metadata": { + "id": "V-Gc_4hcOveu" + } + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "RqLwc_RF3NYY" + }, + "outputs": [], + "source": [ + "from sklearn.model_selection import train_test_split\n", + "X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.2, random_state = 10)" + ] + }, + { + "cell_type": "markdown", + "source": [ + "\n", + "\n", + "> First we will use `linear regression` model by importing it from sklearn.\n", + "- `score()` function shows the accuracy of the model for **regression** type.\n", + "\n" + ], + "metadata": { + "id": "5Im6ISRRPSrE" + } + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "DNcuVC5J3NYY", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "0a381a6a-1f80-42f5-ca5e-b61a6de3cebd" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "0.7707912573023203" + ] + }, + "metadata": {}, + "execution_count": 328 + } + ], + "source": [ + "from sklearn.linear_model import LinearRegression\n", + "linear_reg = LinearRegression()\n", + "linear_reg.fit(X_train, y_train)\n", + "y_pred= linear_reg.predict(X_test)\n", + "linear_reg.score(X_train,y_train)\n", + "linear_reg.score(X_test,y_test)" + ] + }, + { + "cell_type": "markdown", + "source": [ + "> As shown above, accuracy is 77% which isn't upto the mark. Hence we know try using Random Forest Regressor" + ], + "metadata": { + "id": "gCUjIU1vPoFO" + } + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "qbgE3yx53NYY", + "outputId": "2332a8cc-5faf-4091-9b38-cc82951b49f0" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stderr", + "text": [ + "/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:4: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().\n", + " after removing the cwd from sys.path.\n" + ] + }, + { + "output_type": "stream", + "name": "stdout", + "text": [ + "0.9334928477034067\n" + ] + }, + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "array([13.7373, 1.5188, 4.0458, ..., 3.4311, 6.5816, 41.1118])" + ] + }, + "metadata": {}, + "execution_count": 333 + } + ], + "source": [ + "from sklearn.ensemble import RandomForestRegressor #Used for regression \n", + "# You can use RandomForestClassifier for classification type problems.\n", + "rf_reg = RandomForestRegressor()\n", + "rf_reg.fit(X_train, y_train)\n", + "y_pred= rf_reg.predict(X_test)\n", + "print(rf_reg.score(X_test,y_test))\n" + ] + }, + { + "cell_type": "markdown", + "source": [ + "\n", + "\n", + "> We are getting an accuracy of 93% which is way better than the linear regression model used. \n", + "\n" + ], + "metadata": { + "id": "xq3W2erRQAVE" + } + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "yfbzyGZW3NYY", + "outputId": "a9f55fb6-6495-4004-8928-af0756400a3e" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "0.9334928477034067" + ] + }, + "metadata": {}, + "execution_count": 334 + } + ], + "source": [ + "from sklearn import metrics\n", + "from sklearn.metrics import mean_squared_error\n", + "rf_reg.score(X_test,y_test)\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "xJ_H0gxEFjxr" + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "colab": { + "provenance": [], + "include_colab_link": true + }, + "interpreter": { + "hash": "2a685367906741cb9257529c24e7078b021322688a9c681e89023e7723916b95" + }, + "kernelspec": { + "display_name": "Python 3.10.0 64-bit", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.10.0" + }, + "vscode": { + "interpreter": { + "hash": "c081257499a92776a7ff5343ee4d85420a7950a6ae97b0cb2aee7a7ddd41b7f2" + } + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} \ No newline at end of file