Clean up the beginning of the notebook
parent
d225aff822
commit
519b3529d3
|
@ -6,7 +6,7 @@
|
||||||
"source": [
|
"source": [
|
||||||
"**Chapter 1 – The Machine Learning landscape**\n",
|
"**Chapter 1 – The Machine Learning landscape**\n",
|
||||||
"\n",
|
"\n",
|
||||||
"_This contains the code example in this chapter 1, as well as all the code used to generate `lifesat.csv` and some of this chapter's figures._\n",
|
"_This notebook contains the code examples in chapter 1, as well as all the code used to generate `lifesat.csv` from the original data sources, and some of this chapter's figures._\n",
|
||||||
"\n",
|
"\n",
|
||||||
"You're welcome to go through it if you want, but it's just a teaser: the real action starts in the next chapter."
|
"You're welcome to go through it if you want, but it's just a teaser: the real action starts in the next chapter."
|
||||||
]
|
]
|
||||||
|
@ -32,6 +32,13 @@
|
||||||
"# Setup"
|
"# Setup"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"Python 3.8 is required:"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 1,
|
"execution_count": 1,
|
||||||
|
@ -42,11 +49,17 @@
|
||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"# Python ≥3.8 is required\n",
|
|
||||||
"import sys\n",
|
"import sys\n",
|
||||||
"assert sys.version_info >= (3, 8)"
|
"assert sys.version_info >= (3, 8)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"Make this notebook's output stable across runs:"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 2,
|
"execution_count": 2,
|
||||||
|
@ -55,28 +68,40 @@
|
||||||
"source": [
|
"source": [
|
||||||
"import numpy as np\n",
|
"import numpy as np\n",
|
||||||
"\n",
|
"\n",
|
||||||
"# Make this notebook's output stable across runs\n",
|
|
||||||
"np.random.seed(42)"
|
"np.random.seed(42)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"Scikit-Learn ≥1.0 is required:"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 3,
|
"execution_count": 3,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"# Scikit-Learn ≥1.0 is required\n",
|
|
||||||
"import sklearn\n",
|
"import sklearn\n",
|
||||||
|
"\n",
|
||||||
"assert sklearn.__version__ >= \"1.0\""
|
"assert sklearn.__version__ >= \"1.0\""
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"To plot pretty figures directly within Jupyter:"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 4,
|
"execution_count": 4,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"# To plot pretty figures directly within Jupyter\n",
|
|
||||||
"%matplotlib inline\n",
|
"%matplotlib inline\n",
|
||||||
"import matplotlib as mpl\n",
|
"import matplotlib as mpl\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
@ -84,13 +109,19 @@
|
||||||
"mpl.rc('axes', labelsize=14)"
|
"mpl.rc('axes', labelsize=14)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"Download `lifesat.csv` from github, unless it's already available locally:"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 5,
|
"execution_count": 5,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"# Download the data\n",
|
|
||||||
"from pathlib import Path\n",
|
"from pathlib import Path\n",
|
||||||
"import urllib.request\n",
|
"import urllib.request\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
|
Loading…
Reference in New Issue