DocumentationClassesLabelPropagation

Class: LabelPropagation

Label Propagation classifier.

Read more in the User Guide.

Python Reference

Constructors

new LabelPropagation()

new LabelPropagation(opts?): LabelPropagation

Parameters

ParameterTypeDescription
opts?object-
opts.gamma?numberParameter 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?numberChange maximum number of iterations allowed.
opts.n_jobs?numberThe 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?numberParameter for knn kernel which need to be strictly positive.
opts.tol?numberConvergence tolerance: threshold to consider the system at steady state.

Returns LabelPropagation

Defined in generated/semi_supervised/LabelPropagation.ts:23

Properties

PropertyTypeDefault valueDefined in
_isDisposedbooleanfalsegenerated/semi_supervised/LabelPropagation.ts:21
_isInitializedbooleanfalsegenerated/semi_supervised/LabelPropagation.ts:20
_pyPythonBridgeundefinedgenerated/semi_supervised/LabelPropagation.ts:19
idstringundefinedgenerated/semi_supervised/LabelPropagation.ts:16
optsanyundefinedgenerated/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

ParameterType
pythonBridgePythonBridge

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

ParameterTypeDescription
optsobject-
opts.X?ArrayLikeTraining data, where n_samples is the number of samples and n_features is the number of features.
opts.y?ArrayLikeTarget 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

ParameterTypeDescription
optsobject-
opts.routing?anyA 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

ParameterType
pyPythonBridge

Returns Promise<void>

Defined in generated/semi_supervised/LabelPropagation.ts:79


predict()

predict(opts): Promise<ArrayLike>

Perform inductive inference across the model.

Parameters

ParameterTypeDescription
optsobject-
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

ParameterTypeDescription
optsobject-
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

ParameterTypeDescription
optsobject-
opts.sample_weight?ArrayLikeSample weights.
opts.X?ArrayLike[]Test samples.
opts.y?ArrayLikeTrue 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

ParameterTypeDescription
optsobject-
opts.sample_weight?string | booleanMetadata routing for sample_weight parameter in score.

Returns Promise<any>

Defined in generated/semi_supervised/LabelPropagation.ts:336