Class: LabelPropagation
Label Propagation classifier.
Read more in the User Guide.
Constructors
new LabelPropagation()
new LabelPropagation(
opts?):LabelPropagation
Parameters
| Parameter | Type | Description |
|---|---|---|
opts? | object | - |
opts.gamma? | number | Parameter for rbf kernel. |
opts.kernel? | "rbf" | "knn" | String identifier for kernel function to use or the kernel function itself. Only ‘rbf’ and ‘knn’ strings are valid inputs. The function passed should take two inputs, each of shape (n_samples, n_features), and return a (n_samples, n_samples) shaped weight matrix. |
opts.max_iter? | number | Change maximum number of iterations allowed. |
opts.n_jobs? | number | The number of parallel jobs to run. undefined means 1 unless in a joblib.parallel_backend context. \-1 means using all processors. See Glossary for more details. |
opts.n_neighbors? | number | Parameter for knn kernel which need to be strictly positive. |
opts.tol? | number | Convergence tolerance: threshold to consider the system at steady state. |
Returns LabelPropagation
Defined in generated/semi_supervised/LabelPropagation.ts:23
Properties
| Property | Type | Default value | Defined in |
|---|---|---|---|
_isDisposed | boolean | false | generated/semi_supervised/LabelPropagation.ts:21 |
_isInitialized | boolean | false | generated/semi_supervised/LabelPropagation.ts:20 |
_py | PythonBridge | undefined | generated/semi_supervised/LabelPropagation.ts:19 |
id | string | undefined | generated/semi_supervised/LabelPropagation.ts:16 |
opts | any | undefined | generated/semi_supervised/LabelPropagation.ts:17 |
Accessors
classes_
Get Signature
get classes_():
Promise<ArrayLike>
The distinct labels used in classifying instances.
Returns Promise<ArrayLike>
Defined in generated/semi_supervised/LabelPropagation.ts:397
feature_names_in_
Get Signature
get feature_names_in_():
Promise<ArrayLike>
Names of features seen during fit. Defined only when X has feature names that are all strings.
Returns Promise<ArrayLike>
Defined in generated/semi_supervised/LabelPropagation.ts:505
label_distributions_
Get Signature
get label_distributions_():
Promise<ArrayLike[]>
Categorical distribution for each item.
Returns Promise<ArrayLike[]>
Defined in generated/semi_supervised/LabelPropagation.ts:424
n_features_in_
Get Signature
get n_features_in_():
Promise<number>
Number of features seen during fit.
Returns Promise<number>
Defined in generated/semi_supervised/LabelPropagation.ts:478
n_iter_
Get Signature
get n_iter_():
Promise<number>
Number of iterations run.
Returns Promise<number>
Defined in generated/semi_supervised/LabelPropagation.ts:532
py
Get Signature
get py():
PythonBridge
Returns PythonBridge
Set Signature
set py(
pythonBridge):void
Parameters
| Parameter | Type |
|---|---|
pythonBridge | PythonBridge |
Returns void
Defined in generated/semi_supervised/LabelPropagation.ts:66
transduction_
Get Signature
get transduction_():
Promise<ArrayLike>
Label assigned to each item during fit.
Returns Promise<ArrayLike>
Defined in generated/semi_supervised/LabelPropagation.ts:451
X_
Get Signature
get X_():
Promise<ArrayLike>
Input array.
Returns Promise<ArrayLike>
Defined in generated/semi_supervised/LabelPropagation.ts:372
Methods
dispose()
dispose():
Promise<void>
Disposes of the underlying Python resources.
Once dispose() is called, the instance is no longer usable.
Returns Promise<void>
Defined in generated/semi_supervised/LabelPropagation.ts:120
fit()
fit(
opts):Promise<any>
Fit a semi-supervised label propagation model to X.
Parameters
| Parameter | Type | Description |
|---|---|---|
opts | object | - |
opts.X? | ArrayLike | Training data, where n_samples is the number of samples and n_features is the number of features. |
opts.y? | ArrayLike | Target class values with unlabeled points marked as -1. All unlabeled samples will be transductively assigned labels internally, which are stored in transduction_. |
Returns Promise<any>
Defined in generated/semi_supervised/LabelPropagation.ts:137
get_metadata_routing()
get_metadata_routing(
opts):Promise<any>
Get metadata routing of this object.
Please check User Guide on how the routing mechanism works.
Parameters
| Parameter | Type | Description |
|---|---|---|
opts | object | - |
opts.routing? | any | A MetadataRequest encapsulating routing information. |
Returns Promise<any>
Defined in generated/semi_supervised/LabelPropagation.ts:178
init()
init(
py):Promise<void>
Initializes the underlying Python resources.
This instance is not usable until the Promise returned by init() resolves.
Parameters
| Parameter | Type |
|---|---|
py | PythonBridge |
Returns Promise<void>
Defined in generated/semi_supervised/LabelPropagation.ts:79
predict()
predict(
opts):Promise<ArrayLike>
Perform inductive inference across the model.
Parameters
| Parameter | Type | Description |
|---|---|---|
opts | object | - |
opts.X? | ArrayLike[] | The data matrix. |
Returns Promise<ArrayLike>
Defined in generated/semi_supervised/LabelPropagation.ts:214
predict_proba()
predict_proba(
opts):Promise<ArrayLike[]>
Predict probability for each possible outcome.
Compute the probability estimates for each single sample in X and each possible outcome seen during training (categorical distribution).
Parameters
| Parameter | Type | Description |
|---|---|---|
opts | object | - |
opts.X? | ArrayLike[] | The data matrix. |
Returns Promise<ArrayLike[]>
Defined in generated/semi_supervised/LabelPropagation.ts:250
score()
score(
opts):Promise<number>
Return the mean accuracy on the given test data and labels.
In multi-label classification, this is the subset accuracy which is a harsh metric since you require for each sample that each label set be correctly predicted.
Parameters
| Parameter | Type | Description |
|---|---|---|
opts | object | - |
opts.sample_weight? | ArrayLike | Sample weights. |
opts.X? | ArrayLike[] | Test samples. |
opts.y? | ArrayLike | True labels for X. |
Returns Promise<number>
Defined in generated/semi_supervised/LabelPropagation.ts:288
set_score_request()
set_score_request(
opts):Promise<any>
Request metadata passed to the score method.
Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config). Please see User Guide on how the routing mechanism works.
The options for each parameter are:
Parameters
| Parameter | Type | Description |
|---|---|---|
opts | object | - |
opts.sample_weight? | string | boolean | Metadata routing for sample_weight parameter in score. |
Returns Promise<any>
Defined in generated/semi_supervised/LabelPropagation.ts:336