Skip to content

Commit

Permalink
Merge pull request #2047 from Saurabh7/develop
Browse files Browse the repository at this point in the history
minor fixes in multiclass nb
  • Loading branch information
karlnapf committed Mar 21, 2014
2 parents 5936eda + 7c97b23 commit 299befb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions NEWS
Expand Up @@ -5,6 +5,7 @@
* Features:
- ID3 algorithm for decision tree learning [Parijat Mazumdar]
- New modes for PCA matrix factorizations: SVD & EVD, in-place or reallocating [Parijat Mazumdar]
- Added kernel multiclass strategy examples in multiclass notebook [Saurabh Mahindre]
* Bugfixes:
- Fix memory problem in PCA::apply_to_feature_matrix [Parijat Mazumdar]
- Fix crash in LeastAngleRegression for the case D greater than N [Parijat Mazumdar]
Expand Down
16 changes: 8 additions & 8 deletions doc/ipython-notebooks/multiclass/multiclass_reduction.ipynb
Expand Up @@ -214,7 +214,7 @@
"collapsed": false,
"input": [
"def evaluate(strategy, C):\n",
" bin_machine = LibLinear()\n",
" bin_machine = LibLinear(L2R_L2LOSS_SVC)\n",
" bin_machine.set_bias_enabled(True)\n",
" bin_machine.set_C(C, C)\n",
"\n",
Expand Down Expand Up @@ -471,9 +471,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Expanding on the idea of creating a generic multiclass machine and then assigning a particular multiclass strategy and a base binary machine, one can also use the [KernelMulticlassMachine](http://www.shogun-toolbox.org/doc/en/current/classshogun_1_1CKernelMulticlassMachine.html) with a kernel of choice.\n",
"Expanding on the idea of creating a generic multiclass machine and then assigning a particular multiclass strategy and a base binary machine, one can also use the [KernelMulticlassMachine](http://www.shogun-toolbox.org/doc/en/latest/classshogun_1_1CKernelMulticlassMachine.html) with a kernel of choice.\n",
"\n",
"Here we will use a [GaussianKernel](http://www.shogun-toolbox.org/doc/en/3.0.0/classshogun_1_1CGaussianKernel.html) with LibSVM as the classifer.\n",
"Here we will use a [GaussianKernel](http://www.shogun-toolbox.org/doc/en/latest/classshogun_1_1CGaussianKernel.html) with [LibSVM](http://www.shogun-toolbox.org/doc/en/latest/classshogun_1_1CLibSVM.html) as the classifer.\n",
"All we have to do is define a new helper evaluate function with the features defined as in the above examples."
]
},
Expand Down Expand Up @@ -523,9 +523,9 @@
"source": [
"So we have seen that we can classify multiclass samples using a base binary machine. If we dwell on this a bit more, we can easily spot the intuition behind this.\n",
"\n",
"The `MulticlassOneVsRestStrategy` classifies one class against the rest of the classes. This is done for each and every class by training a separate classifier for it.So we will have total $k$ classifiers where $k$ is the number of classes.\n",
"The [MulticlassOneVsRestStrategy](http://www.shogun-toolbox.org/doc/en/latest/classshogun_1_1CMulticlassOneVsOneStrategy.html) classifies one class against the rest of the classes. This is done for each and every class by training a separate classifier for it.So we will have total $k$ classifiers where $k$ is the number of classes.\n",
"\n",
"Just to see this in action lets create some data using the gaussian mixture model class ([GMM](http://www.shogun-toolbox.org/doc/en/3.0.0/classshogun_1_1CGMM.html)) from which we sample the data points.Four different classes are created and plotted."
"Just to see this in action lets create some data using the gaussian mixture model class ([GMM](http://www.shogun-toolbox.org/doc/en/latest/classshogun_1_1CGMM.html)) from which we sample the data points.Four different classes are created and plotted."
]
},
{
Expand Down Expand Up @@ -613,7 +613,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"The [KernelMulticlassMachine](http://www.shogun-toolbox.org/doc/en/current/classshogun_1_1CKernelMulticlassMachine.html) is used with LibSVM as the classifer just as in the above example.\n",
"The [KernelMulticlassMachine](http://www.shogun-toolbox.org/doc/en/latest/classshogun_1_1CKernelMulticlassMachine.html) is used with [LibSVM](http://www.shogun-toolbox.org/doc/en/latest/classshogun_1_1CLibSVM.html) as the classifer just as in the above example.\n",
"\n",
"Now we have four different classes, so as explained above we will have four classifiers which in shogun terms are submachines.\n",
"\n",
Expand Down Expand Up @@ -678,7 +678,7 @@
"metadata": {},
"source": [
"The `MulticlassOneVsOneStrategy` is a bit different with more number of machines.\n",
"Since it trains a classifer for each pair of classes, we will have a total of $\\frac{k*(k-1)}{2}$ submachines for $k$ classes.Binary classification then takes place on each pair.\n",
"Since it trains a classifer for each pair of classes, we will have a total of $\\frac{k(k-1)}{2}$ submachines for $k$ classes. Binary classification then takes place on each pair.\n",
"Let's visualize this in a plot."
]
},
Expand All @@ -688,7 +688,7 @@
"input": [
"C=2.0\n",
" \n",
"bin_machine = LibLinear()\n",
"bin_machine = LibLinear(L2R_L2LOSS_SVC)\n",
"bin_machine.set_bias_enabled(True)\n",
"bin_machine.set_C(C, C)\n",
"\n",
Expand Down

0 comments on commit 299befb

Please sign in to comment.