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

Skip to content

Commit 0a7e9ee

Browse files
authored
DOC Ensures that NuSVC passes numpydoc validation (#20461)
1 parent 137bfb3 commit 0a7e9ee

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

maint_tools/test_docstrings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@
8282
"NearestCentroid",
8383
"NeighborhoodComponentsAnalysis",
8484
"Normalizer",
85-
"NuSVC",
8685
"NuSVR",
8786
"Nystroem",
8887
"OAS",

sklearn/svm/_classes.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@ class NuSVC(BaseSVC):
823823
SVC. If not given, all classes are supposed to have
824824
weight one. The "balanced" mode uses the values of y to automatically
825825
adjust weights inversely proportional to class frequencies as
826-
``n_samples / (n_classes * np.bincount(y))``
826+
``n_samples / (n_classes * np.bincount(y))``.
827827
828828
verbose : bool, default=False
829829
Enable verbose output. Note that this setting takes advantage of a
@@ -927,20 +927,6 @@ class NuSVC(BaseSVC):
927927
shape_fit_ : tuple of int of shape (n_dimensions_of_X,)
928928
Array dimensions of training vector ``X``.
929929
930-
Examples
931-
--------
932-
>>> import numpy as np
933-
>>> X = np.array([[-1, -1], [-2, -1], [1, 1], [2, 1]])
934-
>>> y = np.array([1, 1, 2, 2])
935-
>>> from sklearn.pipeline import make_pipeline
936-
>>> from sklearn.preprocessing import StandardScaler
937-
>>> from sklearn.svm import NuSVC
938-
>>> clf = make_pipeline(StandardScaler(), NuSVC())
939-
>>> clf.fit(X, y)
940-
Pipeline(steps=[('standardscaler', StandardScaler()), ('nusvc', NuSVC())])
941-
>>> print(clf.predict([[-0.8, -1]]))
942-
[1]
943-
944930
See Also
945931
--------
946932
SVC : Support Vector Machine for classification using libsvm.
@@ -956,6 +942,20 @@ class NuSVC(BaseSVC):
956942
.. [2] `Platt, John (1999). "Probabilistic outputs for support vector
957943
machines and comparison to regularizedlikelihood methods."
958944
<http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.41.1639>`_
945+
946+
Examples
947+
--------
948+
>>> import numpy as np
949+
>>> X = np.array([[-1, -1], [-2, -1], [1, 1], [2, 1]])
950+
>>> y = np.array([1, 1, 2, 2])
951+
>>> from sklearn.pipeline import make_pipeline
952+
>>> from sklearn.preprocessing import StandardScaler
953+
>>> from sklearn.svm import NuSVC
954+
>>> clf = make_pipeline(StandardScaler(), NuSVC())
955+
>>> clf.fit(X, y)
956+
Pipeline(steps=[('standardscaler', StandardScaler()), ('nusvc', NuSVC())])
957+
>>> print(clf.predict([[-0.8, -1]]))
958+
[1]
959959
"""
960960

961961
_impl = "nu_svc"

0 commit comments

Comments
 (0)