Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 34334f5

Browse files
author
Fabian Pedregosa
committed
DOC: some documentation fixes.
1 parent 8b11f3e commit 34334f5

File tree

2 files changed

+43
-36
lines changed

2 files changed

+43
-36
lines changed

doc/modules/outlier_detection.rst

Lines changed: 42 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
Novelty and Outlier Detection
55
===================================================
66

7+
.. currentmodule:: sklearn
8+
79
Many applications require being able to decide whether a new observation
810
belongs to the same distribution as exiting observations (it is an
911
`inlier`), or should be considered as different (it is an outlier).
@@ -52,19 +54,20 @@ observations. Otherwise, if they lay outside the frontier, we can say
5254
that they are abnormal with a given confidence in our assessment.
5355

5456
The One-Class SVM has been introduced in [1] for that purpose and
55-
implemented in the `sklearn.svm` package in the :class:`OneClassSVM`
56-
object. It requires the choice of a kernel and a scalar parameter to
57-
define a frontier. The RBF kernel is usually chosen although there
58-
exist no exact formula or algorithm to set its bandwith
59-
parameter. This is the default in the scikit-learn implementation. The
60-
:math:`\nu` parameter, also known as the margin of the One-Class SVM,
61-
corresponds to the probability of finding a new, but regular,
62-
observation outside the frontier.
57+
implemented in the :ref:`svm` module in the
58+
:class:`svm.OneClassSVM` object. It requires the choice of a
59+
kernel and a scalar parameter to define a frontier. The RBF kernel is
60+
usually chosen although there exist no exact formula or algorithm to
61+
set its bandwith parameter. This is the default in the scikit-learn
62+
implementation. The :math:`\nu` parameter, also known as the margin of
63+
the One-Class SVM, corresponds to the probability of finding a new,
64+
but regular, observation outside the frontier.
6365

6466
.. topic:: Examples:
6567

66-
* See :ref:`example_svm_plot_oneclass.py` for vizualizing the frontier
67-
learned around some data by a :class:`OneClassSVM` object.
68+
* See :ref:`example_svm_plot_oneclass.py` for vizualizing the
69+
frontier learned around some data by a
70+
:class:`svm.OneClassSVM` object.
6871

6972
.. figure:: ../auto_examples/svm/images/plot_oneclass_1.png
7073
:target: ../auto_examples/svm/plot_oneclasse.html
@@ -84,17 +87,17 @@ of regular observations that can be used to train any tool.
8487
Fitting an elliptic envelop
8588
-----------------------------
8689

87-
.. currentmodule:: sklearn.covariance
8890

8991
One common way of performing outlier detection is to assume that the
9092
regular data come from a known distribution (e.g. data are Gaussian
9193
distributed). From this assumption, we generaly try to define the
9294
"shape" of the data, and can define outlying observations as
9395
observations which stand far enough from the fit shape.
9496

95-
The scikit-learn provides an object :class:`EllipticEnvelop` that fits a
96-
robust covariance estimate to the data, and thus fits an ellipse to the
97-
central data points, ignoring points outside the central mode.
97+
The scikit-learn provides an object
98+
:class:`covariance.EllipticEnvelop` that fits a robust covariance
99+
estimate to the data, and thus fits an ellipse to the central data
100+
points, ignoring points outside the central mode.
98101

99102
For instance, assuming that the inlier data are Gaussian distributed, it
100103
will estimate the inlier location and covariance in a robust way (i.e.
@@ -111,9 +114,9 @@ This strategy is illustrated below.
111114

112115
* See :ref:`example_covariance_plot_mahalanobis_distances.py` for
113116
an illustration of the difference between using a standard
114-
(:class:`EmpiricalCovariance`) or a robust estimate (:class:`MinCovDet`)
115-
of location and covariance to assess the degree of outlyingness of an
116-
observation.
117+
(:class:`covariance.EmpiricalCovariance`) or a robust estimate
118+
(:class:`covariance.MinCovDet`) of location and covariance to
119+
assess the degree of outlyingness of an observation.
117120

118121
One-class SVM versus elliptic envelop
119122
--------------------------------------
@@ -126,8 +129,9 @@ inlying data is very challenging, and a One-class SVM gives useful
126129
results in these situations.
127130

128131
The examples below illustrate how the performance of the
129-
:class:`EllipticEnvelop` degrades as the data is less and less unimodal.
130-
:class:`OneClassSVM` works better on data with multiple modes.
132+
:class:`coavariance.EllipticEnvelop` degrades as the data is less and
133+
less unimodal. :class:`svm.OneClassSVM` works better on data with
134+
multiple modes.
131135

132136
.. |outlier1| image:: ../auto_examples/covariance/images/plot_outlier_detection_1.png
133137
:target: ../auto_examples/covariance/plot_outlier_detection.html
@@ -146,32 +150,35 @@ The examples below illustrate how the performance of the
146150

147151
*
148152
- For a inlier mode well-centered and elliptic, the
149-
:class:`OneClassSVM` is not able to benefit from the rotational
150-
symmetry of the inlier population. In addition, it fits a bit the
151-
outlyers present in the training set. On the opposite, the
152-
decision rule based on fitting an :class:`EllipticEnvelop`
153-
learns an ellipse, which fits well the inlier distribution.
153+
:class:`svm.OneClassSVM` is not able to benefit from the
154+
rotational symmetry of the inlier population. In addition, it
155+
fits a bit the outlyers present in the training set. On the
156+
opposite, the decision rule based on fitting an
157+
:class:`covariance.EllipticEnvelop` learns an ellipse, which
158+
fits well the inlier distribution.
154159
- |outlier1|
155160

156161
*
157-
- As the inlier distribution becomes bimodal, the
158-
:class:`EllipticEnvelop` does not fit well the inliers. However,
159-
we can see that the :class:`OneClassSVM` tends to overfit:
160-
because it has not model of inliers, it interprets a region
161-
where, by chance some outliers are clustered, as inliers.
162+
- As the inlier distribution becomes bimodal, the
163+
:class:`covariance.EllipticEnvelop` does not fit well the
164+
inliers. However, we can see that the :class:`svm.OneClassSVM`
165+
tends to overfit: because it has not model of inliers, it
166+
interprets a region where, by chance some outliers are
167+
clustered, as inliers.
162168
- |outlier2|
163169

164170
*
165171
- If the inlier distribution is strongly non Gaussian, the
166-
:class:`OneClassSVM` is able to recover a reasonable
167-
approximation, whereas the :class:`EllipticEnvelop` completely
168-
fails.
172+
:class:`svm.OneClassSVM` is able to recover a reasonable
173+
approximation, whereas the :class:`covariance.EllipticEnvelop`
174+
completely fails.
169175
- |outlier3|
170176

171177
.. topic:: Examples:
172178

173-
* See :ref:`example_covariance_plot_outlier_detection.py` for a comparison
174-
of the :class:`OneClassSVM` (tuned to perform like an outlier detection
175-
method) and a covariance-based outlier detection with :class:`MinCovDet`.
179+
* See :ref:`example_covariance_plot_outlier_detection.py` for a
180+
comparison of the :class:`svm.OneClassSVM` (tuned to perform like
181+
an outlier detection method) and a covariance-based outlier
182+
detection with :class:`covariance.MinCovDet`.
176183

177184

doc/themes/scikit-learn/layout.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@
135135
{% else %}
136136
<h3>News</h3>
137137

138-
<p>scikit-learn 0.9 is available
138+
<p>scikit-learn 0.10 is available
139139
for <a href="https://sourceforge.net/projects/scikit-learn/files/">download</a>.
140140
See <a href="{{pathto('whats_new')}}">what's new</a> and tips
141141
on <a href="{{pathto('install')}}">installing</a>.</p>

0 commit comments

Comments
 (0)