mirror of
https://github.com/donnemartin/data-science-ipython-notebooks.git
synced 2024-03-22 13:30:56 +08:00
Added random forest classification report.
This commit is contained in:
parent
4c7a3a52a1
commit
5e38505cd7
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"name": "",
|
"name": "",
|
||||||
"signature": "sha256:813d2b8b5a05ecbfafc2ce418b6370897bdd4d693bd80accac706955616ce774"
|
"signature": "sha256:fc5c7ecfd36fae36306417f49f9512178629710cef9c48066a4bddbefd059be4"
|
||||||
},
|
},
|
||||||
"nbformat": 3,
|
"nbformat": 3,
|
||||||
"nbformat_minor": 0,
|
"nbformat_minor": 0,
|
||||||
|
@ -2959,6 +2959,61 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"prompt_number": 46
|
"prompt_number": 46
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"Display the classification report:"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"$$Precision = \\frac{TP}{TP + FP}$$ \n",
|
||||||
|
"\n",
|
||||||
|
"$$Recall = \\frac{TP}{TP + FN}$$ \n",
|
||||||
|
"\n",
|
||||||
|
"$$F1 = \\frac{2TP}{2TP + FP + FN}$$ "
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"collapsed": false,
|
||||||
|
"input": [
|
||||||
|
"from sklearn.metrics import classification_report\n",
|
||||||
|
"print(classification_report(test_y, \n",
|
||||||
|
" predict_y, \n",
|
||||||
|
" target_names=['Not Survived', 'Survived']))"
|
||||||
|
],
|
||||||
|
"language": "python",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"output_type": "stream",
|
||||||
|
"stream": "stdout",
|
||||||
|
"text": [
|
||||||
|
" precision recall f1-score support\n",
|
||||||
|
"\n",
|
||||||
|
"Not Survived 0.85 0.91 0.88 110\n",
|
||||||
|
" Survived 0.84 0.74 0.78 69\n",
|
||||||
|
"\n",
|
||||||
|
" avg / total 0.84 0.84 0.84 179\n",
|
||||||
|
"\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"prompt_number": 47
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"collapsed": false,
|
||||||
|
"input": [],
|
||||||
|
"language": "python",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"prompt_number": 47
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"metadata": {}
|
"metadata": {}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user