@@ -76,29 +76,29 @@ class BaseLabelPropagation(ClassifierMixin, BaseEstimator, metaclass=ABCMeta):
76
76
77
77
Parameters
78
78
----------
79
- kernel : {'knn', 'rbf', callable}
79
+ kernel : {'knn', 'rbf'} or callable, default='rbf'
80
80
String identifier for kernel function to use or the kernel function
81
81
itself. Only 'rbf' and 'knn' strings are valid inputs. The function
82
- passed should take two inputs, each of shape [ n_samples, n_features] ,
83
- and return a [ n_samples, n_samples] shaped weight matrix
82
+ passed should take two inputs, each of shape ( n_samples, n_features) ,
83
+ and return a ( n_samples, n_samples) shaped weight matrix.
84
84
85
- gamma : float
86
- Parameter for rbf kernel
85
+ gamma : float, default=20
86
+ Parameter for rbf kernel.
87
87
88
- n_neighbors : integer > 0
89
- Parameter for knn kernel
88
+ n_neighbors : int, default=7
89
+ Parameter for knn kernel. Need to be strictly positive.
90
90
91
- alpha : float
92
- Clamping factor
91
+ alpha : float, default=1.0
92
+ Clamping factor.
93
93
94
- max_iter : integer
95
- Change maximum number of iterations allowed
94
+ max_iter : int, default=30
95
+ Change maximum number of iterations allowed.
96
96
97
- tol : float
97
+ tol : float, default=1e-3
98
98
Convergence tolerance: threshold to consider the system at steady
99
- state
99
+ state.
100
100
101
- n_jobs : int or None, optional ( default=None)
101
+ n_jobs : int, default=None
102
102
The number of parallel jobs to run.
103
103
``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.
104
104
``-1`` means using all processors. See :term:`Glossary <n_jobs>`
@@ -158,11 +158,12 @@ def predict(self, X):
158
158
Parameters
159
159
----------
160
160
X : array-like of shape (n_samples, n_features)
161
+ The data matrix.
161
162
162
163
Returns
163
164
-------
164
- y : array_like, shape = [ n_samples]
165
- Predictions for input data
165
+ y : ndarray of shape ( n_samples,)
166
+ Predictions for input data.
166
167
"""
167
168
probas = self .predict_proba (X )
168
169
return self .classes_ [np .argmax (probas , axis = 1 )].ravel ()
@@ -177,12 +178,13 @@ def predict_proba(self, X):
177
178
Parameters
178
179
----------
179
180
X : array-like of shape (n_samples, n_features)
181
+ The data matrix.
180
182
181
183
Returns
182
184
-------
183
- probabilities : array, shape = [ n_samples, n_classes]
185
+ probabilities : ndarray of shape ( n_samples, n_classes)
184
186
Normalized probability distributions across
185
- class labels
187
+ class labels.
186
188
"""
187
189
check_is_fitted (self )
188
190
@@ -211,15 +213,15 @@ def fit(self, X, y):
211
213
Parameters
212
214
----------
213
215
X : array-like of shape (n_samples, n_features)
214
- A {n_samples by n_samples} size matrix will be created from this
216
+ A matrix of shape ( n_samples, n_samples) will be created from this.
215
217
216
- y : array_like, shape = [ n_samples]
217
- n_labeled_samples (unlabeled points are marked as -1)
218
- All unlabeled samples will be transductively assigned labels
218
+ y : array-like of shape ( n_samples,)
219
+ ` n_labeled_samples` (unlabeled points are marked as -1)
220
+ All unlabeled samples will be transductively assigned labels.
219
221
220
222
Returns
221
223
-------
222
- self : returns an instance of self.
224
+ self : object
223
225
"""
224
226
X , y = check_X_y (X , y )
225
227
self .X_ = X
@@ -307,43 +309,43 @@ class LabelPropagation(BaseLabelPropagation):
307
309
308
310
Parameters
309
311
----------
310
- kernel : {'knn', 'rbf', callable}
312
+ kernel : {'knn', 'rbf'} or callable, default='rbf'
311
313
String identifier for kernel function to use or the kernel function
312
314
itself. Only 'rbf' and 'knn' strings are valid inputs. The function
313
- passed should take two inputs, each of shape [ n_samples, n_features] ,
314
- and return a [ n_samples, n_samples] shaped weight matrix.
315
+ passed should take two inputs, each of shape ( n_samples, n_features) ,
316
+ and return a ( n_samples, n_samples) shaped weight matrix.
315
317
316
- gamma : float
317
- Parameter for rbf kernel
318
+ gamma : float, default=20
319
+ Parameter for rbf kernel.
318
320
319
- n_neighbors : integer > 0
320
- Parameter for knn kernel
321
+ n_neighbors : int, default=7
322
+ Parameter for knn kernel which need to be strictly positive.
321
323
322
- max_iter : integer
323
- Change maximum number of iterations allowed
324
+ max_iter : int, default=1000
325
+ Change maximum number of iterations allowed.
324
326
325
- tol : float
327
+ tol : float, 1e-3
326
328
Convergence tolerance: threshold to consider the system at steady
327
- state
329
+ state.
328
330
329
- n_jobs : int or None, optional ( default=None)
331
+ n_jobs : int, default=None
330
332
The number of parallel jobs to run.
331
333
``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.
332
334
``-1`` means using all processors. See :term:`Glossary <n_jobs>`
333
335
for more details.
334
336
335
337
Attributes
336
338
----------
337
- X_ : array, shape = [ n_samples, n_features]
339
+ X_ : ndarray of shape ( n_samples, n_features)
338
340
Input array.
339
341
340
- classes_ : array, shape = [ n_classes]
342
+ classes_ : ndarray of shape ( n_classes,)
341
343
The distinct labels used in classifying instances.
342
344
343
- label_distributions_ : array, shape = [ n_samples, n_classes]
345
+ label_distributions_ : ndarray of shape ( n_samples, n_classes)
344
346
Categorical distribution for each item.
345
347
346
- transduction_ : array, shape = [ n_samples]
348
+ transduction_ : ndarray of shape ( n_samples)
347
349
Label assigned to each item via the transduction.
348
350
349
351
n_iter_ : int
@@ -413,50 +415,50 @@ class LabelSpreading(BaseLabelPropagation):
413
415
414
416
Parameters
415
417
----------
416
- kernel : {'knn', 'rbf', callable}
418
+ kernel : {'knn', 'rbf'} or callable, default='rbf'
417
419
String identifier for kernel function to use or the kernel function
418
420
itself. Only 'rbf' and 'knn' strings are valid inputs. The function
419
- passed should take two inputs, each of shape [ n_samples, n_features] ,
420
- and return a [ n_samples, n_samples] shaped weight matrix
421
+ passed should take two inputs, each of shape ( n_samples, n_features) ,
422
+ and return a ( n_samples, n_samples) shaped weight matrix.
421
423
422
- gamma : float
423
- parameter for rbf kernel
424
+ gamma : float, default=20
425
+ Parameter for rbf kernel.
424
426
425
- n_neighbors : integer > 0
426
- parameter for knn kernel
427
+ n_neighbors : int, default=7
428
+ Parameter for knn kernel which is a strictly positive integer.
427
429
428
- alpha : float
430
+ alpha : float, default=0.2
429
431
Clamping factor. A value in (0, 1) that specifies the relative amount
430
432
that an instance should adopt the information from its neighbors as
431
433
opposed to its initial label.
432
434
alpha=0 means keeping the initial label information; alpha=1 means
433
435
replacing all initial information.
434
436
435
- max_iter : integer
436
- maximum number of iterations allowed
437
+ max_iter : int, default=30
438
+ Maximum number of iterations allowed.
437
439
438
- tol : float
440
+ tol : float, default=1e-3
439
441
Convergence tolerance: threshold to consider the system at steady
440
- state
442
+ state.
441
443
442
- n_jobs : int or None, optional ( default=None)
444
+ n_jobs : int, default=None
443
445
The number of parallel jobs to run.
444
446
``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.
445
447
``-1`` means using all processors. See :term:`Glossary <n_jobs>`
446
448
for more details.
447
449
448
450
Attributes
449
451
----------
450
- X_ : array, shape = [ n_samples, n_features]
452
+ X_ : ndarray of shape ( n_samples, n_features)
451
453
Input array.
452
454
453
- classes_ : array, shape = [ n_classes]
455
+ classes_ : ndarray of shape ( n_classes,)
454
456
The distinct labels used in classifying instances.
455
457
456
- label_distributions_ : array, shape = [ n_samples, n_classes]
458
+ label_distributions_ : ndarray of shape ( n_samples, n_classes)
457
459
Categorical distribution for each item.
458
460
459
- transduction_ : array, shape = [ n_samples]
461
+ transduction_ : ndarray of shape ( n_samples,)
460
462
Label assigned to each item via the transduction.
461
463
462
464
n_iter_ : int
0 commit comments