Skip to content

Commit

Permalink
fixed errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Saurabh7 committed Mar 6, 2014
1 parent de52f93 commit 1817b74
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions doc/ipython-notebooks/multiclass/multiclass_reduction.ipynb
Expand Up @@ -142,7 +142,7 @@
"Xall = mat['data']\n",
"\n",
"#normalize examples to have norm one\n",
"Xall = Xall / sqrt(sum(Xall**2,0))\n",
"Xall = Xall / np.sqrt(sum(Xall**2,0))\n",
"Yall = mat['label'].squeeze()\n",
"\n",
"# map from 1..10 to 0..9, since shogun\n",
Expand Down Expand Up @@ -459,6 +459,14 @@
"metadata": {},
"outputs": []
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Using a kernel multiclass machine"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand All @@ -473,15 +481,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
"def evaluate(strategy):\n",
"def evaluate_multiclass_kernel(strategy):\n",
" from modshogun import KernelMulticlassMachine, LibSVM, GaussianKernel\n",
" width=2.1\n",
" epsilon=1e-5\n",
" \n",
" kernel=GaussianKernel(feats_train, feats_train, width)\n",
" \n",
" classifier = LibSVM()\n",
"\tclassifier.set_epsilon(epsilon)\n",
" classifier.set_epsilon(epsilon)\n",
"\n",
" mc_machine = KernelMulticlassMachine(strategy, kernel, classifier, lab_train)\n",
"\n",
Expand All @@ -502,7 +510,7 @@
"\n",
"print \"\\nOne-vs-Rest\"\n",
"print \"=\"*60\n",
"evaluate(MulticlassOneVsRestStrategy())\n",
"evaluate_multiclass_kernel(MulticlassOneVsRestStrategy())\n",
"\n"
],
"language": "python",
Expand Down

0 comments on commit 1817b74

Please sign in to comment.