Clean up the beginning of the notebook
parent
d225aff822
commit
519b3529d3
|
@ -6,7 +6,7 @@
|
|||
"source": [
|
||||
"**Chapter 1 – The Machine Learning landscape**\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",
|
||||
"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"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Python 3.8 is required:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
|
@ -42,11 +49,17 @@
|
|||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Python ≥3.8 is required\n",
|
||||
"import sys\n",
|
||||
"assert sys.version_info >= (3, 8)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Make this notebook's output stable across runs:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
|
@ -55,28 +68,40 @@
|
|||
"source": [
|
||||
"import numpy as np\n",
|
||||
"\n",
|
||||
"# Make this notebook's output stable across runs\n",
|
||||
"np.random.seed(42)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Scikit-Learn ≥1.0 is required:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Scikit-Learn ≥1.0 is required\n",
|
||||
"import sklearn\n",
|
||||
"\n",
|
||||
"assert sklearn.__version__ >= \"1.0\""
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"To plot pretty figures directly within Jupyter:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# To plot pretty figures directly within Jupyter\n",
|
||||
"%matplotlib inline\n",
|
||||
"import matplotlib as mpl\n",
|
||||
"\n",
|
||||
|
@ -84,13 +109,19 @@
|
|||
"mpl.rc('axes', labelsize=14)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Download `lifesat.csv` from github, unless it's already available locally:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Download the data\n",
|
||||
"from pathlib import Path\n",
|
||||
"import urllib.request\n",
|
||||
"\n",
|
||||
|
|
Loading…
Reference in New Issue