Documentation
Classes
LabelPropagation

LabelPropagation

Label Propagation classifier.

Read more in the User Guide.

Python Reference (opens in a new tab)

Constructors

constructor()

Signature

new LabelPropagation(opts?: object): LabelPropagation;

Parameters

NameTypeDescription
opts?object-
opts.gamma?numberParameter for rbf kernel. Default Value 20
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. Default Value 'rbf'
opts.max_iter?numberChange maximum number of iterations allowed. Default Value 1000
opts.n_jobs?numberThe number of parallel jobs to run. undefined means 1 unless in a joblib.parallel\_backend (opens in a new tab) context. \-1 means using all processors. See Glossary for more details.
opts.n_neighbors?numberParameter for knn kernel which need to be strictly positive. Default Value 7
opts.tol?numberConvergence tolerance: threshold to consider the system at steady state.

Returns

LabelPropagation

Defined in: generated/semi_supervised/LabelPropagation.ts:23 (opens in a new tab)

Methods

dispose()

Disposes of the underlying Python resources.

Once dispose() is called, the instance is no longer usable.

Signature

dispose(): Promise<void>;

Returns

Promise<void>

Defined in: generated/semi_supervised/LabelPropagation.ts:125 (opens in a new tab)

fit()

Fit a semi-supervised label propagation model to X.

Signature

fit(opts: object): Promise<any>;

Parameters

NameTypeDescription
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:142 (opens in a new tab)

get_metadata_routing()

Get metadata routing of this object.

Please check User Guide on how the routing mechanism works.

Signature

get_metadata_routing(opts: object): Promise<any>;

Parameters

NameTypeDescription
optsobject-
opts.routing?anyA MetadataRequest encapsulating routing information.

Returns

Promise<any>

Defined in: generated/semi_supervised/LabelPropagation.ts:186 (opens in a new tab)

init()

Initializes the underlying Python resources.

This instance is not usable until the Promise returned by init() resolves.

Signature

init(py: PythonBridge): Promise<void>;

Parameters

NameType
pyPythonBridge

Returns

Promise<void>

Defined in: generated/semi_supervised/LabelPropagation.ts:79 (opens in a new tab)

predict()

Perform inductive inference across the model.

Signature

predict(opts: object): Promise<ArrayLike>;

Parameters

NameTypeDescription
optsobject-
opts.X?ArrayLike[]The data matrix.

Returns

Promise<ArrayLike>

Defined in: generated/semi_supervised/LabelPropagation.ts:223 (opens in a new tab)

predict_proba()

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).

Signature

predict_proba(opts: object): Promise<ArrayLike[]>;

Parameters

NameTypeDescription
optsobject-
opts.X?ArrayLike[]The data matrix.

Returns

Promise<ArrayLike[]>

Defined in: generated/semi_supervised/LabelPropagation.ts:260 (opens in a new tab)

score()

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.

Signature

score(opts: object): Promise<number>;

Parameters

NameTypeDescription
optsobject-
opts.X?ArrayLike[]Test samples.
opts.sample_weight?ArrayLikeSample weights.
opts.y?ArrayLikeTrue labels for X.

Returns

Promise<number>

Defined in: generated/semi_supervised/LabelPropagation.ts:299 (opens in a new tab)

set_score_request()

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:

Signature

set_score_request(opts: object): Promise<any>;

Parameters

NameTypeDescription
optsobject-
opts.sample_weight?string | booleanMetadata routing for sample\_weight parameter in score.

Returns

Promise<any>

Defined in: generated/semi_supervised/LabelPropagation.ts:352 (opens in a new tab)

Properties

_isDisposed

boolean = false

Defined in: generated/semi_supervised/LabelPropagation.ts:21 (opens in a new tab)

_isInitialized

boolean = false

Defined in: generated/semi_supervised/LabelPropagation.ts:20 (opens in a new tab)

_py

PythonBridge

Defined in: generated/semi_supervised/LabelPropagation.ts:19 (opens in a new tab)

id

string

Defined in: generated/semi_supervised/LabelPropagation.ts:16 (opens in a new tab)

opts

any

Defined in: generated/semi_supervised/LabelPropagation.ts:17 (opens in a new tab)

Accessors

X_

Input array.

Signature

X_(): Promise<ArrayLike>;

Returns

Promise<ArrayLike>

Defined in: generated/semi_supervised/LabelPropagation.ts:390 (opens in a new tab)

classes_

The distinct labels used in classifying instances.

Signature

classes_(): Promise<ArrayLike>;

Returns

Promise<ArrayLike>

Defined in: generated/semi_supervised/LabelPropagation.ts:415 (opens in a new tab)

feature_names_in_

Names of features seen during fit. Defined only when X has feature names that are all strings.

Signature

feature_names_in_(): Promise<ArrayLike>;

Returns

Promise<ArrayLike>

Defined in: generated/semi_supervised/LabelPropagation.ts:523 (opens in a new tab)

label_distributions_

Categorical distribution for each item.

Signature

label_distributions_(): Promise<ArrayLike[]>;

Returns

Promise<ArrayLike[]>

Defined in: generated/semi_supervised/LabelPropagation.ts:442 (opens in a new tab)

n_features_in_

Number of features seen during fit.

Signature

n_features_in_(): Promise<number>;

Returns

Promise<number>

Defined in: generated/semi_supervised/LabelPropagation.ts:496 (opens in a new tab)

n_iter_

Number of iterations run.

Signature

n_iter_(): Promise<number>;

Returns

Promise<number>

Defined in: generated/semi_supervised/LabelPropagation.ts:550 (opens in a new tab)

py

Signature

py(): PythonBridge;

Returns

PythonBridge

Defined in: generated/semi_supervised/LabelPropagation.ts:66 (opens in a new tab)

Signature

py(pythonBridge: PythonBridge): void;

Parameters

NameType
pythonBridgePythonBridge

Returns

void

Defined in: generated/semi_supervised/LabelPropagation.ts:70 (opens in a new tab)

transduction_

Label assigned to each item during fit.

Signature

transduction_(): Promise<ArrayLike>;

Returns

Promise<ArrayLike>

Defined in: generated/semi_supervised/LabelPropagation.ts:469 (opens in a new tab)