yaya YEET
This commit is contained in:
@@ -1028,43 +1028,6 @@
|
|||||||
"print(\"Number of mislabeled points out of a total %d points : %d\"\n",
|
"print(\"Number of mislabeled points out of a total %d points : %d\"\n",
|
||||||
" % (gammas_test.shape[0], (y_test != prediction).sum()))\n"
|
" % (gammas_test.shape[0], (y_test != prediction).sum()))\n"
|
||||||
]
|
]
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": 46,
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "stdout",
|
|
||||||
"output_type": "stream",
|
|
||||||
"text": [
|
|
||||||
"Number of mislabeled points out of a total 75 points : 4\n"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"data": {
|
|
||||||
"text/plain": [
|
|
||||||
"array([2, 1, 0, 2, 0, 2, 0, 1, 1, 1, 2, 1, 1, 1, 1, 0, 1, 1, 0, 0, 2, 1,\n",
|
|
||||||
" 0, 0, 2, 0, 0, 1, 1, 0, 2, 1, 0, 2, 2, 1, 0, 1, 1, 1, 2, 0, 2, 0,\n",
|
|
||||||
" 0, 1, 2, 2, 2, 2, 1, 2, 1, 1, 2, 2, 2, 2, 1, 2, 1, 0, 2, 1, 1, 1,\n",
|
|
||||||
" 1, 2, 0, 0, 2, 1, 0, 0, 1])"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"execution_count": 46,
|
|
||||||
"metadata": {},
|
|
||||||
"output_type": "execute_result"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"source": [
|
|
||||||
"from sklearn.datasets import load_iris\n",
|
|
||||||
"X, y = load_iris(return_X_y=True)\n",
|
|
||||||
"X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.5, random_state=0)\n",
|
|
||||||
"gnb = GaussianNB()\n",
|
|
||||||
"y_pred = gnb.fit(X_train, y_train).predict(X_test)\n",
|
|
||||||
"print(\"Number of mislabeled points out of a total %d points : %d\"\n",
|
|
||||||
" % (X_test.shape[0], (y_test != y_pred).sum()))\n",
|
|
||||||
"y_test"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
|
|||||||
Reference in New Issue
Block a user