Newer
Older
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {
"tags": [
"solution"
]
},
"150 examples\n",
"144 labeled correctly\n"
"features = df.iloc[:, :-1]\n",
"labels = df.iloc[:, -1]\n",
"classifier = SVC()\n",
"classifier = LogisticRegression()\n",
"classifier.fit(features, labels)\n",
"predicted_labels = classifier.predict(features)\n",
"\n",
"assert(predicted_labels.shape == labels.shape)\n",
"print(len(labels), \"examples\")\n",
"print(sum(predicted_labels == labels), \"labeled correctly\")"
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
},
"latex_envs": {
"LaTeX_envs_menu_present": true,
"autoclose": false,
"autocomplete": true,
"bibliofile": "biblio.bib",
"cite_by": "apalike",
"current_citInitial": 1,
"eqLabelWithNumbers": true,
"eqNumInitial": 1,
"hotkeys": {
"equation": "Ctrl-E",
"itemize": "Ctrl-I"
},
"labels_anchors": false,
"latex_user_defs": false,
"report_style_numbering": false,
"user_envs_cfg": false