Datasets:
ArXiv:
DOI:
License:
File size: 82,435 Bytes
0eae2d5 |
1 |
{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.10","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n for filename in filenames:\n print(os.path.join(dirname, filename))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-05-23T19:58:28.967331Z","iopub.execute_input":"2023-05-23T19:58:28.967778Z","iopub.status.idle":"2023-05-23T19:58:28.985038Z","shell.execute_reply.started":"2023-05-23T19:58:28.967744Z","shell.execute_reply":"2023-05-23T19:58:28.983075Z"},"trusted":true},"execution_count":4,"outputs":[{"name":"stdout","text":"/kaggle/input/housedata/output.csv\n/kaggle/input/housedata/data.csv\n/kaggle/input/housedata/data.dat\n","output_type":"stream"}]},{"cell_type":"code","source":"import pandas as pd\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport seaborn as sns","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:28.987809Z","iopub.execute_input":"2023-05-23T19:58:28.989104Z","iopub.status.idle":"2023-05-23T19:58:29.406592Z","shell.execute_reply.started":"2023-05-23T19:58:28.989049Z","shell.execute_reply":"2023-05-23T19:58:29.405208Z"},"trusted":true},"execution_count":5,"outputs":[]},{"cell_type":"code","source":"houseprice=pd.read_csv('/kaggle/input/housedata/data.csv')","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:29.408396Z","iopub.execute_input":"2023-05-23T19:58:29.408791Z","iopub.status.idle":"2023-05-23T19:58:29.464198Z","shell.execute_reply.started":"2023-05-23T19:58:29.408755Z","shell.execute_reply":"2023-05-23T19:58:29.463007Z"},"trusted":true},"execution_count":6,"outputs":[]},{"cell_type":"code","source":"houseprice","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:29.466593Z","iopub.execute_input":"2023-05-23T19:58:29.467760Z","iopub.status.idle":"2023-05-23T19:58:29.532655Z","shell.execute_reply.started":"2023-05-23T19:58:29.467720Z","shell.execute_reply":"2023-05-23T19:58:29.531096Z"},"trusted":true},"execution_count":7,"outputs":[{"execution_count":7,"output_type":"execute_result","data":{"text/plain":" date price bedrooms bathrooms sqft_living \\\n0 2014-05-02 00:00:00 3.130000e+05 3.0 1.50 1340 \n1 2014-05-02 00:00:00 2.384000e+06 5.0 2.50 3650 \n2 2014-05-02 00:00:00 3.420000e+05 3.0 2.00 1930 \n3 2014-05-02 00:00:00 4.200000e+05 3.0 2.25 2000 \n4 2014-05-02 00:00:00 5.500000e+05 4.0 2.50 1940 \n... ... ... ... ... ... \n4595 2014-07-09 00:00:00 3.081667e+05 3.0 1.75 1510 \n4596 2014-07-09 00:00:00 5.343333e+05 3.0 2.50 1460 \n4597 2014-07-09 00:00:00 4.169042e+05 3.0 2.50 3010 \n4598 2014-07-10 00:00:00 2.034000e+05 4.0 2.00 2090 \n4599 2014-07-10 00:00:00 2.206000e+05 3.0 2.50 1490 \n\n sqft_lot floors waterfront view condition sqft_above \\\n0 7912 1.5 0 0 3 1340 \n1 9050 2.0 0 4 5 3370 \n2 11947 1.0 0 0 4 1930 \n3 8030 1.0 0 0 4 1000 \n4 10500 1.0 0 0 4 1140 \n... ... ... ... ... ... ... \n4595 6360 1.0 0 0 4 1510 \n4596 7573 2.0 0 0 3 1460 \n4597 7014 2.0 0 0 3 3010 \n4598 6630 1.0 0 0 3 1070 \n4599 8102 2.0 0 0 4 1490 \n\n sqft_basement yr_built yr_renovated street \\\n0 0 1955 2005 18810 Densmore Ave N \n1 280 1921 0 709 W Blaine St \n2 0 1966 0 26206-26214 143rd Ave SE \n3 1000 1963 0 857 170th Pl NE \n4 800 1976 1992 9105 170th Ave NE \n... ... ... ... ... \n4595 0 1954 1979 501 N 143rd St \n4596 0 1983 2009 14855 SE 10th Pl \n4597 0 2009 0 759 Ilwaco Pl NE \n4598 1020 1974 0 5148 S Creston St \n4599 0 1990 0 18717 SE 258th St \n\n city statezip country \n0 Shoreline WA 98133 USA \n1 Seattle WA 98119 USA \n2 Kent WA 98042 USA \n3 Bellevue WA 98008 USA \n4 Redmond WA 98052 USA \n... ... ... ... \n4595 Seattle WA 98133 USA \n4596 Bellevue WA 98007 USA \n4597 Renton WA 98059 USA \n4598 Seattle WA 98178 USA \n4599 Covington WA 98042 USA \n\n[4600 rows x 18 columns]","text/html":"<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>date</th>\n <th>price</th>\n <th>bedrooms</th>\n <th>bathrooms</th>\n <th>sqft_living</th>\n <th>sqft_lot</th>\n <th>floors</th>\n <th>waterfront</th>\n <th>view</th>\n <th>condition</th>\n <th>sqft_above</th>\n <th>sqft_basement</th>\n <th>yr_built</th>\n <th>yr_renovated</th>\n <th>street</th>\n <th>city</th>\n <th>statezip</th>\n <th>country</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>2014-05-02 00:00:00</td>\n <td>3.130000e+05</td>\n <td>3.0</td>\n <td>1.50</td>\n <td>1340</td>\n <td>7912</td>\n <td>1.5</td>\n <td>0</td>\n <td>0</td>\n <td>3</td>\n <td>1340</td>\n <td>0</td>\n <td>1955</td>\n <td>2005</td>\n <td>18810 Densmore Ave N</td>\n <td>Shoreline</td>\n <td>WA 98133</td>\n <td>USA</td>\n </tr>\n <tr>\n <th>1</th>\n <td>2014-05-02 00:00:00</td>\n <td>2.384000e+06</td>\n <td>5.0</td>\n <td>2.50</td>\n <td>3650</td>\n <td>9050</td>\n <td>2.0</td>\n <td>0</td>\n <td>4</td>\n <td>5</td>\n <td>3370</td>\n <td>280</td>\n <td>1921</td>\n <td>0</td>\n <td>709 W Blaine St</td>\n <td>Seattle</td>\n <td>WA 98119</td>\n <td>USA</td>\n </tr>\n <tr>\n <th>2</th>\n <td>2014-05-02 00:00:00</td>\n <td>3.420000e+05</td>\n <td>3.0</td>\n <td>2.00</td>\n <td>1930</td>\n <td>11947</td>\n <td>1.0</td>\n <td>0</td>\n <td>0</td>\n <td>4</td>\n <td>1930</td>\n <td>0</td>\n <td>1966</td>\n <td>0</td>\n <td>26206-26214 143rd Ave SE</td>\n <td>Kent</td>\n <td>WA 98042</td>\n <td>USA</td>\n </tr>\n <tr>\n <th>3</th>\n <td>2014-05-02 00:00:00</td>\n <td>4.200000e+05</td>\n <td>3.0</td>\n <td>2.25</td>\n <td>2000</td>\n <td>8030</td>\n <td>1.0</td>\n <td>0</td>\n <td>0</td>\n <td>4</td>\n <td>1000</td>\n <td>1000</td>\n <td>1963</td>\n <td>0</td>\n <td>857 170th Pl NE</td>\n <td>Bellevue</td>\n <td>WA 98008</td>\n <td>USA</td>\n </tr>\n <tr>\n <th>4</th>\n <td>2014-05-02 00:00:00</td>\n <td>5.500000e+05</td>\n <td>4.0</td>\n <td>2.50</td>\n <td>1940</td>\n <td>10500</td>\n <td>1.0</td>\n <td>0</td>\n <td>0</td>\n <td>4</td>\n <td>1140</td>\n <td>800</td>\n <td>1976</td>\n <td>1992</td>\n <td>9105 170th Ave NE</td>\n <td>Redmond</td>\n <td>WA 98052</td>\n <td>USA</td>\n </tr>\n <tr>\n <th>...</th>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n </tr>\n <tr>\n <th>4595</th>\n <td>2014-07-09 00:00:00</td>\n <td>3.081667e+05</td>\n <td>3.0</td>\n <td>1.75</td>\n <td>1510</td>\n <td>6360</td>\n <td>1.0</td>\n <td>0</td>\n <td>0</td>\n <td>4</td>\n <td>1510</td>\n <td>0</td>\n <td>1954</td>\n <td>1979</td>\n <td>501 N 143rd St</td>\n <td>Seattle</td>\n <td>WA 98133</td>\n <td>USA</td>\n </tr>\n <tr>\n <th>4596</th>\n <td>2014-07-09 00:00:00</td>\n <td>5.343333e+05</td>\n <td>3.0</td>\n <td>2.50</td>\n <td>1460</td>\n <td>7573</td>\n <td>2.0</td>\n <td>0</td>\n <td>0</td>\n <td>3</td>\n <td>1460</td>\n <td>0</td>\n <td>1983</td>\n <td>2009</td>\n <td>14855 SE 10th Pl</td>\n <td>Bellevue</td>\n <td>WA 98007</td>\n <td>USA</td>\n </tr>\n <tr>\n <th>4597</th>\n <td>2014-07-09 00:00:00</td>\n <td>4.169042e+05</td>\n <td>3.0</td>\n <td>2.50</td>\n <td>3010</td>\n <td>7014</td>\n <td>2.0</td>\n <td>0</td>\n <td>0</td>\n <td>3</td>\n <td>3010</td>\n <td>0</td>\n <td>2009</td>\n <td>0</td>\n <td>759 Ilwaco Pl NE</td>\n <td>Renton</td>\n <td>WA 98059</td>\n <td>USA</td>\n </tr>\n <tr>\n <th>4598</th>\n <td>2014-07-10 00:00:00</td>\n <td>2.034000e+05</td>\n <td>4.0</td>\n <td>2.00</td>\n <td>2090</td>\n <td>6630</td>\n <td>1.0</td>\n <td>0</td>\n <td>0</td>\n <td>3</td>\n <td>1070</td>\n <td>1020</td>\n <td>1974</td>\n <td>0</td>\n <td>5148 S Creston St</td>\n <td>Seattle</td>\n <td>WA 98178</td>\n <td>USA</td>\n </tr>\n <tr>\n <th>4599</th>\n <td>2014-07-10 00:00:00</td>\n <td>2.206000e+05</td>\n <td>3.0</td>\n <td>2.50</td>\n <td>1490</td>\n <td>8102</td>\n <td>2.0</td>\n <td>0</td>\n <td>0</td>\n <td>4</td>\n <td>1490</td>\n <td>0</td>\n <td>1990</td>\n <td>0</td>\n <td>18717 SE 258th St</td>\n <td>Covington</td>\n <td>WA 98042</td>\n <td>USA</td>\n </tr>\n </tbody>\n</table>\n<p>4600 rows × 18 columns</p>\n</div>"},"metadata":{}}]},{"cell_type":"code","source":"pd.set_option('display.float_format', lambda x: '%.3f' % x)\n","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:29.533953Z","iopub.execute_input":"2023-05-23T19:58:29.534349Z","iopub.status.idle":"2023-05-23T19:58:29.541548Z","shell.execute_reply.started":"2023-05-23T19:58:29.534317Z","shell.execute_reply":"2023-05-23T19:58:29.539661Z"},"trusted":true},"execution_count":8,"outputs":[]},{"cell_type":"code","source":"houseprice","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:29.543084Z","iopub.execute_input":"2023-05-23T19:58:29.543539Z","iopub.status.idle":"2023-05-23T19:58:29.576677Z","shell.execute_reply.started":"2023-05-23T19:58:29.543510Z","shell.execute_reply":"2023-05-23T19:58:29.575126Z"},"trusted":true},"execution_count":9,"outputs":[{"execution_count":9,"output_type":"execute_result","data":{"text/plain":" date price bedrooms bathrooms sqft_living \\\n0 2014-05-02 00:00:00 313000.000 3.000 1.500 1340 \n1 2014-05-02 00:00:00 2384000.000 5.000 2.500 3650 \n2 2014-05-02 00:00:00 342000.000 3.000 2.000 1930 \n3 2014-05-02 00:00:00 420000.000 3.000 2.250 2000 \n4 2014-05-02 00:00:00 550000.000 4.000 2.500 1940 \n... ... ... ... ... ... \n4595 2014-07-09 00:00:00 308166.667 3.000 1.750 1510 \n4596 2014-07-09 00:00:00 534333.333 3.000 2.500 1460 \n4597 2014-07-09 00:00:00 416904.167 3.000 2.500 3010 \n4598 2014-07-10 00:00:00 203400.000 4.000 2.000 2090 \n4599 2014-07-10 00:00:00 220600.000 3.000 2.500 1490 \n\n sqft_lot floors waterfront view condition sqft_above \\\n0 7912 1.500 0 0 3 1340 \n1 9050 2.000 0 4 5 3370 \n2 11947 1.000 0 0 4 1930 \n3 8030 1.000 0 0 4 1000 \n4 10500 1.000 0 0 4 1140 \n... ... ... ... ... ... ... \n4595 6360 1.000 0 0 4 1510 \n4596 7573 2.000 0 0 3 1460 \n4597 7014 2.000 0 0 3 3010 \n4598 6630 1.000 0 0 3 1070 \n4599 8102 2.000 0 0 4 1490 \n\n sqft_basement yr_built yr_renovated street \\\n0 0 1955 2005 18810 Densmore Ave N \n1 280 1921 0 709 W Blaine St \n2 0 1966 0 26206-26214 143rd Ave SE \n3 1000 1963 0 857 170th Pl NE \n4 800 1976 1992 9105 170th Ave NE \n... ... ... ... ... \n4595 0 1954 1979 501 N 143rd St \n4596 0 1983 2009 14855 SE 10th Pl \n4597 0 2009 0 759 Ilwaco Pl NE \n4598 1020 1974 0 5148 S Creston St \n4599 0 1990 0 18717 SE 258th St \n\n city statezip country \n0 Shoreline WA 98133 USA \n1 Seattle WA 98119 USA \n2 Kent WA 98042 USA \n3 Bellevue WA 98008 USA \n4 Redmond WA 98052 USA \n... ... ... ... \n4595 Seattle WA 98133 USA \n4596 Bellevue WA 98007 USA \n4597 Renton WA 98059 USA \n4598 Seattle WA 98178 USA \n4599 Covington WA 98042 USA \n\n[4600 rows x 18 columns]","text/html":"<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>date</th>\n <th>price</th>\n <th>bedrooms</th>\n <th>bathrooms</th>\n <th>sqft_living</th>\n <th>sqft_lot</th>\n <th>floors</th>\n <th>waterfront</th>\n <th>view</th>\n <th>condition</th>\n <th>sqft_above</th>\n <th>sqft_basement</th>\n <th>yr_built</th>\n <th>yr_renovated</th>\n <th>street</th>\n <th>city</th>\n <th>statezip</th>\n <th>country</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>2014-05-02 00:00:00</td>\n <td>313000.000</td>\n <td>3.000</td>\n <td>1.500</td>\n <td>1340</td>\n <td>7912</td>\n <td>1.500</td>\n <td>0</td>\n <td>0</td>\n <td>3</td>\n <td>1340</td>\n <td>0</td>\n <td>1955</td>\n <td>2005</td>\n <td>18810 Densmore Ave N</td>\n <td>Shoreline</td>\n <td>WA 98133</td>\n <td>USA</td>\n </tr>\n <tr>\n <th>1</th>\n <td>2014-05-02 00:00:00</td>\n <td>2384000.000</td>\n <td>5.000</td>\n <td>2.500</td>\n <td>3650</td>\n <td>9050</td>\n <td>2.000</td>\n <td>0</td>\n <td>4</td>\n <td>5</td>\n <td>3370</td>\n <td>280</td>\n <td>1921</td>\n <td>0</td>\n <td>709 W Blaine St</td>\n <td>Seattle</td>\n <td>WA 98119</td>\n <td>USA</td>\n </tr>\n <tr>\n <th>2</th>\n <td>2014-05-02 00:00:00</td>\n <td>342000.000</td>\n <td>3.000</td>\n <td>2.000</td>\n <td>1930</td>\n <td>11947</td>\n <td>1.000</td>\n <td>0</td>\n <td>0</td>\n <td>4</td>\n <td>1930</td>\n <td>0</td>\n <td>1966</td>\n <td>0</td>\n <td>26206-26214 143rd Ave SE</td>\n <td>Kent</td>\n <td>WA 98042</td>\n <td>USA</td>\n </tr>\n <tr>\n <th>3</th>\n <td>2014-05-02 00:00:00</td>\n <td>420000.000</td>\n <td>3.000</td>\n <td>2.250</td>\n <td>2000</td>\n <td>8030</td>\n <td>1.000</td>\n <td>0</td>\n <td>0</td>\n <td>4</td>\n <td>1000</td>\n <td>1000</td>\n <td>1963</td>\n <td>0</td>\n <td>857 170th Pl NE</td>\n <td>Bellevue</td>\n <td>WA 98008</td>\n <td>USA</td>\n </tr>\n <tr>\n <th>4</th>\n <td>2014-05-02 00:00:00</td>\n <td>550000.000</td>\n <td>4.000</td>\n <td>2.500</td>\n <td>1940</td>\n <td>10500</td>\n <td>1.000</td>\n <td>0</td>\n <td>0</td>\n <td>4</td>\n <td>1140</td>\n <td>800</td>\n <td>1976</td>\n <td>1992</td>\n <td>9105 170th Ave NE</td>\n <td>Redmond</td>\n <td>WA 98052</td>\n <td>USA</td>\n </tr>\n <tr>\n <th>...</th>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n </tr>\n <tr>\n <th>4595</th>\n <td>2014-07-09 00:00:00</td>\n <td>308166.667</td>\n <td>3.000</td>\n <td>1.750</td>\n <td>1510</td>\n <td>6360</td>\n <td>1.000</td>\n <td>0</td>\n <td>0</td>\n <td>4</td>\n <td>1510</td>\n <td>0</td>\n <td>1954</td>\n <td>1979</td>\n <td>501 N 143rd St</td>\n <td>Seattle</td>\n <td>WA 98133</td>\n <td>USA</td>\n </tr>\n <tr>\n <th>4596</th>\n <td>2014-07-09 00:00:00</td>\n <td>534333.333</td>\n <td>3.000</td>\n <td>2.500</td>\n <td>1460</td>\n <td>7573</td>\n <td>2.000</td>\n <td>0</td>\n <td>0</td>\n <td>3</td>\n <td>1460</td>\n <td>0</td>\n <td>1983</td>\n <td>2009</td>\n <td>14855 SE 10th Pl</td>\n <td>Bellevue</td>\n <td>WA 98007</td>\n <td>USA</td>\n </tr>\n <tr>\n <th>4597</th>\n <td>2014-07-09 00:00:00</td>\n <td>416904.167</td>\n <td>3.000</td>\n <td>2.500</td>\n <td>3010</td>\n <td>7014</td>\n <td>2.000</td>\n <td>0</td>\n <td>0</td>\n <td>3</td>\n <td>3010</td>\n <td>0</td>\n <td>2009</td>\n <td>0</td>\n <td>759 Ilwaco Pl NE</td>\n <td>Renton</td>\n <td>WA 98059</td>\n <td>USA</td>\n </tr>\n <tr>\n <th>4598</th>\n <td>2014-07-10 00:00:00</td>\n <td>203400.000</td>\n <td>4.000</td>\n <td>2.000</td>\n <td>2090</td>\n <td>6630</td>\n <td>1.000</td>\n <td>0</td>\n <td>0</td>\n <td>3</td>\n <td>1070</td>\n <td>1020</td>\n <td>1974</td>\n <td>0</td>\n <td>5148 S Creston St</td>\n <td>Seattle</td>\n <td>WA 98178</td>\n <td>USA</td>\n </tr>\n <tr>\n <th>4599</th>\n <td>2014-07-10 00:00:00</td>\n <td>220600.000</td>\n <td>3.000</td>\n <td>2.500</td>\n <td>1490</td>\n <td>8102</td>\n <td>2.000</td>\n <td>0</td>\n <td>0</td>\n <td>4</td>\n <td>1490</td>\n <td>0</td>\n <td>1990</td>\n <td>0</td>\n <td>18717 SE 258th St</td>\n <td>Covington</td>\n <td>WA 98042</td>\n <td>USA</td>\n </tr>\n </tbody>\n</table>\n<p>4600 rows × 18 columns</p>\n</div>"},"metadata":{}}]},{"cell_type":"code","source":"houseprice.describe()","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:29.578282Z","iopub.execute_input":"2023-05-23T19:58:29.578762Z","iopub.status.idle":"2023-05-23T19:58:29.643935Z","shell.execute_reply.started":"2023-05-23T19:58:29.578722Z","shell.execute_reply":"2023-05-23T19:58:29.642701Z"},"trusted":true},"execution_count":10,"outputs":[{"execution_count":10,"output_type":"execute_result","data":{"text/plain":" price bedrooms bathrooms sqft_living sqft_lot floors \\\ncount 4600.000 4600.000 4600.000 4600.000 4600.000 4600.000 \nmean 551962.988 3.401 2.161 2139.347 14852.516 1.512 \nstd 563834.703 0.909 0.784 963.207 35884.436 0.538 \nmin 0.000 0.000 0.000 370.000 638.000 1.000 \n25% 322875.000 3.000 1.750 1460.000 5000.750 1.000 \n50% 460943.462 3.000 2.250 1980.000 7683.000 1.500 \n75% 654962.500 4.000 2.500 2620.000 11001.250 2.000 \nmax 26590000.000 9.000 8.000 13540.000 1074218.000 3.500 \n\n waterfront view condition sqft_above sqft_basement yr_built \\\ncount 4600.000 4600.000 4600.000 4600.000 4600.000 4600.000 \nmean 0.007 0.241 3.452 1827.265 312.082 1970.786 \nstd 0.084 0.778 0.677 862.169 464.137 29.732 \nmin 0.000 0.000 1.000 370.000 0.000 1900.000 \n25% 0.000 0.000 3.000 1190.000 0.000 1951.000 \n50% 0.000 0.000 3.000 1590.000 0.000 1976.000 \n75% 0.000 0.000 4.000 2300.000 610.000 1997.000 \nmax 1.000 4.000 5.000 9410.000 4820.000 2014.000 \n\n yr_renovated \ncount 4600.000 \nmean 808.608 \nstd 979.415 \nmin 0.000 \n25% 0.000 \n50% 0.000 \n75% 1999.000 \nmax 2014.000 ","text/html":"<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>price</th>\n <th>bedrooms</th>\n <th>bathrooms</th>\n <th>sqft_living</th>\n <th>sqft_lot</th>\n <th>floors</th>\n <th>waterfront</th>\n <th>view</th>\n <th>condition</th>\n <th>sqft_above</th>\n <th>sqft_basement</th>\n <th>yr_built</th>\n <th>yr_renovated</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>count</th>\n <td>4600.000</td>\n <td>4600.000</td>\n <td>4600.000</td>\n <td>4600.000</td>\n <td>4600.000</td>\n <td>4600.000</td>\n <td>4600.000</td>\n <td>4600.000</td>\n <td>4600.000</td>\n <td>4600.000</td>\n <td>4600.000</td>\n <td>4600.000</td>\n <td>4600.000</td>\n </tr>\n <tr>\n <th>mean</th>\n <td>551962.988</td>\n <td>3.401</td>\n <td>2.161</td>\n <td>2139.347</td>\n <td>14852.516</td>\n <td>1.512</td>\n <td>0.007</td>\n <td>0.241</td>\n <td>3.452</td>\n <td>1827.265</td>\n <td>312.082</td>\n <td>1970.786</td>\n <td>808.608</td>\n </tr>\n <tr>\n <th>std</th>\n <td>563834.703</td>\n <td>0.909</td>\n <td>0.784</td>\n <td>963.207</td>\n <td>35884.436</td>\n <td>0.538</td>\n <td>0.084</td>\n <td>0.778</td>\n <td>0.677</td>\n <td>862.169</td>\n <td>464.137</td>\n <td>29.732</td>\n <td>979.415</td>\n </tr>\n <tr>\n <th>min</th>\n <td>0.000</td>\n <td>0.000</td>\n <td>0.000</td>\n <td>370.000</td>\n <td>638.000</td>\n <td>1.000</td>\n <td>0.000</td>\n <td>0.000</td>\n <td>1.000</td>\n <td>370.000</td>\n <td>0.000</td>\n <td>1900.000</td>\n <td>0.000</td>\n </tr>\n <tr>\n <th>25%</th>\n <td>322875.000</td>\n <td>3.000</td>\n <td>1.750</td>\n <td>1460.000</td>\n <td>5000.750</td>\n <td>1.000</td>\n <td>0.000</td>\n <td>0.000</td>\n <td>3.000</td>\n <td>1190.000</td>\n <td>0.000</td>\n <td>1951.000</td>\n <td>0.000</td>\n </tr>\n <tr>\n <th>50%</th>\n <td>460943.462</td>\n <td>3.000</td>\n <td>2.250</td>\n <td>1980.000</td>\n <td>7683.000</td>\n <td>1.500</td>\n <td>0.000</td>\n <td>0.000</td>\n <td>3.000</td>\n <td>1590.000</td>\n <td>0.000</td>\n <td>1976.000</td>\n <td>0.000</td>\n </tr>\n <tr>\n <th>75%</th>\n <td>654962.500</td>\n <td>4.000</td>\n <td>2.500</td>\n <td>2620.000</td>\n <td>11001.250</td>\n <td>2.000</td>\n <td>0.000</td>\n <td>0.000</td>\n <td>4.000</td>\n <td>2300.000</td>\n <td>610.000</td>\n <td>1997.000</td>\n <td>1999.000</td>\n </tr>\n <tr>\n <th>max</th>\n <td>26590000.000</td>\n <td>9.000</td>\n <td>8.000</td>\n <td>13540.000</td>\n <td>1074218.000</td>\n <td>3.500</td>\n <td>1.000</td>\n <td>4.000</td>\n <td>5.000</td>\n <td>9410.000</td>\n <td>4820.000</td>\n <td>2014.000</td>\n <td>2014.000</td>\n </tr>\n </tbody>\n</table>\n</div>"},"metadata":{}}]},{"cell_type":"code","source":"houseprice.info()# feature X's bedrooms, sqft_living,sqft_lot,floors,view,yr_bulit, #output=price\n","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:29.645885Z","iopub.execute_input":"2023-05-23T19:58:29.646269Z","iopub.status.idle":"2023-05-23T19:58:29.684303Z","shell.execute_reply.started":"2023-05-23T19:58:29.646240Z","shell.execute_reply":"2023-05-23T19:58:29.682974Z"},"trusted":true},"execution_count":11,"outputs":[{"name":"stdout","text":"<class 'pandas.core.frame.DataFrame'>\nRangeIndex: 4600 entries, 0 to 4599\nData columns (total 18 columns):\n # Column Non-Null Count Dtype \n--- ------ -------------- ----- \n 0 date 4600 non-null object \n 1 price 4600 non-null float64\n 2 bedrooms 4600 non-null float64\n 3 bathrooms 4600 non-null float64\n 4 sqft_living 4600 non-null int64 \n 5 sqft_lot 4600 non-null int64 \n 6 floors 4600 non-null float64\n 7 waterfront 4600 non-null int64 \n 8 view 4600 non-null int64 \n 9 condition 4600 non-null int64 \n 10 sqft_above 4600 non-null int64 \n 11 sqft_basement 4600 non-null int64 \n 12 yr_built 4600 non-null int64 \n 13 yr_renovated 4600 non-null int64 \n 14 street 4600 non-null object \n 15 city 4600 non-null object \n 16 statezip 4600 non-null object \n 17 country 4600 non-null object \ndtypes: float64(4), int64(9), object(5)\nmemory usage: 647.0+ KB\n","output_type":"stream"}]},{"cell_type":"code","source":"houseprice.drop(['date','city','street','statezip','condition'], axis=1)","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:29.690603Z","iopub.execute_input":"2023-05-23T19:58:29.691907Z","iopub.status.idle":"2023-05-23T19:58:29.716413Z","shell.execute_reply.started":"2023-05-23T19:58:29.691848Z","shell.execute_reply":"2023-05-23T19:58:29.714825Z"},"trusted":true},"execution_count":12,"outputs":[{"execution_count":12,"output_type":"execute_result","data":{"text/plain":" price bedrooms bathrooms sqft_living sqft_lot floors \\\n0 313000.000 3.000 1.500 1340 7912 1.500 \n1 2384000.000 5.000 2.500 3650 9050 2.000 \n2 342000.000 3.000 2.000 1930 11947 1.000 \n3 420000.000 3.000 2.250 2000 8030 1.000 \n4 550000.000 4.000 2.500 1940 10500 1.000 \n... ... ... ... ... ... ... \n4595 308166.667 3.000 1.750 1510 6360 1.000 \n4596 534333.333 3.000 2.500 1460 7573 2.000 \n4597 416904.167 3.000 2.500 3010 7014 2.000 \n4598 203400.000 4.000 2.000 2090 6630 1.000 \n4599 220600.000 3.000 2.500 1490 8102 2.000 \n\n waterfront view sqft_above sqft_basement yr_built yr_renovated \\\n0 0 0 1340 0 1955 2005 \n1 0 4 3370 280 1921 0 \n2 0 0 1930 0 1966 0 \n3 0 0 1000 1000 1963 0 \n4 0 0 1140 800 1976 1992 \n... ... ... ... ... ... ... \n4595 0 0 1510 0 1954 1979 \n4596 0 0 1460 0 1983 2009 \n4597 0 0 3010 0 2009 0 \n4598 0 0 1070 1020 1974 0 \n4599 0 0 1490 0 1990 0 \n\n country \n0 USA \n1 USA \n2 USA \n3 USA \n4 USA \n... ... \n4595 USA \n4596 USA \n4597 USA \n4598 USA \n4599 USA \n\n[4600 rows x 13 columns]","text/html":"<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>price</th>\n <th>bedrooms</th>\n <th>bathrooms</th>\n <th>sqft_living</th>\n <th>sqft_lot</th>\n <th>floors</th>\n <th>waterfront</th>\n <th>view</th>\n <th>sqft_above</th>\n <th>sqft_basement</th>\n <th>yr_built</th>\n <th>yr_renovated</th>\n <th>country</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>313000.000</td>\n <td>3.000</td>\n <td>1.500</td>\n <td>1340</td>\n <td>7912</td>\n <td>1.500</td>\n <td>0</td>\n <td>0</td>\n <td>1340</td>\n <td>0</td>\n <td>1955</td>\n <td>2005</td>\n <td>USA</td>\n </tr>\n <tr>\n <th>1</th>\n <td>2384000.000</td>\n <td>5.000</td>\n <td>2.500</td>\n <td>3650</td>\n <td>9050</td>\n <td>2.000</td>\n <td>0</td>\n <td>4</td>\n <td>3370</td>\n <td>280</td>\n <td>1921</td>\n <td>0</td>\n <td>USA</td>\n </tr>\n <tr>\n <th>2</th>\n <td>342000.000</td>\n <td>3.000</td>\n <td>2.000</td>\n <td>1930</td>\n <td>11947</td>\n <td>1.000</td>\n <td>0</td>\n <td>0</td>\n <td>1930</td>\n <td>0</td>\n <td>1966</td>\n <td>0</td>\n <td>USA</td>\n </tr>\n <tr>\n <th>3</th>\n <td>420000.000</td>\n <td>3.000</td>\n <td>2.250</td>\n <td>2000</td>\n <td>8030</td>\n <td>1.000</td>\n <td>0</td>\n <td>0</td>\n <td>1000</td>\n <td>1000</td>\n <td>1963</td>\n <td>0</td>\n <td>USA</td>\n </tr>\n <tr>\n <th>4</th>\n <td>550000.000</td>\n <td>4.000</td>\n <td>2.500</td>\n <td>1940</td>\n <td>10500</td>\n <td>1.000</td>\n <td>0</td>\n <td>0</td>\n <td>1140</td>\n <td>800</td>\n <td>1976</td>\n <td>1992</td>\n <td>USA</td>\n </tr>\n <tr>\n <th>...</th>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n </tr>\n <tr>\n <th>4595</th>\n <td>308166.667</td>\n <td>3.000</td>\n <td>1.750</td>\n <td>1510</td>\n <td>6360</td>\n <td>1.000</td>\n <td>0</td>\n <td>0</td>\n <td>1510</td>\n <td>0</td>\n <td>1954</td>\n <td>1979</td>\n <td>USA</td>\n </tr>\n <tr>\n <th>4596</th>\n <td>534333.333</td>\n <td>3.000</td>\n <td>2.500</td>\n <td>1460</td>\n <td>7573</td>\n <td>2.000</td>\n <td>0</td>\n <td>0</td>\n <td>1460</td>\n <td>0</td>\n <td>1983</td>\n <td>2009</td>\n <td>USA</td>\n </tr>\n <tr>\n <th>4597</th>\n <td>416904.167</td>\n <td>3.000</td>\n <td>2.500</td>\n <td>3010</td>\n <td>7014</td>\n <td>2.000</td>\n <td>0</td>\n <td>0</td>\n <td>3010</td>\n <td>0</td>\n <td>2009</td>\n <td>0</td>\n <td>USA</td>\n </tr>\n <tr>\n <th>4598</th>\n <td>203400.000</td>\n <td>4.000</td>\n <td>2.000</td>\n <td>2090</td>\n <td>6630</td>\n <td>1.000</td>\n <td>0</td>\n <td>0</td>\n <td>1070</td>\n <td>1020</td>\n <td>1974</td>\n <td>0</td>\n <td>USA</td>\n </tr>\n <tr>\n <th>4599</th>\n <td>220600.000</td>\n <td>3.000</td>\n <td>2.500</td>\n <td>1490</td>\n <td>8102</td>\n <td>2.000</td>\n <td>0</td>\n <td>0</td>\n <td>1490</td>\n <td>0</td>\n <td>1990</td>\n <td>0</td>\n <td>USA</td>\n </tr>\n </tbody>\n</table>\n<p>4600 rows × 13 columns</p>\n</div>"},"metadata":{}}]},{"cell_type":"code","source":"X=houseprice.drop(['price','date','city','street','statezip','condition'],axis=1)\nY=houseprice['price']","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:29.718292Z","iopub.execute_input":"2023-05-23T19:58:29.718801Z","iopub.status.idle":"2023-05-23T19:58:29.734752Z","shell.execute_reply.started":"2023-05-23T19:58:29.718754Z","shell.execute_reply":"2023-05-23T19:58:29.733636Z"},"trusted":true},"execution_count":13,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:29.736430Z","iopub.execute_input":"2023-05-23T19:58:29.737367Z","iopub.status.idle":"2023-05-23T19:58:29.768553Z","shell.execute_reply.started":"2023-05-23T19:58:29.737327Z","shell.execute_reply":"2023-05-23T19:58:29.767142Z"},"trusted":true},"execution_count":14,"outputs":[{"execution_count":14,"output_type":"execute_result","data":{"text/plain":" bedrooms bathrooms sqft_living sqft_lot floors waterfront view \\\n0 3.000 1.500 1340 7912 1.500 0 0 \n1 5.000 2.500 3650 9050 2.000 0 4 \n2 3.000 2.000 1930 11947 1.000 0 0 \n3 3.000 2.250 2000 8030 1.000 0 0 \n4 4.000 2.500 1940 10500 1.000 0 0 \n... ... ... ... ... ... ... ... \n4595 3.000 1.750 1510 6360 1.000 0 0 \n4596 3.000 2.500 1460 7573 2.000 0 0 \n4597 3.000 2.500 3010 7014 2.000 0 0 \n4598 4.000 2.000 2090 6630 1.000 0 0 \n4599 3.000 2.500 1490 8102 2.000 0 0 \n\n sqft_above sqft_basement yr_built yr_renovated country \n0 1340 0 1955 2005 USA \n1 3370 280 1921 0 USA \n2 1930 0 1966 0 USA \n3 1000 1000 1963 0 USA \n4 1140 800 1976 1992 USA \n... ... ... ... ... ... \n4595 1510 0 1954 1979 USA \n4596 1460 0 1983 2009 USA \n4597 3010 0 2009 0 USA \n4598 1070 1020 1974 0 USA \n4599 1490 0 1990 0 USA \n\n[4600 rows x 12 columns]","text/html":"<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>bedrooms</th>\n <th>bathrooms</th>\n <th>sqft_living</th>\n <th>sqft_lot</th>\n <th>floors</th>\n <th>waterfront</th>\n <th>view</th>\n <th>sqft_above</th>\n <th>sqft_basement</th>\n <th>yr_built</th>\n <th>yr_renovated</th>\n <th>country</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>3.000</td>\n <td>1.500</td>\n <td>1340</td>\n <td>7912</td>\n <td>1.500</td>\n <td>0</td>\n <td>0</td>\n <td>1340</td>\n <td>0</td>\n <td>1955</td>\n <td>2005</td>\n <td>USA</td>\n </tr>\n <tr>\n <th>1</th>\n <td>5.000</td>\n <td>2.500</td>\n <td>3650</td>\n <td>9050</td>\n <td>2.000</td>\n <td>0</td>\n <td>4</td>\n <td>3370</td>\n <td>280</td>\n <td>1921</td>\n <td>0</td>\n <td>USA</td>\n </tr>\n <tr>\n <th>2</th>\n <td>3.000</td>\n <td>2.000</td>\n <td>1930</td>\n <td>11947</td>\n <td>1.000</td>\n <td>0</td>\n <td>0</td>\n <td>1930</td>\n <td>0</td>\n <td>1966</td>\n <td>0</td>\n <td>USA</td>\n </tr>\n <tr>\n <th>3</th>\n <td>3.000</td>\n <td>2.250</td>\n <td>2000</td>\n <td>8030</td>\n <td>1.000</td>\n <td>0</td>\n <td>0</td>\n <td>1000</td>\n <td>1000</td>\n <td>1963</td>\n <td>0</td>\n <td>USA</td>\n </tr>\n <tr>\n <th>4</th>\n <td>4.000</td>\n <td>2.500</td>\n <td>1940</td>\n <td>10500</td>\n <td>1.000</td>\n <td>0</td>\n <td>0</td>\n <td>1140</td>\n <td>800</td>\n <td>1976</td>\n <td>1992</td>\n <td>USA</td>\n </tr>\n <tr>\n <th>...</th>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n </tr>\n <tr>\n <th>4595</th>\n <td>3.000</td>\n <td>1.750</td>\n <td>1510</td>\n <td>6360</td>\n <td>1.000</td>\n <td>0</td>\n <td>0</td>\n <td>1510</td>\n <td>0</td>\n <td>1954</td>\n <td>1979</td>\n <td>USA</td>\n </tr>\n <tr>\n <th>4596</th>\n <td>3.000</td>\n <td>2.500</td>\n <td>1460</td>\n <td>7573</td>\n <td>2.000</td>\n <td>0</td>\n <td>0</td>\n <td>1460</td>\n <td>0</td>\n <td>1983</td>\n <td>2009</td>\n <td>USA</td>\n </tr>\n <tr>\n <th>4597</th>\n <td>3.000</td>\n <td>2.500</td>\n <td>3010</td>\n <td>7014</td>\n <td>2.000</td>\n <td>0</td>\n <td>0</td>\n <td>3010</td>\n <td>0</td>\n <td>2009</td>\n <td>0</td>\n <td>USA</td>\n </tr>\n <tr>\n <th>4598</th>\n <td>4.000</td>\n <td>2.000</td>\n <td>2090</td>\n <td>6630</td>\n <td>1.000</td>\n <td>0</td>\n <td>0</td>\n <td>1070</td>\n <td>1020</td>\n <td>1974</td>\n <td>0</td>\n <td>USA</td>\n </tr>\n <tr>\n <th>4599</th>\n <td>3.000</td>\n <td>2.500</td>\n <td>1490</td>\n <td>8102</td>\n <td>2.000</td>\n <td>0</td>\n <td>0</td>\n <td>1490</td>\n <td>0</td>\n <td>1990</td>\n <td>0</td>\n <td>USA</td>\n </tr>\n </tbody>\n</table>\n<p>4600 rows × 12 columns</p>\n</div>"},"metadata":{}}]},{"cell_type":"code","source":"Y","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:29.770068Z","iopub.execute_input":"2023-05-23T19:58:29.770420Z","iopub.status.idle":"2023-05-23T19:58:29.787392Z","shell.execute_reply.started":"2023-05-23T19:58:29.770392Z","shell.execute_reply":"2023-05-23T19:58:29.786439Z"},"trusted":true},"execution_count":15,"outputs":[{"execution_count":15,"output_type":"execute_result","data":{"text/plain":"0 313000.000\n1 2384000.000\n2 342000.000\n3 420000.000\n4 550000.000\n ... \n4595 308166.667\n4596 534333.333\n4597 416904.167\n4598 203400.000\n4599 220600.000\nName: price, Length: 4600, dtype: float64"},"metadata":{}}]},{"cell_type":"code","source":"X.shape\n","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:29.788761Z","iopub.execute_input":"2023-05-23T19:58:29.789531Z","iopub.status.idle":"2023-05-23T19:58:29.807075Z","shell.execute_reply.started":"2023-05-23T19:58:29.789493Z","shell.execute_reply":"2023-05-23T19:58:29.805718Z"},"trusted":true},"execution_count":16,"outputs":[{"execution_count":16,"output_type":"execute_result","data":{"text/plain":"(4600, 12)"},"metadata":{}}]},{"cell_type":"code","source":"from sklearn.model_selection import train_test_split\nX_train,X_test,Y_train,Y_test=train_test_split(X.values,Y.values,test_size=0.2)","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:29.808843Z","iopub.execute_input":"2023-05-23T19:58:29.809363Z","iopub.status.idle":"2023-05-23T19:58:29.827151Z","shell.execute_reply.started":"2023-05-23T19:58:29.809318Z","shell.execute_reply":"2023-05-23T19:58:29.825801Z"},"trusted":true},"execution_count":17,"outputs":[]},{"cell_type":"code","source":"X_train","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:29.828473Z","iopub.execute_input":"2023-05-23T19:58:29.828944Z","iopub.status.idle":"2023-05-23T19:58:29.843063Z","shell.execute_reply.started":"2023-05-23T19:58:29.828892Z","shell.execute_reply":"2023-05-23T19:58:29.842108Z"},"trusted":true},"execution_count":18,"outputs":[{"execution_count":18,"output_type":"execute_result","data":{"text/plain":"array([[4.0, 1.5, 1220, ..., 1965, 1993, 'USA'],\n [2.0, 2.5, 1050, ..., 2007, 0, 'USA'],\n [2.0, 1.75, 1590, ..., 1927, 2011, 'USA'],\n ...,\n [5.0, 3.25, 3410, ..., 1912, 1994, 'USA'],\n [4.0, 2.5, 1810, ..., 1994, 0, 'USA'],\n [3.0, 2.5, 2340, ..., 1995, 0, 'USA']], dtype=object)"},"metadata":{}}]},{"cell_type":"code","source":"Y_train","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:29.844425Z","iopub.execute_input":"2023-05-23T19:58:29.844842Z","iopub.status.idle":"2023-05-23T19:58:29.863388Z","shell.execute_reply.started":"2023-05-23T19:58:29.844796Z","shell.execute_reply":"2023-05-23T19:58:29.861685Z"},"trusted":true},"execution_count":19,"outputs":[{"execution_count":19,"output_type":"execute_result","data":{"text/plain":"array([ 418000., 332888., 850000., ..., 2400000., 270000., 426090.])"},"metadata":{}}]},{"cell_type":"code","source":"X_test","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:29.864971Z","iopub.execute_input":"2023-05-23T19:58:29.865367Z","iopub.status.idle":"2023-05-23T19:58:29.882598Z","shell.execute_reply.started":"2023-05-23T19:58:29.865321Z","shell.execute_reply":"2023-05-23T19:58:29.881333Z"},"trusted":true},"execution_count":20,"outputs":[{"execution_count":20,"output_type":"execute_result","data":{"text/plain":"array([[4.0, 2.5, 1970, ..., 1987, 2000, 'USA'],\n [3.0, 2.5, 2490, ..., 2003, 0, 'USA'],\n [3.0, 2.75, 3890, ..., 1967, 2010, 'USA'],\n ...,\n [4.0, 1.5, 1920, ..., 1959, 1989, 'USA'],\n [3.0, 2.75, 3010, ..., 2011, 0, 'USA'],\n [4.0, 2.5, 3300, ..., 1984, 0, 'USA']], dtype=object)"},"metadata":{}}]},{"cell_type":"code","source":"Y_test","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:29.884278Z","iopub.execute_input":"2023-05-23T19:58:29.884627Z","iopub.status.idle":"2023-05-23T19:58:29.911868Z","shell.execute_reply.started":"2023-05-23T19:58:29.884598Z","shell.execute_reply":"2023-05-23T19:58:29.910534Z"},"trusted":true},"execution_count":21,"outputs":[{"execution_count":21,"output_type":"execute_result","data":{"text/plain":"array([ 274900. , 705380. , 1080000. , 950000. ,\n 592500. , 880000. , 285000. , 739888. ,\n 223000. , 540000. , 366000. , 979000. ,\n 540000. , 739000. , 790000. , 1346400. ,\n 440000. , 310000. , 475000. , 360000. ,\n 1170000. , 415000. , 681500. , 219950. ,\n 670000. , 286000. , 475000. , 470000. ,\n 560000. , 246500. , 315275. , 760000. ,\n 300000. , 215000. , 355300. , 212500. ,\n 552000. , 279000. , 800000. , 375000. ,\n 650000. , 485000. , 1149000. , 471000. ,\n 242000. , 405000. , 475000. , 0. ,\n 477000. , 292600. , 418000. , 248000. ,\n 649000. , 625000. , 320000. , 537500. ,\n 335000. , 285500. , 812000. , 558000. ,\n 376000. , 546000. , 370000. , 435000. ,\n 1356925. , 503000. , 305000. , 762500. ,\n 410000. , 660000. , 795000. , 450000. ,\n 330000. , 430000. , 225000. , 0. ,\n 300000. , 242000. , 215000. , 660000. ,\n 430000. , 400000. , 670500. , 362000. ,\n 415000. , 435000. , 275000. , 355000. ,\n 439000. , 690000. , 294000. , 838000. ,\n 374000. , 1130000. , 309950. , 335500. ,\n 527000. , 810000. , 732000. , 750000. ,\n 440000. , 975000. , 544500. , 319950. ,\n 381000. , 363990. , 2400000. , 1710000. ,\n 1150000. , 700000. , 258000. , 476000. ,\n 285000. , 310000. , 450000. , 268000. ,\n 600000. , 315000. , 140000. , 580000. ,\n 235000. , 544000. , 248000. , 785000. ,\n 667500. , 429900. , 165000. , 635000. ,\n 248000. , 199000. , 465425. , 150000. ,\n 360000. , 655000. , 530000. , 315000. ,\n 375000. , 553000. , 309950. , 396675. ,\n 395000. , 447000. , 502000. , 430277.777778,\n 584000. , 480000. , 527700. , 785000. ,\n 425000. , 950000. , 319950. , 550000. ,\n 735000. , 418500. , 679000. , 1050000. ,\n 3710000. , 239950. , 280000. , 2555000. ,\n 300000. , 407000. , 249950. , 355000. ,\n 499950. , 225000. , 475000. , 0. ,\n 765000. , 256500. , 571000. , 311100. ,\n 865000. , 249000. , 782000. , 950000. ,\n 464500. , 1215000. , 306000. , 1965221. ,\n 439950. , 713250. , 915000. , 325000. ,\n 888550. , 285000. , 1970000. , 352450. ,\n 385500. , 300000. , 230000. , 2400000. ,\n 431500. , 510000. , 234000. , 1250000. ,\n 2888000. , 695000. , 258000. , 465500. ,\n 347000. , 460000. , 464000. , 407500. ,\n 413000. , 299000. , 270000. , 660000. ,\n 553650. , 880000. , 287919.782609, 481015. ,\n 525000. , 740000. , 252000. , 540000. ,\n 280000. , 400000. , 307550. , 345000. ,\n 403950. , 255000. , 399950. , 886000. ,\n 439333.333333, 500000. , 278900. , 949880. ,\n 352000. , 538000. , 611000. , 390000. ,\n 352000. , 268971.875 , 400000. , 342500. ,\n 460000. , 430000. , 507000. , 364000. ,\n 754950. , 718500. , 309620. , 568000. ,\n 417000. , 1712500. , 337000. , 478000. ,\n 450000. , 275000. , 250000. , 345000. ,\n 0. , 458000. , 225000. , 660000. ,\n 624800. , 1795000. , 820000. , 485000. ,\n 385000. , 599000. , 558000. , 244615. ,\n 1000000. , 475000. , 670000. , 619500. ,\n 525000. , 280000. , 246000. , 445000. ,\n 392000. , 330000. , 640000. , 408900. ,\n 596165.428571, 835000. , 486000. , 380000. ,\n 127160. , 582800. , 1600000. , 902000. ,\n 250500. , 200000. , 362750. , 268500. ,\n 84350. , 455000. , 500000. , 805000. ,\n 253500. , 940000. , 335000. , 700000. ,\n 520500. , 450000. , 160000. , 368000. ,\n 850000. , 308000. , 540000. , 599000. ,\n 325000. , 625000. , 457500. , 330000. ,\n 269950. , 275000. , 1250000. , 725000. ,\n 252000. , 570000. , 825000. , 385000. ,\n 150000. , 615000. , 1320000. , 329995. ,\n 339950. , 379000. , 1350000. , 794154. ,\n 739000. , 764000. , 403000. , 299995. ,\n 430000. , 890000. , 300000. , 279000. ,\n 810000. , 875000. , 185000. , 2100000. ,\n 420000. , 599950. , 445838. , 585000. ,\n 525000. , 1100000. , 599000. , 602500. ,\n 660000. , 224000. , 200000. , 332000. ,\n 920000. , 531500. , 350000. , 585000. ,\n 1920000. , 800000. , 675000. , 310000. ,\n 451555. , 2367000. , 170000. , 370000. ,\n 355000. , 590000. , 465000. , 260000. ,\n 435000. , 376000. , 648000. , 1070000. ,\n 437000. , 885000. , 425000. , 244000. ,\n 360000. , 620000. , 210000. , 399950. ,\n 435000. , 550000. , 148000. , 380000. ,\n 469000. , 295000. , 760000. , 749950. ,\n 739900. , 590000. , 339000. , 940000. ,\n 390000. , 765000. , 212000. , 654000. ,\n 259500. , 965000. , 530000. , 479000. ,\n 450000. , 455000. , 380000. , 668500. ,\n 175000. , 599000. , 479000. , 315000. ,\n 926300. , 650000. , 382500. , 295000. ,\n 734990. , 1240000. , 540000. , 566000. ,\n 456000. , 442000. , 515000. , 1680000. ,\n 365000. , 250000. , 565000. , 540000. ,\n 402000. , 175000. , 465000. , 224000. ,\n 285000. , 365000. , 543000. , 384000. ,\n 800000. , 994000. , 440000. , 1400000. ,\n 243000. , 585000. , 523950. , 540500. ,\n 615000. , 230000. , 446000. , 254000. ,\n 885000. , 210000. , 945000. , 218000. ,\n 330000. , 502000. , 390000. , 683500. ,\n 243000. , 299950. , 212500. , 2560498.33333 ,\n 575000. , 567500. , 254000. , 550000. ,\n 339990. , 534640. , 630000. , 405125. ,\n 252750. , 210000. , 427500. , 648475. ,\n 322500. , 2384000. , 358000. , 489000. ,\n 600000. , 160000. , 450000. , 298450. ,\n 215000. , 206000. , 385000. , 512031. ,\n 160000. , 343566. , 365000. , 575000. ,\n 282508.888889, 432000. , 395000. , 237481.25 ,\n 735000. , 225500. , 300000. , 217500. ,\n 280000. , 1060000. , 585000. , 240500. ,\n 900000. , 1200000. , 425000. , 1127000. ,\n 465750. , 589000. , 605000. , 350000. ,\n 480000. , 445000. , 1415000. , 375900. ,\n 735000. , 220083.333333, 197500. , 200000. ,\n 308830.769231, 145000. , 425000. , 647500. ,\n 286800. , 310000. , 311000. , 262000. ,\n 620000. , 355500. , 632500. , 445000. ,\n 344950. , 565000. , 239900. , 455600. ,\n 240000. , 299000. , 941500. , 460000. ,\n 620000. , 368000. , 600000. , 1295648. ,\n 0. , 740000. , 950000. , 455000. ,\n 535000. , 715000. , 495000. , 1230000. ,\n 620000. , 402000. , 635000. , 565000. ,\n 186950. , 374000. , 171224.8 , 1400000. ,\n 360000. , 494000. , 305000. , 740000. ,\n 435000. , 291000. , 620000. , 335000. ,\n 170000. , 475000. , 270000. , 875000. ,\n 345100. , 540000. , 410000. , 925000. ,\n 411000. , 402000. , 1465000. , 313000. ,\n 250000. , 1280000. , 206000. , 325000. ,\n 645000. , 551000. , 470000. , 540000. ,\n 496000. , 530000. , 435000. , 1120000. ,\n 288400. , 1225000. , 1225000. , 1550000. ,\n 711600. , 199500. , 220000. , 1325000. ,\n 290256. , 550000. , 675000. , 255000. ,\n 280000. , 499990. , 505000. , 350000. ,\n 536000. , 301500. , 0. , 429000. ,\n 495000. , 420000. , 270000. , 503000. ,\n 435000. , 282766.666667, 574950. , 506000. ,\n 525000. , 835000. , 455000. , 270000. ,\n 568000. , 568000. , 755000. , 234975. ,\n 314950. , 330000. , 588000. , 600000. ,\n 565000. , 672500. , 651000. , 437500. ,\n 235867. , 250000. , 197500. , 445800. ,\n 583000. , 777000. , 749000. , 280000. ,\n 429000. , 650000. , 607500. , 1033888. ,\n 725000. , 530000. , 335000. , 970500. ,\n 756000. , 465000. , 830000. , 351250. ,\n 0. , 800000. , 474800. , 437500. ,\n 1240000. , 382000. , 377691. , 622500. ,\n 183000. , 460000. , 382500. , 895000. ,\n 150000. , 0. , 555000. , 700000. ,\n 180000. , 650000. , 372977. , 950100. ,\n 289659. , 736000. , 744500. , 578000. ,\n 492650. , 330000. , 1580000. , 925000. ,\n 290000. , 515000. , 409316. , 280000. ,\n 479000. , 309000. , 290000. , 269000. ,\n 1309500. , 700000. , 395000. , 445700. ,\n 535000. , 749950. , 685000. , 790000. ,\n 661254. , 342246.428571, 475000. , 110000. ,\n 577000. , 1636000. , 270000. , 0. ,\n 720000. , 192500. , 560000. , 554000. ,\n 461000. , 580000. , 175000. , 320000. ,\n 219950. , 402500. , 375000. , 328000. ,\n 1250000. , 243000. , 452000. , 264000. ,\n 255000. , 400000. , 328950. , 854000. ,\n 460000. , 1165000. , 154950. , 0. ,\n 250600. , 410000. , 839900. , 291500. ,\n 1195000. , 2700000. , 625000. , 291000. ,\n 310000. , 165050. , 850000. , 762300. ,\n 549000. , 720000. , 220000. , 382500. ,\n 537500. , 397500. , 575000. , 295000. ,\n 627000. , 767450. , 890000. , 607000. ,\n 341000. , 186000. , 438750. , 404000. ,\n 852880. , 435000. , 626000. , 1370000. ,\n 282000. , 424500. , 462000. , 234000. ,\n 560000. , 2400000. , 254000. , 385000. ,\n 425000. , 400000. , 357500. , 300000. ,\n 800000. , 355000. , 350000. , 277000. ,\n 608000. , 215000. , 960000. , 725000. ,\n 685000. , 2110000. , 947500. , 895000. ,\n 840000. , 371000. , 324000. , 963000. ,\n 788000. , 470000. , 660000. , 563000. ,\n 480000. , 530000. , 690000. , 449990. ,\n 7800. , 840000. , 620000. , 963000. ,\n 175000. , 436000. , 757000. , 548000. ,\n 950000. , 355000. , 499000. , 485000. ,\n 408000. , 490000. , 230000. , 250000. ,\n 386591. , 370000. , 230000. , 150000. ,\n 1288333.33333 , 680000. , 585000. , 315000. ,\n 2280000. , 330000. , 850000. , 432000. ,\n 330000. , 630000. , 565000. , 723243.75 ,\n 265000. , 835000. , 350000. , 710000. ,\n 483945. , 1300000. , 599999. , 747500. ,\n 420000. , 236000. , 410000. , 235000. ,\n 288790. , 405000. , 377500. , 398000. ,\n 589500. , 220000. , 305000. , 396166.666667,\n 1038000. , 690000. , 763101. , 285000. ,\n 806000. , 362300. , 355000. , 569950. ,\n 507500. , 317061.875 , 245000. , 619850. ,\n 497333.333333, 397990. , 800866. , 525000. ,\n 310000. , 170000. , 300000. , 620000. ,\n 425000. , 234000. , 83300. , 305000. ,\n 305000. , 464900. , 902000. , 375000. ,\n 329950. , 3000000. , 245100. , 773000. ,\n 373500. , 560000. , 235000. , 229629.5 ,\n 324000. , 560000. , 345000. , 253000. ,\n 1070000. , 260000. , 355000. , 1225000. ,\n 660000. , 387884.615385, 575000. , 417250. ,\n 215000. , 492000. , 349000. , 1110000. ,\n 205000. , 650000. , 659950. , 429900. ,\n 550000. , 790000. , 290000. , 522000. ,\n 529000. , 219900. , 470000. , 257500. ,\n 315000. , 215000. , 1730000. , 499000. ,\n 448000. , 870000. , 419000. , 157500. ,\n 648000. , 405000. , 524950. , 390000. ,\n 580379. , 210000. , 237333.333333, 760000. ])"},"metadata":{}}]},{"cell_type":"code","source":"print(type(X_train),type(Y_train),type(X_test),type(Y_test))\n","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:29.912926Z","iopub.execute_input":"2023-05-23T19:58:29.913294Z","iopub.status.idle":"2023-05-23T19:58:29.919888Z","shell.execute_reply.started":"2023-05-23T19:58:29.913261Z","shell.execute_reply":"2023-05-23T19:58:29.918641Z"},"trusted":true},"execution_count":22,"outputs":[{"name":"stdout","text":"<class 'numpy.ndarray'> <class 'numpy.ndarray'> <class 'numpy.ndarray'> <class 'numpy.ndarray'>\n","output_type":"stream"}]},{"cell_type":"code","source":"train_houseprice=X_train.join(Y_train)\n","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:29.921541Z","iopub.execute_input":"2023-05-23T19:58:29.921946Z","iopub.status.idle":"2023-05-23T19:58:29.964958Z","shell.execute_reply.started":"2023-05-23T19:58:29.921898Z","shell.execute_reply":"2023-05-23T19:58:29.960079Z"},"trusted":true},"execution_count":23,"outputs":[{"traceback":["\u001b[0;31m---------------------------------------------------------------------------\u001b[0m","\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)","Cell \u001b[0;32mIn[23], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m train_houseprice\u001b[38;5;241m=\u001b[39m\u001b[43mX_train\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mjoin\u001b[49m(Y_train)\n","\u001b[0;31mAttributeError\u001b[0m: 'numpy.ndarray' object has no attribute 'join'"],"ename":"AttributeError","evalue":"'numpy.ndarray' object has no attribute 'join'","output_type":"error"}]},{"cell_type":"code","source":"train_houseprice","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:29.966294Z","iopub.status.idle":"2023-05-23T19:58:29.966729Z","shell.execute_reply.started":"2023-05-23T19:58:29.966531Z","shell.execute_reply":"2023-05-23T19:58:29.966551Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"raw","source":"arr1=np.array([[3.0, 2.25, 1620, ..., 2009, 0, 'USA'],\n [3.0, 2.25, 1820, ..., 1983, 2009, 'USA'],\n [4.0, 1.75, 1750, ..., 1926, 0, 'USA'],\n ...,\n [4.0, 2.5, 2070, ..., 2004, 2003, 'USA'],\n [4.0, 2.0, 1650, ..., 1955, 2005, 'USA'],\n [4.0, 3.5, 3770, ..., 2008, 0, 'USA']])\n ","metadata":{}},{"cell_type":"code","source":"arr2=np.array([ 430277.777778, 489950. , 460000. , ...,\n 343000. , 575000. , 1020000. ])","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:29.968722Z","iopub.status.idle":"2023-05-23T19:58:29.969211Z","shell.execute_reply.started":"2023-05-23T19:58:29.968998Z","shell.execute_reply":"2023-05-23T19:58:29.969021Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"arr = np.concatenate((arr1, arr2), axis=1)\n","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:29.970297Z","iopub.status.idle":"2023-05-23T19:58:29.970896Z","shell.execute_reply.started":"2023-05-23T19:58:29.970659Z","shell.execute_reply":"2023-05-23T19:58:29.970682Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"houseprice.drop(['date','city','street','statezip','condition'], axis=1)","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:29.973484Z","iopub.status.idle":"2023-05-23T19:58:29.973912Z","shell.execute_reply.started":"2023-05-23T19:58:29.973713Z","shell.execute_reply":"2023-05-23T19:58:29.973732Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"houseprice.corr()\n","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:29.975625Z","iopub.status.idle":"2023-05-23T19:58:29.976217Z","shell.execute_reply.started":"2023-05-23T19:58:29.975917Z","shell.execute_reply":"2023-05-23T19:58:29.975963Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(15,8))\nsns.heatmap(houseprice.corr(),annot=True,cmap=\"YlGnBu\")","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:29.977800Z","iopub.status.idle":"2023-05-23T19:58:29.978394Z","shell.execute_reply.started":"2023-05-23T19:58:29.978107Z","shell.execute_reply":"2023-05-23T19:58:29.978133Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"houseprice.hist(figsize=(15,8))\n","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:29.980346Z","iopub.status.idle":"2023-05-23T19:58:29.980899Z","shell.execute_reply.started":"2023-05-23T19:58:29.980617Z","shell.execute_reply":"2023-05-23T19:58:29.980644Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.regplot(x=\"waterfront\", y=\"price\",data=houseprice)\nplt.ylim(0,)","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:29.982816Z","iopub.status.idle":"2023-05-23T19:58:29.983234Z","shell.execute_reply.started":"2023-05-23T19:58:29.983039Z","shell.execute_reply":"2023-05-23T19:58:29.983058Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"\nwf=houseprice['waterfront']\nprice=houseprice['price']\nsns.boxplot(x=wf,y=price)","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:29.984556Z","iopub.status.idle":"2023-05-23T19:58:29.985011Z","shell.execute_reply.started":"2023-05-23T19:58:29.984774Z","shell.execute_reply":"2023-05-23T19:58:29.984795Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.regplot(x=\"sqft_above\", y=\"price\",data=houseprice)\nplt.ylim(0,)","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:29.986136Z","iopub.status.idle":"2023-05-23T19:58:29.986560Z","shell.execute_reply.started":"2023-05-23T19:58:29.986346Z","shell.execute_reply":"2023-05-23T19:58:29.986366Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sqf=houseprice['sqft_above']\nprice=houseprice['price']\nsns.boxplot(x=sqf,y=price)","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:29.987716Z","iopub.status.idle":"2023-05-23T19:58:29.988162Z","shell.execute_reply.started":"2023-05-23T19:58:29.987943Z","shell.execute_reply":"2023-05-23T19:58:29.987972Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.regplot(x=\"bedrooms\", y=\"price\",data=houseprice)\nplt.ylim(0,)","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:29.990044Z","iopub.status.idle":"2023-05-23T19:58:29.990500Z","shell.execute_reply.started":"2023-05-23T19:58:29.990297Z","shell.execute_reply":"2023-05-23T19:58:29.990317Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"br=houseprice['bedrooms']\nprice=houseprice['price']\nsns.boxplot(x=br,y=price)","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:29.992131Z","iopub.status.idle":"2023-05-23T19:58:29.992582Z","shell.execute_reply.started":"2023-05-23T19:58:29.992367Z","shell.execute_reply":"2023-05-23T19:58:29.992388Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.regplot(x=\"bathrooms\", y=\"price\",data=houseprice)\nplt.ylim(0,)","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:29.994346Z","iopub.status.idle":"2023-05-23T19:58:29.995123Z","shell.execute_reply.started":"2023-05-23T19:58:29.994872Z","shell.execute_reply":"2023-05-23T19:58:29.994894Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"b=houseprice['bathrooms']\nprice=houseprice['price']\nsns.boxplot(x=b,y=price)","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:29.997383Z","iopub.status.idle":"2023-05-23T19:58:29.997788Z","shell.execute_reply.started":"2023-05-23T19:58:29.997598Z","shell.execute_reply":"2023-05-23T19:58:29.997616Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.regplot(x=\"sqft_living\", y=\"price\",data=houseprice)\nplt.ylim(0,)","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:29.998793Z","iopub.status.idle":"2023-05-23T19:58:29.999241Z","shell.execute_reply.started":"2023-05-23T19:58:29.999017Z","shell.execute_reply":"2023-05-23T19:58:29.999036Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sqfl=houseprice['sqft_living']\nprice=houseprice['price']\nsns.boxplot(x=sqfl,y=price)","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:30.000682Z","iopub.status.idle":"2023-05-23T19:58:30.001345Z","shell.execute_reply.started":"2023-05-23T19:58:30.001008Z","shell.execute_reply":"2023-05-23T19:58:30.001056Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.regplot(x=\"sqft_lot\", y=\"price\",data=houseprice)\nplt.ylim(0,)","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:30.002738Z","iopub.status.idle":"2023-05-23T19:58:30.003377Z","shell.execute_reply.started":"2023-05-23T19:58:30.002968Z","shell.execute_reply":"2023-05-23T19:58:30.002987Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sqft=houseprice['sqft_lot']\nprice=houseprice['price']\nsns.boxplot(x=sqft,y=price)","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:30.005043Z","iopub.status.idle":"2023-05-23T19:58:30.005487Z","shell.execute_reply.started":"2023-05-23T19:58:30.005288Z","shell.execute_reply":"2023-05-23T19:58:30.005308Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.regplot(x=\"floors\", y=\"price\",data=houseprice)\nplt.ylim(0,)","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:30.007858Z","iopub.status.idle":"2023-05-23T19:58:30.008443Z","shell.execute_reply.started":"2023-05-23T19:58:30.008208Z","shell.execute_reply":"2023-05-23T19:58:30.008230Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"f=houseprice['floors']\nprice=houseprice['price']\nsns.boxplot(x=f,y=price)","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:30.011023Z","iopub.status.idle":"2023-05-23T19:58:30.011562Z","shell.execute_reply.started":"2023-05-23T19:58:30.011319Z","shell.execute_reply":"2023-05-23T19:58:30.011342Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.regplot(x=\"view\", y=\"price\",data=houseprice)\nplt.ylim(0,)","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:30.013365Z","iopub.status.idle":"2023-05-23T19:58:30.013791Z","shell.execute_reply.started":"2023-05-23T19:58:30.013591Z","shell.execute_reply":"2023-05-23T19:58:30.013610Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"v=houseprice['view']\nprice=houseprice['price']\nsns.boxplot(x=v,y=price)","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:30.015156Z","iopub.status.idle":"2023-05-23T19:58:30.015567Z","shell.execute_reply.started":"2023-05-23T19:58:30.015373Z","shell.execute_reply":"2023-05-23T19:58:30.015391Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.regplot(x=\"condition\", y=\"price\",data=houseprice)\nplt.ylim(0,)","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:30.017298Z","iopub.status.idle":"2023-05-23T19:58:30.017765Z","shell.execute_reply.started":"2023-05-23T19:58:30.017540Z","shell.execute_reply":"2023-05-23T19:58:30.017560Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"c=houseprice['condition']\nprice=houseprice['price']\nsns.boxplot(x=c,y=price)","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:30.020195Z","iopub.status.idle":"2023-05-23T19:58:30.020731Z","shell.execute_reply.started":"2023-05-23T19:58:30.020423Z","shell.execute_reply":"2023-05-23T19:58:30.020441Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.regplot(x=\"sqft_above\", y=\"price\",data=houseprice)\nplt.ylim(0,)","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:30.021703Z","iopub.status.idle":"2023-05-23T19:58:30.022591Z","shell.execute_reply.started":"2023-05-23T19:58:30.022358Z","shell.execute_reply":"2023-05-23T19:58:30.022382Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sqfa=houseprice['sqft_above']\nprice=houseprice['price']\nsns.boxplot(x=sqfa,y=price)","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:30.025517Z","iopub.status.idle":"2023-05-23T19:58:30.026229Z","shell.execute_reply.started":"2023-05-23T19:58:30.025770Z","shell.execute_reply":"2023-05-23T19:58:30.025789Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.regplot(x=\"sqft_basement\", y=\"price\",data=houseprice)\nplt.ylim(0,)","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:30.028093Z","iopub.status.idle":"2023-05-23T19:58:30.028595Z","shell.execute_reply.started":"2023-05-23T19:58:30.028359Z","shell.execute_reply":"2023-05-23T19:58:30.028382Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sqfb=houseprice['sqft_basement']\nprice=houseprice['price']\nsns.boxplot(x=sqfb,y=price)","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:30.029842Z","iopub.status.idle":"2023-05-23T19:58:30.030370Z","shell.execute_reply.started":"2023-05-23T19:58:30.030146Z","shell.execute_reply":"2023-05-23T19:58:30.030170Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.regplot(x=\"yr_built\", y=\"price\",data=houseprice)\nplt.ylim(0,)","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:30.031727Z","iopub.status.idle":"2023-05-23T19:58:30.032228Z","shell.execute_reply.started":"2023-05-23T19:58:30.032000Z","shell.execute_reply":"2023-05-23T19:58:30.032024Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"yb=houseprice['yr_built']\nprice=houseprice['price']\nsns.boxplot(x=yb,y=price)","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:30.033739Z","iopub.status.idle":"2023-05-23T19:58:30.034215Z","shell.execute_reply.started":"2023-05-23T19:58:30.034002Z","shell.execute_reply":"2023-05-23T19:58:30.034024Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.regplot(x=\"yr_renovated\", y=\"price\",data=houseprice)\nplt.ylim(0,)","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:30.035550Z","iopub.status.idle":"2023-05-23T19:58:30.035995Z","shell.execute_reply.started":"2023-05-23T19:58:30.035772Z","shell.execute_reply":"2023-05-23T19:58:30.035790Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"yr=houseprice['yr_renovated']\nprice=houseprice['price']\nsns.boxplot(x=yr,y=price)","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:30.038157Z","iopub.status.idle":"2023-05-23T19:58:30.038628Z","shell.execute_reply.started":"2023-05-23T19:58:30.038397Z","shell.execute_reply":"2023-05-23T19:58:30.038419Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#MULTIPLE LINEAR REGRESSION MODEL","metadata":{"execution":{"iopub.status.busy":"2023-05-23T19:58:30.041103Z","iopub.status.idle":"2023-05-23T19:58:30.041562Z","shell.execute_reply.started":"2023-05-23T19:58:30.041339Z","shell.execute_reply":"2023-05-23T19:58:30.041360Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn import linear_model\nX1 = houseprice[['bedrooms', 'bathrooms','sqft_living','sqft_lot','view','condition','floors','sqft_above','sqft_basement','yr_built','yr_renovated']]\nY1 = houseprice['price']\n\nregr = linear_model.LinearRegression()\nregr.fit(X1,Y1)\nprint(regr)","metadata":{"execution":{"iopub.status.busy":"2023-05-23T20:02:39.636917Z","iopub.execute_input":"2023-05-23T20:02:39.637719Z","iopub.status.idle":"2023-05-23T20:02:39.654223Z","shell.execute_reply.started":"2023-05-23T20:02:39.637679Z","shell.execute_reply":"2023-05-23T20:02:39.651989Z"},"trusted":true},"execution_count":30,"outputs":[{"name":"stdout","text":"LinearRegression()\n","output_type":"stream"}]},{"cell_type":"code","source":"# Find the value of house price where 3.0\t1.50\t1340\t7912\t1.5\t0\t0\t3\t1340\t0\t1955\t2005\npredictedY1 = regr.predict([[3.0,1.50,1340,7912,1.50,3,0,1340,0,1955,2005]])\n\nprint(predictedY1)","metadata":{"execution":{"iopub.status.busy":"2023-05-23T20:39:47.473339Z","iopub.execute_input":"2023-05-23T20:39:47.474344Z","iopub.status.idle":"2023-05-23T20:39:47.481122Z","shell.execute_reply.started":"2023-05-23T20:39:47.474303Z","shell.execute_reply":"2023-05-23T20:39:47.480007Z"},"trusted":true},"execution_count":32,"outputs":[{"name":"stdout","text":"[388965.34637187]\n","output_type":"stream"},{"name":"stderr","text":"/opt/conda/lib/python3.10/site-packages/sklearn/base.py:439: UserWarning: X does not have valid feature names, but LinearRegression was fitted with feature names\n warnings.warn(\n","output_type":"stream"}]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]} |