Skip to content

Commit 786eeb7

Browse files
abhishek-janathomasjpfan
authored andcommitted
DOC Documented attributes in QuadraticDiscriminantAnalysis, RadiusNeighborsClassifier and KNeighborsClassifier, (#14374)
1 parent aa4f313 commit 786eeb7

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

sklearn/discriminant_analysis.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,9 @@ class QuadraticDiscriminantAnalysis(BaseEstimator, ClassifierMixin):
611611
of the Gaussian distributions along its principal axes, i.e. the
612612
variance in the rotated coordinate system.
613613
614+
classes_ : array-like, shape (n_classes,)
615+
Unique class labels.
616+
614617
Examples
615618
--------
616619
>>> from sklearn.discriminant_analysis import QuadraticDiscriminantAnalysis

sklearn/neighbors/classification.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,26 @@ class KNeighborsClassifier(NeighborsBase, KNeighborsMixin,
8282
for more details.
8383
Doesn't affect :meth:`fit` method.
8484
85+
Attributes
86+
----------
87+
classes_ : array of shape = (n_classes,)
88+
Class labels known to the classifier
89+
90+
effective_metric_ : string or callble
91+
The distance metric used. It will be same as the `metric` parameter
92+
or a synonym of it, e.g. 'euclidean' if the `metric` parameter set to
93+
'minkowski' and `p` parameter set to 2.
94+
95+
effective_metric_params_ : dict
96+
Additional keyword arguments for the metric function. For most metrics
97+
will be same with `metric_params` parameter, but may also contain the
98+
`p` parameter value if the `effective_metric_` attribute is set to
99+
'minkowski'.
100+
101+
outputs_2d_ : bool
102+
False when `y`'s shape is (n_samples, ) or (n_samples, 1) during fit
103+
otherwise True.
104+
85105
Examples
86106
--------
87107
>>> X = [[0], [1], [2], [3]]
@@ -296,6 +316,26 @@ class RadiusNeighborsClassifier(NeighborsBase, RadiusNeighborsMixin,
296316
``-1`` means using all processors. See :term:`Glossary <n_jobs>`
297317
for more details.
298318
319+
Attributes
320+
----------
321+
classes_ : array of shape = (n_classes,)
322+
Class labels known to the classifier.
323+
324+
effective_metric_ : string or callble
325+
The distance metric used. It will be same as the `metric` parameter
326+
or a synonym of it, e.g. 'euclidean' if the `metric` parameter set to
327+
'minkowski' and `p` parameter set to 2.
328+
329+
effective_metric_params_ : dict
330+
Additional keyword arguments for the metric function. For most metrics
331+
will be same with `metric_params` parameter, but may also contain the
332+
`p` parameter value if the `effective_metric_` attribute is set to
333+
'minkowski'.
334+
335+
outputs_2d_ : bool
336+
False when `y`'s shape is (n_samples, ) or (n_samples, 1) during fit
337+
otherwise True.
338+
299339
Examples
300340
--------
301341
>>> X = [[0], [1], [2], [3]]

0 commit comments

Comments
 (0)