Make notebook code match book examples more closely in chapter 2
parent
c226f328d3
commit
88acd2b4b9
|
@ -1154,16 +1154,12 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 69,
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"deletable": true,
|
||||
"editable": true
|
||||
"collapsed": true
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from sklearn.pipeline import FeatureUnion\n",
|
||||
"\n",
|
||||
"num_attribs = list(housing_num)\n",
|
||||
"cat_attribs = [\"ocean_proximity\"]\n",
|
||||
"\n",
|
||||
|
@ -1177,7 +1173,20 @@
|
|||
"cat_pipeline = Pipeline([\n",
|
||||
" ('selector', DataFrameSelector(cat_attribs)),\n",
|
||||
" ('label_binarizer', LabelBinarizer()),\n",
|
||||
" ])\n",
|
||||
" ])"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 69,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"deletable": true,
|
||||
"editable": true
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from sklearn.pipeline import FeatureUnion\n",
|
||||
"\n",
|
||||
"full_pipeline = FeatureUnion(transformer_list=[\n",
|
||||
" (\"num_pipeline\", num_pipeline),\n",
|
||||
|
@ -1219,7 +1228,7 @@
|
|||
"editable": true
|
||||
},
|
||||
"source": [
|
||||
"# Prepare the data for Machine Learning algorithms"
|
||||
"# Select and train a model "
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue