Skip to content

Commit

Permalink
ch07 consistency fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rasbt committed Nov 16, 2019
1 parent b93da65 commit efb2e40
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 40 deletions.
41 changes: 2 additions & 39 deletions ch07/ch07.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@
" classifiers : array-like, shape = [n_classifiers]\n",
" Different classifiers for the ensemble\n",
"\n",
" vote : str, {'classlabel', 'probability'} (default='label')\n",
" vote : str, {'classlabel', 'probability'} (default='classlabel')\n",
" If 'classlabel' the prediction is based on the argmax of\n",
" class labels. Else if 'probability', the argmax of\n",
" the sum of probabilities is used to predict the class label\n",
Expand Down Expand Up @@ -924,43 +924,6 @@
"source": [
"from sklearn.model_selection import GridSearchCV\n",
"\n",
"params = {'decisiontreeclassifier__max_depth': [1, 2],\n",
" 'pipeline-1__clf__C': [0.001, 0.1, 100.0]}\n",
"\n",
"grid = GridSearchCV(estimator=mv_clf,\n",
" param_grid=params,\n",
" cv=10,\n",
" iid=False,\n",
" scoring='roc_auc')\n",
"grid.fit(X_train, y_train)\n",
"\n",
"for r, _ in enumerate(grid.cv_results_['mean_test_score']):\n",
" print(\"%0.3f +/- %0.2f %r\"\n",
" % (grid.cv_results_['mean_test_score'][r], \n",
" grid.cv_results_['std_test_score'][r] / 2.0, \n",
" grid.cv_results_['params'][r]))"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.944 +/- 0.07 {'decisiontreeclassifier__max_depth': 1, 'pipeline-1__clf__C': 0.001}\n",
"0.956 +/- 0.07 {'decisiontreeclassifier__max_depth': 1, 'pipeline-1__clf__C': 0.1}\n",
"0.978 +/- 0.03 {'decisiontreeclassifier__max_depth': 1, 'pipeline-1__clf__C': 100.0}\n",
"0.956 +/- 0.07 {'decisiontreeclassifier__max_depth': 2, 'pipeline-1__clf__C': 0.001}\n",
"0.956 +/- 0.07 {'decisiontreeclassifier__max_depth': 2, 'pipeline-1__clf__C': 0.1}\n",
"0.978 +/- 0.03 {'decisiontreeclassifier__max_depth': 2, 'pipeline-1__clf__C': 100.0}\n"
]
}
],
"source": [
"from sklearn.model_selection import GridSearchCV\n",
"\n",
"params = {'decisiontreeclassifier__max_depth': [1, 2],\n",
" 'pipeline-1__clf__C': [0.001, 0.1, 100.0]}\n",
Expand Down Expand Up @@ -1717,5 +1680,5 @@
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
2 changes: 1 addition & 1 deletion ch07/ch07.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class MajorityVoteClassifier(BaseEstimator,
classifiers : array-like, shape = [n_classifiers]
Different classifiers for the ensemble
vote : str, {'classlabel', 'probability'} (default='label')
vote : str, {'classlabel', 'probability'} (default='classlabel')
If 'classlabel' the prediction is based on the argmax of
class labels. Else if 'probability', the argmax of
the sum of probabilities is used to predict the class label
Expand Down

0 comments on commit efb2e40

Please sign in to comment.