Update week44.ipynb
This commit is contained in:
@@ -1254,7 +1254,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"execution_count": 36,
|
||||
"id": "6d3ad401",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
@@ -1400,7 +1400,7 @@
|
||||
"0"
|
||||
]
|
||||
},
|
||||
"execution_count": 7,
|
||||
"execution_count": 36,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@@ -1453,13 +1453,6 @@
|
||||
"X = grades.loc[:, grades.columns != 'Grade'].values\n",
|
||||
"y = grades.loc[:, grades.columns == 'Grade'].values\n",
|
||||
"print(X)\n",
|
||||
"# Create the encoder.\n",
|
||||
"encoder = OneHotEncoder(handle_unknown=\"ignore\")\n",
|
||||
"# Assume for simplicity all features are categorical.\n",
|
||||
"encoder.fit(X) \n",
|
||||
"# Apply the encoder.\n",
|
||||
"X = encoder.transform(X)\n",
|
||||
"# Then do a Classification tree\n",
|
||||
"tree_clf = DecisionTreeClassifier(max_depth=2)\n",
|
||||
"tree_clf.fit(X, y)\n",
|
||||
"print(\"Train set accuracy with Decision Tree: {:.2f}\".format(tree_clf.score(X,y)))\n",
|
||||
|
||||
Reference in New Issue
Block a user