Commit df27422b authored by geobumac's avatar geobumac
parents 07f2a28f 5abbbdef
...@@ -367,7 +367,9 @@ ...@@ -367,7 +367,9 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 56, "execution_count": 56,
"metadata": {}, "metadata": {
"scrolled": false
},
"outputs": [ "outputs": [
{ {
"data": { "data": {
...@@ -834,7 +836,7 @@ ...@@ -834,7 +836,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": 2,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
...@@ -843,13 +845,14 @@ ...@@ -843,13 +845,14 @@
"0.98" "0.98"
] ]
}, },
"execution_count": 1, "execution_count": 2,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
], ],
"source": [ "source": [
"# Cada estimador (clasificador) debe exponer un método \"score\" que nos indica la calidad de predicción.\n", "# Cada estimador (clasificador) debe exponer un método\n",
"# \"score\" que nos indica la calidad de predicción.\n",
"\n", "\n",
"from sklearn import datasets, svm\n", "from sklearn import datasets, svm\n",
"\n", "\n",
...@@ -857,7 +860,8 @@ ...@@ -857,7 +860,8 @@
"X_digits = digits.data\n", "X_digits = digits.data\n",
"y_digits = digits.target\n", "y_digits = digits.target\n",
"svc = svm.SVC(C=1, kernel='linear')\n", "svc = svm.SVC(C=1, kernel='linear')\n",
"svc.fit(X_digits[:-100], y_digits[:-100]).score(X_digits[-100:], y_digits[-100:])\n" "svc.fit(X_digits[:-100], y_digits[:-100])\n",
"svc.score(X_digits[-100:], y_digits[-100:])\n"
] ]
}, },
{ {
...@@ -874,7 +878,8 @@ ...@@ -874,7 +878,8 @@
} }
], ],
"source": [ "source": [
"# Para tener una mejor estimación del modelo, podemos dividir los datos que usamos para entrenamiento y test.\n", "# Para tener una mejor estimación del modelo,\n",
"# podemos dividir los datos que usamos para entrenamiento y test.\n",
"# A esto se le llama validación cruzada\n", "# A esto se le llama validación cruzada\n",
"import numpy as np\n", "import numpy as np\n",
"\n", "\n",
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment