mirror of
https://github.com/ArthurDanjou/handson-ml3.git
synced 2026-01-14 12:14:36 +01:00
Update libraries to latest version, including TensorFlow 2.4.1 and Scikit-Learn 0.24.1
This commit is contained in:
@@ -73,11 +73,7 @@
|
||||
" print(\"Saving figure\", fig_id)\n",
|
||||
" if tight_layout:\n",
|
||||
" plt.tight_layout()\n",
|
||||
" plt.savefig(path, format=fig_extension, dpi=resolution)\n",
|
||||
"\n",
|
||||
"# Ignore useless warnings (see SciPy issue #5998)\n",
|
||||
"import warnings\n",
|
||||
"warnings.filterwarnings(action=\"ignore\", message=\"^internal gelsd\")"
|
||||
" plt.savefig(path, format=fig_extension, dpi=resolution)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -95,7 +91,7 @@
|
||||
"source": [
|
||||
"import os\n",
|
||||
"import tarfile\n",
|
||||
"import urllib\n",
|
||||
"import urllib.request\n",
|
||||
"\n",
|
||||
"DOWNLOAD_ROOT = \"https://raw.githubusercontent.com/ageron/handson-ml2/master/\"\n",
|
||||
"HOUSING_PATH = os.path.join(\"datasets\", \"housing\")\n",
|
||||
@@ -490,9 +486,9 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"housing.plot(kind=\"scatter\", x=\"longitude\", y=\"latitude\", alpha=0.4,\n",
|
||||
" s=housing[\"population\"]/100, label=\"population\", figsize=(10,7),\n",
|
||||
" c=\"median_house_value\", cmap=plt.get_cmap(\"jet\"), colorbar=True,\n",
|
||||
" sharex=False)\n",
|
||||
" s=housing[\"population\"]/100, label=\"population\", figsize=(10,7),\n",
|
||||
" c=\"median_house_value\", cmap=plt.get_cmap(\"jet\"), colorbar=True,\n",
|
||||
" sharex=False)\n",
|
||||
"plt.legend()\n",
|
||||
"save_fig(\"housing_prices_scatterplot\")"
|
||||
]
|
||||
@@ -522,10 +518,9 @@
|
||||
"import matplotlib.image as mpimg\n",
|
||||
"california_img=mpimg.imread(os.path.join(images_path, filename))\n",
|
||||
"ax = housing.plot(kind=\"scatter\", x=\"longitude\", y=\"latitude\", figsize=(10,7),\n",
|
||||
" s=housing['population']/100, label=\"Population\",\n",
|
||||
" c=\"median_house_value\", cmap=plt.get_cmap(\"jet\"),\n",
|
||||
" colorbar=False, alpha=0.4,\n",
|
||||
" )\n",
|
||||
" s=housing['population']/100, label=\"Population\",\n",
|
||||
" c=\"median_house_value\", cmap=plt.get_cmap(\"jet\"),\n",
|
||||
" colorbar=False, alpha=0.4)\n",
|
||||
"plt.imshow(california_img, extent=[-124.55, -113.80, 32.45, 42.05], alpha=0.5,\n",
|
||||
" cmap=plt.get_cmap(\"jet\"))\n",
|
||||
"plt.ylabel(\"Latitude\", fontsize=14)\n",
|
||||
@@ -1694,6 +1689,13 @@
|
||||
"Question: Try a Support Vector Machine regressor (`sklearn.svm.SVR`), with various hyperparameters such as `kernel=\"linear\"` (with various values for the `C` hyperparameter) or `kernel=\"rbf\"` (with various values for the `C` and `gamma` hyperparameters). Don't worry about what these hyperparameters mean for now. How does the best `SVR` predictor perform?"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"**Warning**: the following cell may take close to 30 minutes to run, or more depending on your hardware."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 117,
|
||||
@@ -1768,6 +1770,13 @@
|
||||
"Question: Try replacing `GridSearchCV` with `RandomizedSearchCV`."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"**Warning**: the following cell may take close to 45 minutes to run, or more depending on your hardware."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 120,
|
||||
@@ -2137,6 +2146,13 @@
|
||||
"Question: Automatically explore some preparation options using `GridSearchCV`."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"**Warning**: the following cell may take close to 45 minutes to run, or more depending on your hardware."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 137,
|
||||
@@ -2193,7 +2209,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.7.8"
|
||||
"version": "3.7.9"
|
||||
},
|
||||
"nav_menu": {
|
||||
"height": "279px",
|
||||
|
||||
Reference in New Issue
Block a user