{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "665e3886-31a8-4e7a-ad14-e90014ccb01e", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Requirement already satisfied: plotly==5.3.1 in c:\\users\\alilavaee\\anaconda3\\lib\\site-packages (5.3.1)\n", "Requirement already satisfied: tenacity>=6.2.0 in c:\\users\\alilavaee\\anaconda3\\lib\\site-packages (from plotly==5.3.1) (8.0.1)\n", "Requirement already satisfied: six in c:\\users\\alilavaee\\anaconda3\\lib\\site-packages (from plotly==5.3.1) (1.15.0)\n", "Requirement already satisfied: numpy in c:\\users\\alilavaee\\anaconda3\\lib\\site-packages (1.20.1)\n", "Requirement already satisfied: pandas in c:\\users\\alilavaee\\anaconda3\\lib\\site-packages (1.2.4)\n", "Requirement already satisfied: python-dateutil>=2.7.3 in c:\\users\\alilavaee\\anaconda3\\lib\\site-packages (from pandas) (2.8.1)\n", "Requirement already satisfied: numpy>=1.16.5 in c:\\users\\alilavaee\\anaconda3\\lib\\site-packages (from pandas) (1.20.1)\n", "Requirement already satisfied: pytz>=2017.3 in c:\\users\\alilavaee\\anaconda3\\lib\\site-packages (from pandas) (2021.1)\n", "Requirement already satisfied: six>=1.5 in c:\\users\\alilavaee\\anaconda3\\lib\\site-packages (from python-dateutil>=2.7.3->pandas) (1.15.0)\n", "Requirement already satisfied: pathlib in c:\\users\\alilavaee\\anaconda3\\lib\\site-packages (1.0.1)\n", "Requirement already satisfied: wget in c:\\users\\alilavaee\\anaconda3\\lib\\site-packages (3.2)\n", "Requirement already satisfied: scikit-learn in c:\\users\\alilavaee\\anaconda3\\lib\\site-packages (0.24.1)\n", "Requirement already satisfied: scipy>=0.19.1 in c:\\users\\alilavaee\\anaconda3\\lib\\site-packages (from scikit-learn) (1.6.2)\n", "Requirement already satisfied: threadpoolctl>=2.0.0 in c:\\users\\alilavaee\\anaconda3\\lib\\site-packages (from scikit-learn) (2.1.0)\n", "Requirement already satisfied: joblib>=0.11 in c:\\users\\alilavaee\\anaconda3\\lib\\site-packages (from scikit-learn) (1.0.1)\n", "Requirement already satisfied: numpy>=1.13.3 in c:\\users\\alilavaee\\anaconda3\\lib\\site-packages (from scikit-learn) (1.20.1)\n" ] } ], "source": [ "! pip install plotly==5.3.1\n", "! pip install numpy\n", "! pip install pandas\n", "! pip install pathlib\n", "! pip install wget\n", "! pip install scikit-learn" ] }, { "cell_type": "code", "execution_count": 2, "id": "340fc02e", "metadata": {}, "outputs": [], "source": [ "import plotly.graph_objects as go\n", "import numpy as np\n", "import pandas as pd\n", "from pathlib import Path\n", "import wget\n", "from sklearn.model_selection import train_test_split\n", "from sklearn.linear_model import LinearRegression" ] }, { "cell_type": "code", "execution_count": 3, "id": "92b243c6-652c-4a9c-9da3-f57472e9733b", "metadata": {}, "outputs": [], "source": [ "url = 'https://raw.githubusercontent.com/lavaman131/Linear-Regression-Tutorial/main/real_estate_costs.csv'\n", "\n", "if not Path('real_estate_costs.csv').is_file():\n", " filename = wget.download(url)" ] }, { "cell_type": "code", "execution_count": 4, "id": "fe1f2885-7e31-4a26-a497-eb14051801e1", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | X2 house age | \n", "Y house price of unit area | \n", "
---|---|---|
0 | \n", "32.0 | \n", "37.9 | \n", "
1 | \n", "19.5 | \n", "42.2 | \n", "
2 | \n", "13.3 | \n", "47.3 | \n", "
3 | \n", "13.3 | \n", "54.8 | \n", "
4 | \n", "5.0 | \n", "43.1 | \n", "