{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "IMPORTING LIBRARIES" ] }, { "cell_type": "markdown", "metadata": {}, "source": [] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import matplotlib.pyplot as plt\n", "import pandas as pd\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "IMPORTING DATASET" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[[ 1.1]\n", " [ 1.3]\n", " [ 1.5]\n", " [ 2. ]\n", " [ 2.2]\n", " [ 2.9]\n", " [ 3. ]\n", " [ 3.2]\n", " [ 3.2]\n", " [ 3.7]\n", " [ 3.9]\n", " [ 4. ]\n", " [ 4. ]\n", " [ 4.1]\n", " [ 4.5]\n", " [ 4.9]\n", " [ 5.1]\n", " [ 5.3]\n", " [ 5.9]\n", " [ 6. ]\n", " [ 6.8]\n", " [ 7.1]\n", " [ 7.9]\n", " [ 8.2]\n", " [ 8.7]\n", " [ 9. ]\n", " [ 9.5]\n", " [ 9.6]\n", " [10.3]\n", " [10.5]]\n", "[ 39343. 46205. 37731. 43525. 39891. 56642. 60150. 54445. 64445.\n", " 57189. 63218. 55794. 56957. 57081. 61111. 67938. 66029. 83088.\n", " 81363. 93940. 91738. 98273. 101302. 113812. 109431. 105582. 116969.\n", " 112635. 122391. 121872.]\n" ] } ], "source": [ "dataset = pd.read_csv('Salary_Data.csv')\n", "x=dataset.iloc[:,:-1].values\n", "y= dataset.iloc[:,-1].values\n", "print(x)\n", "print(y)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "SPLITTIG TRAINING AND TEST DATA" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "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=100)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "TRAINING\n" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
LinearRegression()In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
LinearRegression()
LinearRegression()In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
LinearRegression()