{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## 获取数据" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "import os\n", "import pandas as pd\n", "def load_housing_data(housing_path = './'):\n", " csv_path = os.path.join(housing_path, 'housing.csv')\n", " return pd.read_csv(csv_path)" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | longitude | \n", "latitude | \n", "housing_median_age | \n", "total_rooms | \n", "total_bedrooms | \n", "population | \n", "households | \n", "median_income | \n", "median_house_value | \n", "ocean_proximity | \n", "
---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "-122.23 | \n", "37.88 | \n", "41.0 | \n", "880.0 | \n", "129.0 | \n", "322.0 | \n", "126.0 | \n", "8.3252 | \n", "452600.0 | \n", "NEAR BAY | \n", "
1 | \n", "-122.22 | \n", "37.86 | \n", "21.0 | \n", "7099.0 | \n", "1106.0 | \n", "2401.0 | \n", "1138.0 | \n", "8.3014 | \n", "358500.0 | \n", "NEAR BAY | \n", "
2 | \n", "-122.24 | \n", "37.85 | \n", "52.0 | \n", "1467.0 | \n", "190.0 | \n", "496.0 | \n", "177.0 | \n", "7.2574 | \n", "352100.0 | \n", "NEAR BAY | \n", "
3 | \n", "-122.25 | \n", "37.85 | \n", "52.0 | \n", "1274.0 | \n", "235.0 | \n", "558.0 | \n", "219.0 | \n", "5.6431 | \n", "341300.0 | \n", "NEAR BAY | \n", "
4 | \n", "-122.25 | \n", "37.85 | \n", "52.0 | \n", "1627.0 | \n", "280.0 | \n", "565.0 | \n", "259.0 | \n", "3.8462 | \n", "342200.0 | \n", "NEAR BAY | \n", "
\n", " | longitude | \n", "latitude | \n", "housing_median_age | \n", "total_rooms | \n", "total_bedrooms | \n", "population | \n", "households | \n", "median_income | \n", "median_house_value | \n", "
---|---|---|---|---|---|---|---|---|---|
count | \n", "20640.000000 | \n", "20640.000000 | \n", "20640.000000 | \n", "20640.000000 | \n", "20433.000000 | \n", "20640.000000 | \n", "20640.000000 | \n", "20640.000000 | \n", "20640.000000 | \n", "
mean | \n", "-119.569704 | \n", "35.631861 | \n", "28.639486 | \n", "2635.763081 | \n", "537.870553 | \n", "1425.476744 | \n", "499.539680 | \n", "3.870671 | \n", "206855.816909 | \n", "
std | \n", "2.003532 | \n", "2.135952 | \n", "12.585558 | \n", "2181.615252 | \n", "421.385070 | \n", "1132.462122 | \n", "382.329753 | \n", "1.899822 | \n", "115395.615874 | \n", "
min | \n", "-124.350000 | \n", "32.540000 | \n", "1.000000 | \n", "2.000000 | \n", "1.000000 | \n", "3.000000 | \n", "1.000000 | \n", "0.499900 | \n", "14999.000000 | \n", "
25% | \n", "-121.800000 | \n", "33.930000 | \n", "18.000000 | \n", "1447.750000 | \n", "296.000000 | \n", "787.000000 | \n", "280.000000 | \n", "2.563400 | \n", "119600.000000 | \n", "
50% | \n", "-118.490000 | \n", "34.260000 | \n", "29.000000 | \n", "2127.000000 | \n", "435.000000 | \n", "1166.000000 | \n", "409.000000 | \n", "3.534800 | \n", "179700.000000 | \n", "
75% | \n", "-118.010000 | \n", "37.710000 | \n", "37.000000 | \n", "3148.000000 | \n", "647.000000 | \n", "1725.000000 | \n", "605.000000 | \n", "4.743250 | \n", "264725.000000 | \n", "
max | \n", "-114.310000 | \n", "41.950000 | \n", "52.000000 | \n", "39320.000000 | \n", "6445.000000 | \n", "35682.000000 | \n", "6082.000000 | \n", "15.000100 | \n", "500001.000000 | \n", "
\n", " | longitude | \n", "latitude | \n", "housing_median_age | \n", "total_rooms | \n", "total_bedrooms | \n", "population | \n", "households | \n", "median_income | \n", "median_house_value | \n", "ocean_proximity | \n", "
---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "-122.23 | \n", "37.88 | \n", "41.0 | \n", "880.0 | \n", "129.0 | \n", "322.0 | \n", "126.0 | \n", "8.3252 | \n", "452600.0 | \n", "NEAR BAY | \n", "
1 | \n", "-122.22 | \n", "37.86 | \n", "21.0 | \n", "7099.0 | \n", "1106.0 | \n", "2401.0 | \n", "1138.0 | \n", "8.3014 | \n", "358500.0 | \n", "NEAR BAY | \n", "
2 | \n", "-122.24 | \n", "37.85 | \n", "52.0 | \n", "1467.0 | \n", "190.0 | \n", "496.0 | \n", "177.0 | \n", "7.2574 | \n", "352100.0 | \n", "NEAR BAY | \n", "
3 | \n", "-122.25 | \n", "37.85 | \n", "52.0 | \n", "1274.0 | \n", "235.0 | \n", "558.0 | \n", "219.0 | \n", "5.6431 | \n", "341300.0 | \n", "NEAR BAY | \n", "
4 | \n", "-122.25 | \n", "37.85 | \n", "52.0 | \n", "1627.0 | \n", "280.0 | \n", "565.0 | \n", "259.0 | \n", "3.8462 | \n", "342200.0 | \n", "NEAR BAY | \n", "
\n", " | index | \n", "longitude | \n", "latitude | \n", "housing_median_age | \n", "total_rooms | \n", "total_bedrooms | \n", "population | \n", "households | \n", "median_income | \n", "median_house_value | \n", "ocean_proximity | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "0 | \n", "-122.23 | \n", "37.88 | \n", "41.0 | \n", "880.0 | \n", "129.0 | \n", "322.0 | \n", "126.0 | \n", "8.3252 | \n", "452600.0 | \n", "NEAR BAY | \n", "
1 | \n", "1 | \n", "-122.22 | \n", "37.86 | \n", "21.0 | \n", "7099.0 | \n", "1106.0 | \n", "2401.0 | \n", "1138.0 | \n", "8.3014 | \n", "358500.0 | \n", "NEAR BAY | \n", "
2 | \n", "2 | \n", "-122.24 | \n", "37.85 | \n", "52.0 | \n", "1467.0 | \n", "190.0 | \n", "496.0 | \n", "177.0 | \n", "7.2574 | \n", "352100.0 | \n", "NEAR BAY | \n", "
3 | \n", "3 | \n", "-122.25 | \n", "37.85 | \n", "52.0 | \n", "1274.0 | \n", "235.0 | \n", "558.0 | \n", "219.0 | \n", "5.6431 | \n", "341300.0 | \n", "NEAR BAY | \n", "
4 | \n", "4 | \n", "-122.25 | \n", "37.85 | \n", "52.0 | \n", "1627.0 | \n", "280.0 | \n", "565.0 | \n", "259.0 | \n", "3.8462 | \n", "342200.0 | \n", "NEAR BAY | \n", "
\n", " | index | \n", "longitude | \n", "latitude | \n", "housing_median_age | \n", "total_rooms | \n", "total_bedrooms | \n", "population | \n", "households | \n", "median_income | \n", "median_house_value | \n", "ocean_proximity | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "0 | \n", "-122.23 | \n", "37.88 | \n", "41.0 | \n", "880.0 | \n", "129.0 | \n", "322.0 | \n", "126.0 | \n", "8.3252 | \n", "452600.0 | \n", "NEAR BAY | \n", "
1 | \n", "1 | \n", "-122.22 | \n", "37.86 | \n", "21.0 | \n", "7099.0 | \n", "1106.0 | \n", "2401.0 | \n", "1138.0 | \n", "8.3014 | \n", "358500.0 | \n", "NEAR BAY | \n", "
2 | \n", "2 | \n", "-122.24 | \n", "37.85 | \n", "52.0 | \n", "1467.0 | \n", "190.0 | \n", "496.0 | \n", "177.0 | \n", "7.2574 | \n", "352100.0 | \n", "NEAR BAY | \n", "
3 | \n", "3 | \n", "-122.25 | \n", "37.85 | \n", "52.0 | \n", "1274.0 | \n", "235.0 | \n", "558.0 | \n", "219.0 | \n", "5.6431 | \n", "341300.0 | \n", "NEAR BAY | \n", "
6 | \n", "6 | \n", "-122.25 | \n", "37.84 | \n", "52.0 | \n", "2535.0 | \n", "489.0 | \n", "1094.0 | \n", "514.0 | \n", "3.6591 | \n", "299200.0 | \n", "NEAR BAY | \n", "
\n", " | index | \n", "longitude | \n", "latitude | \n", "housing_median_age | \n", "total_rooms | \n", "total_bedrooms | \n", "population | \n", "households | \n", "median_income | \n", "median_house_value | \n", "ocean_proximity | \n", "id | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "0 | \n", "-122.23 | \n", "37.88 | \n", "41.0 | \n", "880.0 | \n", "129.0 | \n", "322.0 | \n", "126.0 | \n", "8.3252 | \n", "452600.0 | \n", "NEAR BAY | \n", "-122192.12 | \n", "
1 | \n", "1 | \n", "-122.22 | \n", "37.86 | \n", "21.0 | \n", "7099.0 | \n", "1106.0 | \n", "2401.0 | \n", "1138.0 | \n", "8.3014 | \n", "358500.0 | \n", "NEAR BAY | \n", "-122182.14 | \n", "
2 | \n", "2 | \n", "-122.24 | \n", "37.85 | \n", "52.0 | \n", "1467.0 | \n", "190.0 | \n", "496.0 | \n", "177.0 | \n", "7.2574 | \n", "352100.0 | \n", "NEAR BAY | \n", "-122202.15 | \n", "
3 | \n", "3 | \n", "-122.25 | \n", "37.85 | \n", "52.0 | \n", "1274.0 | \n", "235.0 | \n", "558.0 | \n", "219.0 | \n", "5.6431 | \n", "341300.0 | \n", "NEAR BAY | \n", "-122212.15 | \n", "
4 | \n", "4 | \n", "-122.25 | \n", "37.85 | \n", "52.0 | \n", "1627.0 | \n", "280.0 | \n", "565.0 | \n", "259.0 | \n", "3.8462 | \n", "342200.0 | \n", "NEAR BAY | \n", "-122212.15 | \n", "
\n", " | index | \n", "longitude | \n", "latitude | \n", "housing_median_age | \n", "total_rooms | \n", "total_bedrooms | \n", "population | \n", "households | \n", "median_income | \n", "median_house_value | \n", "ocean_proximity | \n", "id | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "0 | \n", "-122.23 | \n", "37.88 | \n", "41.0 | \n", "880.0 | \n", "129.0 | \n", "322.0 | \n", "126.0 | \n", "8.3252 | \n", "452600.0 | \n", "NEAR BAY | \n", "-122192.12 | \n", "
1 | \n", "1 | \n", "-122.22 | \n", "37.86 | \n", "21.0 | \n", "7099.0 | \n", "1106.0 | \n", "2401.0 | \n", "1138.0 | \n", "8.3014 | \n", "358500.0 | \n", "NEAR BAY | \n", "-122182.14 | \n", "
2 | \n", "2 | \n", "-122.24 | \n", "37.85 | \n", "52.0 | \n", "1467.0 | \n", "190.0 | \n", "496.0 | \n", "177.0 | \n", "7.2574 | \n", "352100.0 | \n", "NEAR BAY | \n", "-122202.15 | \n", "
3 | \n", "3 | \n", "-122.25 | \n", "37.85 | \n", "52.0 | \n", "1274.0 | \n", "235.0 | \n", "558.0 | \n", "219.0 | \n", "5.6431 | \n", "341300.0 | \n", "NEAR BAY | \n", "-122212.15 | \n", "
4 | \n", "4 | \n", "-122.25 | \n", "37.85 | \n", "52.0 | \n", "1627.0 | \n", "280.0 | \n", "565.0 | \n", "259.0 | \n", "3.8462 | \n", "342200.0 | \n", "NEAR BAY | \n", "-122212.15 | \n", "
\n", " | longitude | \n", "latitude | \n", "housing_median_age | \n", "total_rooms | \n", "total_bedrooms | \n", "population | \n", "households | \n", "median_income | \n", "median_house_value | \n", "ocean_proximity | \n", "
---|---|---|---|---|---|---|---|---|---|---|
14196 | \n", "-117.03 | \n", "32.71 | \n", "33.0 | \n", "3126.0 | \n", "627.0 | \n", "2300.0 | \n", "623.0 | \n", "3.2596 | \n", "103000.0 | \n", "NEAR OCEAN | \n", "
8267 | \n", "-118.16 | \n", "33.77 | \n", "49.0 | \n", "3382.0 | \n", "787.0 | \n", "1314.0 | \n", "756.0 | \n", "3.8125 | \n", "382100.0 | \n", "NEAR OCEAN | \n", "
17445 | \n", "-120.48 | \n", "34.66 | \n", "4.0 | \n", "1897.0 | \n", "331.0 | \n", "915.0 | \n", "336.0 | \n", "4.1563 | \n", "172600.0 | \n", "NEAR OCEAN | \n", "
14265 | \n", "-117.11 | \n", "32.69 | \n", "36.0 | \n", "1421.0 | \n", "367.0 | \n", "1418.0 | \n", "355.0 | \n", "1.9425 | \n", "93400.0 | \n", "NEAR OCEAN | \n", "
2271 | \n", "-119.80 | \n", "36.78 | \n", "43.0 | \n", "2382.0 | \n", "431.0 | \n", "874.0 | \n", "380.0 | \n", "3.5542 | \n", "96500.0 | \n", "INLAND | \n", "
\n", " | longitude | \n", "latitude | \n", "housing_median_age | \n", "total_rooms | \n", "total_bedrooms | \n", "population | \n", "households | \n", "median_income | \n", "median_house_value | \n", "ocean_proximity | \n", "income_cat | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|
12655 | \n", "-121.46 | \n", "38.52 | \n", "29.0 | \n", "3873.0 | \n", "797.0 | \n", "2237.0 | \n", "706.0 | \n", "2.1736 | \n", "72100.0 | \n", "INLAND | \n", "2 | \n", "
15502 | \n", "-117.23 | \n", "33.09 | \n", "7.0 | \n", "5320.0 | \n", "855.0 | \n", "2015.0 | \n", "768.0 | \n", "6.3373 | \n", "279600.0 | \n", "NEAR OCEAN | \n", "5 | \n", "
2908 | \n", "-119.04 | \n", "35.37 | \n", "44.0 | \n", "1618.0 | \n", "310.0 | \n", "667.0 | \n", "300.0 | \n", "2.8750 | \n", "82700.0 | \n", "INLAND | \n", "2 | \n", "
14053 | \n", "-117.13 | \n", "32.75 | \n", "24.0 | \n", "1877.0 | \n", "519.0 | \n", "898.0 | \n", "483.0 | \n", "2.2264 | \n", "112500.0 | \n", "NEAR OCEAN | \n", "2 | \n", "
20496 | \n", "-118.70 | \n", "34.28 | \n", "27.0 | \n", "3536.0 | \n", "646.0 | \n", "1837.0 | \n", "580.0 | \n", "4.4964 | \n", "238300.0 | \n", "<1H OCEAN | \n", "3 | \n", "
1481 | \n", "-122.04 | \n", "37.96 | \n", "28.0 | \n", "1207.0 | \n", "252.0 | \n", "724.0 | \n", "252.0 | \n", "3.6964 | \n", "165700.0 | \n", "NEAR BAY | \n", "3 | \n", "
18125 | \n", "-122.03 | \n", "37.33 | \n", "23.0 | \n", "4221.0 | \n", "671.0 | \n", "1782.0 | \n", "641.0 | \n", "7.4863 | \n", "412300.0 | \n", "<1H OCEAN | \n", "5 | \n", "
5830 | \n", "-118.31 | \n", "34.20 | \n", "36.0 | \n", "1692.0 | \n", "263.0 | \n", "778.0 | \n", "278.0 | \n", "5.0865 | \n", "349600.0 | \n", "<1H OCEAN | \n", "4 | \n", "
17989 | \n", "-121.95 | \n", "37.27 | \n", "17.0 | \n", "1330.0 | \n", "271.0 | \n", "408.0 | \n", "258.0 | \n", "1.7171 | \n", "181300.0 | \n", "<1H OCEAN | \n", "2 | \n", "
4861 | \n", "-118.28 | \n", "34.02 | \n", "29.0 | \n", "515.0 | \n", "229.0 | \n", "2690.0 | \n", "217.0 | \n", "0.4999 | \n", "500001.0 | \n", "<1H OCEAN | \n", "1 | \n", "
20615 | \n", "-121.54 | \n", "39.08 | \n", "23.0 | \n", "1076.0 | \n", "216.0 | \n", "724.0 | \n", "197.0 | \n", "2.3598 | \n", "57500.0 | \n", "INLAND | \n", "2 | \n", "
11493 | \n", "-117.99 | \n", "33.69 | \n", "12.0 | \n", "2480.0 | \n", "858.0 | \n", "1441.0 | \n", "788.0 | \n", "1.6705 | \n", "350000.0 | \n", "<1H OCEAN | \n", "2 | \n", "
12386 | \n", "-116.39 | \n", "33.69 | \n", "10.0 | \n", "11659.0 | \n", "2007.0 | \n", "2186.0 | \n", "1083.0 | \n", "6.9833 | \n", "238800.0 | \n", "INLAND | \n", "5 | \n", "
2167 | \n", "-119.83 | \n", "36.78 | \n", "30.0 | \n", "3162.0 | \n", "640.0 | \n", "1660.0 | \n", "639.0 | \n", "2.8359 | \n", "80300.0 | \n", "INLAND | \n", "2 | \n", "
14562 | \n", "-117.22 | \n", "32.83 | \n", "31.0 | \n", "2558.0 | \n", "512.0 | \n", "1164.0 | \n", "492.0 | \n", "3.4318 | \n", "200400.0 | \n", "NEAR OCEAN | \n", "3 | \n", "
17821 | \n", "-121.88 | \n", "37.37 | \n", "14.0 | \n", "6016.0 | \n", "1404.0 | \n", "3258.0 | \n", "1316.0 | \n", "3.5745 | \n", "333700.0 | \n", "<1H OCEAN | \n", "3 | \n", "
7667 | \n", "-118.08 | \n", "33.93 | \n", "39.0 | \n", "1478.0 | \n", "324.0 | \n", "1127.0 | \n", "320.0 | \n", "3.5250 | \n", "158000.0 | \n", "<1H OCEAN | \n", "3 | \n", "
10779 | \n", "-117.91 | \n", "33.65 | \n", "17.0 | \n", "1328.0 | \n", "377.0 | \n", "762.0 | \n", "344.0 | \n", "2.2222 | \n", "276800.0 | \n", "<1H OCEAN | \n", "2 | \n", "
9390 | \n", "-122.53 | \n", "37.90 | \n", "44.0 | \n", "2846.0 | \n", "551.0 | \n", "1232.0 | \n", "537.0 | \n", "3.8839 | \n", "327200.0 | \n", "NEAR BAY | \n", "3 | \n", "
11063 | \n", "-117.86 | \n", "33.79 | \n", "42.0 | \n", "1024.0 | \n", "191.0 | \n", "483.0 | \n", "187.0 | \n", "4.1050 | \n", "194500.0 | \n", "<1H OCEAN | \n", "3 | \n", "
\n", " | 全部数据 | \n", "分层抽样 | \n", "随机抽样 | \n", "随机. %error | \n", "分层. %error | \n", "
---|---|---|---|---|---|
income_cat | \n", "\n", " | \n", " | \n", " | \n", " | \n", " |
1 | \n", "0.039826 | \n", "0.039971 | \n", "0.040213 | \n", "0.973236 | \n", "0.364964 | \n", "
2 | \n", "0.318847 | \n", "0.318798 | \n", "0.324370 | \n", "1.732260 | \n", "-0.015195 | \n", "
3 | \n", "0.350581 | \n", "0.350533 | \n", "0.358527 | \n", "2.266446 | \n", "-0.013820 | \n", "
4 | \n", "0.176308 | \n", "0.176357 | \n", "0.167393 | \n", "-5.056334 | \n", "0.027480 | \n", "
5 | \n", "0.114438 | \n", "0.114341 | \n", "0.109496 | \n", "-4.318374 | \n", "-0.084674 | \n", "
\n", " | longitude | \n", "latitude | \n", "housing_median_age | \n", "total_rooms | \n", "total_bedrooms | \n", "population | \n", "households | \n", "median_income | \n", "median_house_value | \n", "income_cat | \n", "
---|---|---|---|---|---|---|---|---|---|---|
longitude | \n", "1.000000 | \n", "-0.924664 | \n", "-0.108197 | \n", "0.044568 | \n", "0.069608 | \n", "0.099773 | \n", "0.055310 | \n", "-0.015176 | \n", "-0.045967 | \n", "-0.010690 | \n", "
latitude | \n", "-0.924664 | \n", "1.000000 | \n", "0.011173 | \n", "-0.036100 | \n", "-0.066983 | \n", "-0.108785 | \n", "-0.071035 | \n", "-0.079809 | \n", "-0.144160 | \n", "-0.085528 | \n", "
housing_median_age | \n", "-0.108197 | \n", "0.011173 | \n", "1.000000 | \n", "-0.361262 | \n", "-0.320451 | \n", "-0.296244 | \n", "-0.302916 | \n", "-0.119034 | \n", "0.105623 | \n", "-0.146920 | \n", "
total_rooms | \n", "0.044568 | \n", "-0.036100 | \n", "-0.361262 | \n", "1.000000 | \n", "0.930380 | \n", "0.857126 | \n", "0.918484 | \n", "0.198050 | \n", "0.134153 | \n", "0.220528 | \n", "
total_bedrooms | \n", "0.069608 | \n", "-0.066983 | \n", "-0.320451 | \n", "0.930380 | \n", "1.000000 | \n", "0.877747 | \n", "0.979728 | \n", "-0.007723 | \n", "0.049686 | \n", "0.015662 | \n", "
population | \n", "0.099773 | \n", "-0.108785 | \n", "-0.296244 | \n", "0.857126 | \n", "0.877747 | \n", "1.000000 | \n", "0.907222 | \n", "0.004834 | \n", "-0.024650 | \n", "0.025809 | \n", "
households | \n", "0.055310 | \n", "-0.071035 | \n", "-0.302916 | \n", "0.918484 | \n", "0.979728 | \n", "0.907222 | \n", "1.000000 | \n", "0.013033 | \n", "0.065843 | \n", "0.038490 | \n", "
median_income | \n", "-0.015176 | \n", "-0.079809 | \n", "-0.119034 | \n", "0.198050 | \n", "-0.007723 | \n", "0.004834 | \n", "0.013033 | \n", "1.000000 | \n", "0.688075 | \n", "0.902750 | \n", "
median_house_value | \n", "-0.045967 | \n", "-0.144160 | \n", "0.105623 | \n", "0.134153 | \n", "0.049686 | \n", "-0.024650 | \n", "0.065843 | \n", "0.688075 | \n", "1.000000 | \n", "0.643892 | \n", "
income_cat | \n", "-0.010690 | \n", "-0.085528 | \n", "-0.146920 | \n", "0.220528 | \n", "0.015662 | \n", "0.025809 | \n", "0.038490 | \n", "0.902750 | \n", "0.643892 | \n", "1.000000 | \n", "
\n", " | longitude | \n", "latitude | \n", "housing_median_age | \n", "total_rooms | \n", "total_bedrooms | \n", "population | \n", "households | \n", "median_income | \n", "median_house_value | \n", "ocean_proximity | \n", "income_cat | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "-122.23 | \n", "37.88 | \n", "41.0 | \n", "880.0 | \n", "129.0 | \n", "322.0 | \n", "126.0 | \n", "8.3252 | \n", "452600.0 | \n", "NEAR BAY | \n", "5 | \n", "
1 | \n", "-122.22 | \n", "37.86 | \n", "21.0 | \n", "7099.0 | \n", "1106.0 | \n", "2401.0 | \n", "1138.0 | \n", "8.3014 | \n", "358500.0 | \n", "NEAR BAY | \n", "5 | \n", "
2 | \n", "-122.24 | \n", "37.85 | \n", "52.0 | \n", "1467.0 | \n", "190.0 | \n", "496.0 | \n", "177.0 | \n", "7.2574 | \n", "352100.0 | \n", "NEAR BAY | \n", "5 | \n", "
3 | \n", "-122.25 | \n", "37.85 | \n", "52.0 | \n", "1274.0 | \n", "235.0 | \n", "558.0 | \n", "219.0 | \n", "5.6431 | \n", "341300.0 | \n", "NEAR BAY | \n", "4 | \n", "
4 | \n", "-122.25 | \n", "37.85 | \n", "52.0 | \n", "1627.0 | \n", "280.0 | \n", "565.0 | \n", "259.0 | \n", "3.8462 | \n", "342200.0 | \n", "NEAR BAY | \n", "3 | \n", "
\n", " | longitude | \n", "latitude | \n", "housing_median_age | \n", "total_rooms | \n", "total_bedrooms | \n", "population | \n", "households | \n", "median_income | \n", "median_house_value | \n", "ocean_proximity | \n", "income_cat | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|
12655 | \n", "-121.46 | \n", "38.52 | \n", "29.0 | \n", "3873.0 | \n", "797.0 | \n", "2237.0 | \n", "706.0 | \n", "2.1736 | \n", "72100.0 | \n", "INLAND | \n", "2 | \n", "
15502 | \n", "-117.23 | \n", "33.09 | \n", "7.0 | \n", "5320.0 | \n", "855.0 | \n", "2015.0 | \n", "768.0 | \n", "6.3373 | \n", "279600.0 | \n", "NEAR OCEAN | \n", "5 | \n", "
2908 | \n", "-119.04 | \n", "35.37 | \n", "44.0 | \n", "1618.0 | \n", "310.0 | \n", "667.0 | \n", "300.0 | \n", "2.8750 | \n", "82700.0 | \n", "INLAND | \n", "2 | \n", "
14053 | \n", "-117.13 | \n", "32.75 | \n", "24.0 | \n", "1877.0 | \n", "519.0 | \n", "898.0 | \n", "483.0 | \n", "2.2264 | \n", "112500.0 | \n", "NEAR OCEAN | \n", "2 | \n", "
20496 | \n", "-118.70 | \n", "34.28 | \n", "27.0 | \n", "3536.0 | \n", "646.0 | \n", "1837.0 | \n", "580.0 | \n", "4.4964 | \n", "238300.0 | \n", "<1H OCEAN | \n", "3 | \n", "
\n", " | longitude | \n", "latitude | \n", "housing_median_age | \n", "total_rooms | \n", "total_bedrooms | \n", "population | \n", "households | \n", "median_income | \n", "ocean_proximity | \n", "income_cat | \n", "
---|---|---|---|---|---|---|---|---|---|---|
12655 | \n", "-121.46 | \n", "38.52 | \n", "29.0 | \n", "3873.0 | \n", "797.0 | \n", "2237.0 | \n", "706.0 | \n", "2.1736 | \n", "INLAND | \n", "2 | \n", "
15502 | \n", "-117.23 | \n", "33.09 | \n", "7.0 | \n", "5320.0 | \n", "855.0 | \n", "2015.0 | \n", "768.0 | \n", "6.3373 | \n", "NEAR OCEAN | \n", "5 | \n", "
2908 | \n", "-119.04 | \n", "35.37 | \n", "44.0 | \n", "1618.0 | \n", "310.0 | \n", "667.0 | \n", "300.0 | \n", "2.8750 | \n", "INLAND | \n", "2 | \n", "
14053 | \n", "-117.13 | \n", "32.75 | \n", "24.0 | \n", "1877.0 | \n", "519.0 | \n", "898.0 | \n", "483.0 | \n", "2.2264 | \n", "NEAR OCEAN | \n", "2 | \n", "
20496 | \n", "-118.70 | \n", "34.28 | \n", "27.0 | \n", "3536.0 | \n", "646.0 | \n", "1837.0 | \n", "580.0 | \n", "4.4964 | \n", "<1H OCEAN | \n", "3 | \n", "
\n", " | longitude | \n", "latitude | \n", "housing_median_age | \n", "total_rooms | \n", "total_bedrooms | \n", "population | \n", "households | \n", "median_income | \n", "ocean_proximity | \n", "income_cat | \n", "
---|---|---|---|---|---|---|---|---|---|---|
1606 | \n", "-122.08 | \n", "37.88 | \n", "26.0 | \n", "2947.0 | \n", "NaN | \n", "825.0 | \n", "626.0 | \n", "2.9330 | \n", "NEAR BAY | \n", "2 | \n", "
10915 | \n", "-117.87 | \n", "33.73 | \n", "45.0 | \n", "2264.0 | \n", "NaN | \n", "1970.0 | \n", "499.0 | \n", "3.4193 | \n", "<1H OCEAN | \n", "3 | \n", "
19150 | \n", "-122.70 | \n", "38.35 | \n", "14.0 | \n", "2313.0 | \n", "NaN | \n", "954.0 | \n", "397.0 | \n", "3.7813 | \n", "<1H OCEAN | \n", "3 | \n", "
4186 | \n", "-118.23 | \n", "34.13 | \n", "48.0 | \n", "1308.0 | \n", "NaN | \n", "835.0 | \n", "294.0 | \n", "4.2891 | \n", "<1H OCEAN | \n", "3 | \n", "
16885 | \n", "-122.40 | \n", "37.58 | \n", "26.0 | \n", "3281.0 | \n", "NaN | \n", "1145.0 | \n", "480.0 | \n", "6.3580 | \n", "NEAR OCEAN | \n", "5 | \n", "
SimpleImputer(strategy='median')In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
SimpleImputer(strategy='median')
\n", " | longitude | \n", "latitude | \n", "housing_median_age | \n", "total_rooms | \n", "total_bedrooms | \n", "population | \n", "households | \n", "median_income | \n", "income_cat | \n", "
---|---|---|---|---|---|---|---|---|---|
12655 | \n", "-121.46 | \n", "38.52 | \n", "29.0 | \n", "3873.0 | \n", "797.0 | \n", "2237.0 | \n", "706.0 | \n", "2.1736 | \n", "2.0 | \n", "
15502 | \n", "-117.23 | \n", "33.09 | \n", "7.0 | \n", "5320.0 | \n", "855.0 | \n", "2015.0 | \n", "768.0 | \n", "6.3373 | \n", "5.0 | \n", "
2908 | \n", "-119.04 | \n", "35.37 | \n", "44.0 | \n", "1618.0 | \n", "310.0 | \n", "667.0 | \n", "300.0 | \n", "2.8750 | \n", "2.0 | \n", "
14053 | \n", "-117.13 | \n", "32.75 | \n", "24.0 | \n", "1877.0 | \n", "519.0 | \n", "898.0 | \n", "483.0 | \n", "2.2264 | \n", "2.0 | \n", "
20496 | \n", "-118.70 | \n", "34.28 | \n", "27.0 | \n", "3536.0 | \n", "646.0 | \n", "1837.0 | \n", "580.0 | \n", "4.4964 | \n", "3.0 | \n", "
\n", " | ocean_proximity | \n", "
---|---|
12655 | \n", "INLAND | \n", "
15502 | \n", "NEAR OCEAN | \n", "
2908 | \n", "INLAND | \n", "
14053 | \n", "NEAR OCEAN | \n", "
20496 | \n", "<1H OCEAN | \n", "
1481 | \n", "NEAR BAY | \n", "
18125 | \n", "<1H OCEAN | \n", "
5830 | \n", "<1H OCEAN | \n", "
17989 | \n", "<1H OCEAN | \n", "
4861 | \n", "<1H OCEAN | \n", "
\n", " | 0 | \n", "1 | \n", "2 | \n", "3 | \n", "4 | \n", "5 | \n", "6 | \n", "7 | \n", "8 | \n", "9 | \n", "10 | \n", "11 | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "-121.46 | \n", "38.52 | \n", "29.0 | \n", "3873.0 | \n", "797.0 | \n", "2237.0 | \n", "706.0 | \n", "2.1736 | \n", "INLAND | \n", "2 | \n", "5.485836 | \n", "3.168555 | \n", "
1 | \n", "-117.23 | \n", "33.09 | \n", "7.0 | \n", "5320.0 | \n", "855.0 | \n", "2015.0 | \n", "768.0 | \n", "6.3373 | \n", "NEAR OCEAN | \n", "5 | \n", "6.927083 | \n", "2.623698 | \n", "
2 | \n", "-119.04 | \n", "35.37 | \n", "44.0 | \n", "1618.0 | \n", "310.0 | \n", "667.0 | \n", "300.0 | \n", "2.875 | \n", "INLAND | \n", "2 | \n", "5.393333 | \n", "2.223333 | \n", "
3 | \n", "-117.13 | \n", "32.75 | \n", "24.0 | \n", "1877.0 | \n", "519.0 | \n", "898.0 | \n", "483.0 | \n", "2.2264 | \n", "NEAR OCEAN | \n", "2 | \n", "3.886128 | \n", "1.859213 | \n", "
4 | \n", "-118.7 | \n", "34.28 | \n", "27.0 | \n", "3536.0 | \n", "646.0 | \n", "1837.0 | \n", "580.0 | \n", "4.4964 | \n", "<1H OCEAN | \n", "3 | \n", "6.096552 | \n", "3.167241 | \n", "
\n", " | longitude | \n", "latitude | \n", "housing_median_age | \n", "total_rooms | \n", "total_bedrooms | \n", "population | \n", "households | \n", "median_income | \n", "ocean_proximity | \n", "income_cat | \n", "rooms_per_household | \n", "population_per_household | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|
12655 | \n", "-121.46 | \n", "38.52 | \n", "29.0 | \n", "3873.0 | \n", "797.0 | \n", "2237.0 | \n", "706.0 | \n", "2.1736 | \n", "INLAND | \n", "2 | \n", "5.485836 | \n", "3.168555 | \n", "
15502 | \n", "-117.23 | \n", "33.09 | \n", "7.0 | \n", "5320.0 | \n", "855.0 | \n", "2015.0 | \n", "768.0 | \n", "6.3373 | \n", "NEAR OCEAN | \n", "5 | \n", "6.927083 | \n", "2.623698 | \n", "
2908 | \n", "-119.04 | \n", "35.37 | \n", "44.0 | \n", "1618.0 | \n", "310.0 | \n", "667.0 | \n", "300.0 | \n", "2.875 | \n", "INLAND | \n", "2 | \n", "5.393333 | \n", "2.223333 | \n", "
14053 | \n", "-117.13 | \n", "32.75 | \n", "24.0 | \n", "1877.0 | \n", "519.0 | \n", "898.0 | \n", "483.0 | \n", "2.2264 | \n", "NEAR OCEAN | \n", "2 | \n", "3.886128 | \n", "1.859213 | \n", "
20496 | \n", "-118.7 | \n", "34.28 | \n", "27.0 | \n", "3536.0 | \n", "646.0 | \n", "1837.0 | \n", "580.0 | \n", "4.4964 | \n", "<1H OCEAN | \n", "3 | \n", "6.096552 | \n", "3.167241 | \n", "
\n", " | longitude | \n", "latitude | \n", "housing_median_age | \n", "total_rooms | \n", "total_bedrooms | \n", "population | \n", "households | \n", "median_income | \n", "ocean_proximity | \n", "income_cat | \n", "rooms_per_household | \n", "population_per_household | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|
4859 | \n", "-118.3 | \n", "34.02 | \n", "34.0 | \n", "3184.0 | \n", "772.0 | \n", "2474.0 | \n", "705.0 | \n", "1.631 | \n", "<1H OCEAN | \n", "2 | \n", "4.516312 | \n", "3.50922 | \n", "
10780 | \n", "-117.91 | \n", "33.64 | \n", "37.0 | \n", "1998.0 | \n", "472.0 | \n", "1030.0 | \n", "436.0 | \n", "3.9306 | \n", "<1H OCEAN | \n", "3 | \n", "4.582569 | \n", "2.362385 | \n", "
16568 | \n", "-121.42 | \n", "37.71 | \n", "7.0 | \n", "8297.0 | \n", "1433.0 | \n", "4189.0 | \n", "1271.0 | \n", "4.3696 | \n", "INLAND | \n", "3 | \n", "6.527931 | \n", "3.29583 | \n", "
16936 | \n", "-122.32 | \n", "37.56 | \n", "49.0 | \n", "2016.0 | \n", "299.0 | \n", "691.0 | \n", "288.0 | \n", "5.549 | \n", "NEAR OCEAN | \n", "4 | \n", "7.0 | \n", "2.399306 | \n", "
20619 | \n", "-121.56 | \n", "39.01 | \n", "22.0 | \n", "1891.0 | \n", "340.0 | \n", "1023.0 | \n", "296.0 | \n", "2.7303 | \n", "INLAND | \n", "2 | \n", "6.388514 | \n", "3.456081 | \n", "
16675 | \n", "-120.7 | \n", "35.14 | \n", "17.0 | \n", "5805.0 | \n", "1097.0 | \n", "1919.0 | \n", "932.0 | \n", "3.5352 | \n", "NEAR OCEAN | \n", "3 | \n", "6.228541 | \n", "2.059013 | \n", "
5900 | \n", "-118.31 | \n", "34.17 | \n", "12.0 | \n", "3188.0 | \n", "931.0 | \n", "2118.0 | \n", "850.0 | \n", "3.1823 | \n", "<1H OCEAN | \n", "3 | \n", "3.750588 | \n", "2.491765 | \n", "
1648 | \n", "-121.96 | \n", "37.99 | \n", "2.0 | \n", "3129.0 | \n", "707.0 | \n", "1606.0 | \n", "698.0 | \n", "2.9591 | \n", "INLAND | \n", "2 | \n", "4.482808 | \n", "2.30086 | \n", "
9453 | \n", "-123.24 | \n", "39.81 | \n", "25.0 | \n", "1435.0 | \n", "304.0 | \n", "746.0 | \n", "259.0 | \n", "1.7788 | \n", "INLAND | \n", "2 | \n", "5.540541 | \n", "2.880309 | \n", "
6707 | \n", "-118.15 | \n", "34.14 | \n", "27.0 | \n", "1499.0 | \n", "426.0 | \n", "755.0 | \n", "414.0 | \n", "3.875 | \n", "<1H OCEAN | \n", "3 | \n", "3.620773 | \n", "1.823671 | \n", "
14962 | \n", "-116.91 | \n", "32.75 | \n", "5.0 | \n", "8710.0 | \n", "1614.0 | \n", "4372.0 | \n", "1527.0 | \n", "4.7813 | \n", "<1H OCEAN | \n", "4 | \n", "5.703995 | \n", "2.86313 | \n", "
4201 | \n", "-118.24 | \n", "34.11 | \n", "39.0 | \n", "1148.0 | \n", "348.0 | \n", "1161.0 | \n", "333.0 | \n", "2.2167 | \n", "<1H OCEAN | \n", "2 | \n", "3.447447 | \n", "3.486486 | \n", "
1209 | \n", "-120.46 | \n", "38.15 | \n", "16.0 | \n", "4221.0 | \n", "781.0 | \n", "1516.0 | \n", "697.0 | \n", "2.3816 | \n", "INLAND | \n", "2 | \n", "6.055954 | \n", "2.175036 | \n", "
5319 | \n", "-118.42 | \n", "34.06 | \n", "52.0 | \n", "1881.0 | \n", "334.0 | \n", "640.0 | \n", "321.0 | \n", "6.871 | \n", "<1H OCEAN | \n", "5 | \n", "5.859813 | \n", "1.993769 | \n", "
7136 | \n", "-118.1 | \n", "34.02 | \n", "37.0 | \n", "1022.0 | \n", "232.0 | \n", "653.0 | \n", "238.0 | \n", "3.0625 | \n", "<1H OCEAN | \n", "3 | \n", "4.294118 | \n", "2.743697 | \n", "
20325 | \n", "-119.04 | \n", "34.28 | \n", "21.0 | \n", "1856.0 | \n", "276.0 | \n", "863.0 | \n", "255.0 | \n", "4.5833 | \n", "<1H OCEAN | \n", "4 | \n", "7.278431 | \n", "3.384314 | \n", "
3635 | \n", "-118.43 | \n", "34.23 | \n", "37.0 | \n", "1737.0 | \n", "369.0 | \n", "1061.0 | \n", "356.0 | \n", "3.9615 | \n", "<1H OCEAN | \n", "3 | \n", "4.879213 | \n", "2.980337 | \n", "
16104 | \n", "-122.5 | \n", "37.75 | \n", "45.0 | \n", "1620.0 | \n", "NaN | \n", "941.0 | \n", "328.0 | \n", "4.3859 | \n", "NEAR OCEAN | \n", "3 | \n", "4.939024 | \n", "2.868902 | \n", "
13585 | \n", "-117.3 | \n", "34.12 | \n", "43.0 | \n", "1018.0 | \n", "261.0 | \n", "736.0 | \n", "215.0 | \n", "2.6 | \n", "INLAND | \n", "2 | \n", "4.734884 | \n", "3.423256 | \n", "
9267 | \n", "-120.13 | \n", "36.87 | \n", "32.0 | \n", "2089.0 | \n", "468.0 | \n", "1765.0 | \n", "427.0 | \n", "2.234 | \n", "INLAND | \n", "2 | \n", "4.892272 | \n", "4.133489 | \n", "
\n", " | 0 | \n", "1 | \n", "2 | \n", "3 | \n", "4 | \n", "5 | \n", "6 | \n", "7 | \n", "8 | \n", "9 | \n", "10 | \n", "11 | \n", "12 | \n", "13 | \n", "14 | \n", "15 | \n", "16 | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "-0.941350 | \n", "1.347438 | \n", "0.027564 | \n", "0.584777 | \n", "0.640371 | \n", "0.732602 | \n", "0.556286 | \n", "-0.893647 | \n", "-0.954687 | \n", "0.017395 | \n", "0.006223 | \n", "-0.121122 | \n", "0.0 | \n", "1.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "
1 | \n", "1.171782 | \n", "-1.192440 | \n", "-1.722018 | \n", "1.261467 | \n", "0.781561 | \n", "0.533612 | \n", "0.721318 | \n", "1.292168 | \n", "1.890078 | \n", "0.569256 | \n", "-0.040811 | \n", "-0.810867 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "1.0 | \n", "
2 | \n", "0.267581 | \n", "-0.125972 | \n", "1.220460 | \n", "-0.469773 | \n", "-0.545138 | \n", "-0.674675 | \n", "-0.524407 | \n", "-0.525434 | \n", "-0.954687 | \n", "-0.018024 | \n", "-0.075371 | \n", "-0.338273 | \n", "0.0 | \n", "1.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "
3 | \n", "1.221738 | \n", "-1.351474 | \n", "-0.370069 | \n", "-0.348652 | \n", "-0.036367 | \n", "-0.467617 | \n", "-0.037297 | \n", "-0.865929 | \n", "-0.954687 | \n", "-0.595140 | \n", "-0.106803 | \n", "0.961205 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "1.0 | \n", "
4 | \n", "0.437431 | \n", "-0.635818 | \n", "-0.131489 | \n", "0.427179 | \n", "0.272790 | \n", "0.374060 | \n", "0.220898 | \n", "0.325752 | \n", "-0.006432 | \n", "0.251241 | \n", "0.006109 | \n", "-0.474513 | \n", "1.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "
LinearRegression()In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
LinearRegression()
DecisionTreeRegressor(random_state=42)In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
DecisionTreeRegressor(random_state=42)
RandomForestRegressor(n_estimators=10, random_state=42)In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
RandomForestRegressor(n_estimators=10, random_state=42)
GridSearchCV(cv=5, estimator=RandomForestRegressor(random_state=42),\n", " param_grid=[{'max_features': [2, 4, 6, 8],\n", " 'n_estimators': [3, 10, 30]},\n", " {'bootstrap': [False], 'max_features': [2, 3, 4],\n", " 'n_estimators': [3, 10]}],\n", " return_train_score=True, scoring='neg_mean_squared_error')In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
GridSearchCV(cv=5, estimator=RandomForestRegressor(random_state=42),\n", " param_grid=[{'max_features': [2, 4, 6, 8],\n", " 'n_estimators': [3, 10, 30]},\n", " {'bootstrap': [False], 'max_features': [2, 3, 4],\n", " 'n_estimators': [3, 10]}],\n", " return_train_score=True, scoring='neg_mean_squared_error')
RandomForestRegressor(random_state=42)
RandomForestRegressor(random_state=42)
RandomForestRegressor(max_features=6, n_estimators=30, random_state=42)In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
RandomForestRegressor(max_features=6, n_estimators=30, random_state=42)
RandomizedSearchCV(cv=5, estimator=RandomForestRegressor(random_state=42),\n", " param_distributions={'max_features': <scipy.stats._distn_infrastructure.rv_discrete_frozen object at 0x000002474F2A2790>,\n", " 'n_estimators': <scipy.stats._distn_infrastructure.rv_discrete_frozen object at 0x000002474F2A27F0>},\n", " random_state=42, scoring='neg_mean_squared_error')In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
RandomizedSearchCV(cv=5, estimator=RandomForestRegressor(random_state=42),\n", " param_distributions={'max_features': <scipy.stats._distn_infrastructure.rv_discrete_frozen object at 0x000002474F2A2790>,\n", " 'n_estimators': <scipy.stats._distn_infrastructure.rv_discrete_frozen object at 0x000002474F2A27F0>},\n", " random_state=42, scoring='neg_mean_squared_error')
RandomForestRegressor(random_state=42)
RandomForestRegressor(random_state=42)
\n", " | median_income | \n", "income_cat | \n", "INLAND | \n", "population_per_household | \n", "longitude | \n", "
---|---|---|---|---|---|
0 | \n", "-0.941350 | \n", "-0.893647 | \n", "-0.954687 | \n", "0.006223 | \n", "1.0 | \n", "
1 | \n", "1.171782 | \n", "1.292168 | \n", "1.890078 | \n", "-0.040811 | \n", "0.0 | \n", "
2 | \n", "0.267581 | \n", "-0.525434 | \n", "-0.954687 | \n", "-0.075371 | \n", "1.0 | \n", "
3 | \n", "1.221738 | \n", "-0.865929 | \n", "-0.954687 | \n", "-0.106803 | \n", "0.0 | \n", "
4 | \n", "0.437431 | \n", "0.325752 | \n", "-0.006432 | \n", "0.006109 | \n", "0.0 | \n", "
Pipeline(steps=[('preparation',\n", " FeatureUnion(transformer_list=[('num_pipline',\n", " Pipeline(steps=[('selector',\n", " DataFrameSelector(attribute_names=['longitude',\n", " 'latitude',\n", " 'housing_median_age',\n", " 'total_rooms',\n", " 'total_bedrooms',\n", " 'population',\n", " 'households',\n", " 'median_income',\n", " 'income_cat'])),\n", " ('imputer',\n", " SimpleImputer(strategy='median')),\n", " ('attribs_adder',\n", " CombinedAttributesAdder()),\n", " ('std_scaler',\n", " StandardScaler())])),\n", " ('cat_pipline',\n", " Pipeline(steps=[('selector',\n", " DataFrameSelector(attribute_names=['ocean_proximity'])),\n", " ('LabelBinarizer',\n", " <__main__.MyLabelBinarizer object at 0x000002474EAEFC70>)]))])),\n", " ('final_model',\n", " RandomForestRegressor(max_features=6, n_estimators=30))])In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
Pipeline(steps=[('preparation',\n", " FeatureUnion(transformer_list=[('num_pipline',\n", " Pipeline(steps=[('selector',\n", " DataFrameSelector(attribute_names=['longitude',\n", " 'latitude',\n", " 'housing_median_age',\n", " 'total_rooms',\n", " 'total_bedrooms',\n", " 'population',\n", " 'households',\n", " 'median_income',\n", " 'income_cat'])),\n", " ('imputer',\n", " SimpleImputer(strategy='median')),\n", " ('attribs_adder',\n", " CombinedAttributesAdder()),\n", " ('std_scaler',\n", " StandardScaler())])),\n", " ('cat_pipline',\n", " Pipeline(steps=[('selector',\n", " DataFrameSelector(attribute_names=['ocean_proximity'])),\n", " ('LabelBinarizer',\n", " <__main__.MyLabelBinarizer object at 0x000002474EAEFC70>)]))])),\n", " ('final_model',\n", " RandomForestRegressor(max_features=6, n_estimators=30))])
FeatureUnion(transformer_list=[('num_pipline',\n", " Pipeline(steps=[('selector',\n", " DataFrameSelector(attribute_names=['longitude',\n", " 'latitude',\n", " 'housing_median_age',\n", " 'total_rooms',\n", " 'total_bedrooms',\n", " 'population',\n", " 'households',\n", " 'median_income',\n", " 'income_cat'])),\n", " ('imputer',\n", " SimpleImputer(strategy='median')),\n", " ('attribs_adder',\n", " CombinedAttributesAdder()),\n", " ('std_scaler',\n", " StandardScaler())])),\n", " ('cat_pipline',\n", " Pipeline(steps=[('selector',\n", " DataFrameSelector(attribute_names=['ocean_proximity'])),\n", " ('LabelBinarizer',\n", " <__main__.MyLabelBinarizer object at 0x000002474EAEFC70>)]))])
DataFrameSelector(attribute_names=['longitude', 'latitude',\n", " 'housing_median_age', 'total_rooms',\n", " 'total_bedrooms', 'population', 'households',\n", " 'median_income', 'income_cat'])
SimpleImputer(strategy='median')
CombinedAttributesAdder()
StandardScaler()
DataFrameSelector(attribute_names=['ocean_proximity'])
<__main__.MyLabelBinarizer object at 0x000002474EAEFC70>
RandomForestRegressor(max_features=6, n_estimators=30)