Skip to content
Snippets Groups Projects
Commit 9b479928 authored by Jaques Grobler's avatar Jaques Grobler Committed by Andreas Mueller
Browse files

SGD and SVC duplicate example sorted

parent edb4e8f7
No related branches found
No related tags found
No related merge requests found
......@@ -159,8 +159,9 @@ further information.
- :ref:`example_linear_model_plot_sgd_separating_hyperplane.py`,
- :ref:`example_linear_model_plot_sgd_iris.py`
- :ref:`example_linear_model_plot_sgd_weighted_classes.py`
- :ref:`example_linear_model_plot_sgd_weighted_samples.py`
- :ref:`example_svm_plot_separating_hyperplane_unbalanced.py` (See the `Note`)
Regression
==========
......
......@@ -9,12 +9,27 @@ are unbalanced.
We first find the separating plane with a plain SVC and then plot
(dashed) the separating hyperplane with automatically correction for
unbalanced classes.
.. currentmodule:: sklearn.linear_model
.. note::
This example will also work by replacing ``SVC(kernel="linear")``
with ``SGDClassifier(loss="hinge")``. Setting the ``loss`` parameter
of the :class:`SGDClassifier` equal to ``hinge`` will yield behaviour
such as that of a SVC with a linear kernel.
For example try instead of the ``SVC``::
clf = SGDClassifier(n_iter=100, alpha=0.01)
"""
print(__doc__)
import numpy as np
import pylab as pl
from sklearn import svm
from sklearn.linear_model import SGDClassifier
# we create 40 separable points
rng = np.random.RandomState(0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment