Skip to content

Latest commit

 

History

History
355 lines (208 loc) · 10.3 KB

AffinityPropagation.md

File metadata and controls

355 lines (208 loc) · 10.3 KB

AffinityPropagation

Perform Affinity Propagation Clustering of data.

Read more in the User Guide.

Python Reference

Constructors

constructor()

Signature

new AffinityPropagation(opts?: object): AffinityPropagation;

Parameters

Name Type Description
opts? object -
opts.affinity? "euclidean" | "precomputed" Which affinity to use. At the moment ‘precomputed’ and euclidean are supported. ‘euclidean’ uses the negative squared euclidean distance between points. Default Value 'euclidean'
opts.convergence_iter? number Number of iterations with no change in the number of estimated clusters that stops the convergence. Default Value 15
opts.copy? boolean Make a copy of input data. Default Value true
opts.damping? number Damping factor in the range \0.5, 1.0) is the extent to which the current value is maintained relative to incoming values (weighted 1 - damping). This in order to avoid numerical oscillations when updating these values (messages). Default Value 0.5
opts.max_iter? number Maximum number of iterations. Default Value 200
opts.preference? number | [ArrayLike Preferences for each point - points with larger values of preferences are more likely to be chosen as exemplars. The number of exemplars, ie of clusters, is influenced by the input preferences value. If the preferences are not passed as arguments, they will be set to the median of the input similarities.
opts.random_state? number Pseudo-random number generator to control the starting state. Use an int for reproducible results across function calls. See the Glossary.
opts.verbose? boolean Whether to be verbose. Default Value false

Returns

AffinityPropagation

Defined in: generated/cluster/AffinityPropagation.ts:23

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/cluster/AffinityPropagation.ts:145

fit()

Fit the clustering from features, or affinity matrix.

Signature

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

Parameters

Name Type Description
opts object -
opts.X? ArrayLike[] Training instances to cluster, or similarities / affinities between instances if affinity='precomputed'. If a sparse feature matrix is provided, it will be converted into a sparse csr\_matrix.
opts.y? any Not used, present here for API consistency by convention.

Returns

Promise<any>

Defined in: generated/cluster/AffinityPropagation.ts:162

fit_predict()

Fit clustering from features/affinity matrix; return cluster labels.

Signature

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

Parameters

Name Type Description
opts object -
opts.X? ArrayLike[] Training instances to cluster, or similarities / affinities between instances if affinity='precomputed'. If a sparse feature matrix is provided, it will be converted into a sparse csr\_matrix.
opts.y? any Not used, present here for API consistency by convention.

Returns

Promise<ArrayLike>

Defined in: generated/cluster/AffinityPropagation.ts:202

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

Name Type Description
opts object -
opts.routing? any A MetadataRequest encapsulating routing information.

Returns

Promise<any>

Defined in: generated/cluster/AffinityPropagation.ts:246

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

Name Type
py PythonBridge

Returns

Promise<void>

Defined in: generated/cluster/AffinityPropagation.ts:93

predict()

Predict the closest cluster each sample in X belongs to.

Signature

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

Parameters

Name Type Description
opts object -
opts.X? ArrayLike New data to predict. If a sparse matrix is provided, it will be converted into a sparse csr\_matrix.

Returns

Promise<ArrayLike>

Defined in: generated/cluster/AffinityPropagation.ts:284

Properties

_isDisposed

boolean = false

Defined in: generated/cluster/AffinityPropagation.ts:21

_isInitialized

boolean = false

Defined in: generated/cluster/AffinityPropagation.ts:20

_py

PythonBridge

Defined in: generated/cluster/AffinityPropagation.ts:19

id

string

Defined in: generated/cluster/AffinityPropagation.ts:16

opts

any

Defined in: generated/cluster/AffinityPropagation.ts:17

Accessors

affinity_matrix_

Stores the affinity matrix used in fit.

Signature

affinity_matrix_(): Promise<ArrayLike[]>;

Returns

Promise<ArrayLike[]>

Defined in: generated/cluster/AffinityPropagation.ts:400

cluster_centers_

Cluster centers (if affinity != precomputed).

Signature

cluster_centers_(): Promise<ArrayLike[]>;

Returns

Promise<ArrayLike[]>

Defined in: generated/cluster/AffinityPropagation.ts:346

cluster_centers_indices_

Indices of cluster centers.

Signature

cluster_centers_indices_(): Promise<ArrayLike>;

Returns

Promise<ArrayLike>

Defined in: generated/cluster/AffinityPropagation.ts:319

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/cluster/AffinityPropagation.ts:481

labels_

Labels of each point.

Signature

labels_(): Promise<ArrayLike>;

Returns

Promise<ArrayLike>

Defined in: generated/cluster/AffinityPropagation.ts:373

n_features_in_

Number of features seen during fit.

Signature

n_features_in_(): Promise<number>;

Returns

Promise<number>

Defined in: generated/cluster/AffinityPropagation.ts:454

n_iter_

Number of iterations taken to converge.

Signature

n_iter_(): Promise<number>;

Returns

Promise<number>

Defined in: generated/cluster/AffinityPropagation.ts:427

py

Signature

py(): PythonBridge;

Returns

PythonBridge

Defined in: generated/cluster/AffinityPropagation.ts:80

Signature

py(pythonBridge: PythonBridge): void;

Parameters

Name Type
pythonBridge PythonBridge

Returns

void

Defined in: generated/cluster/AffinityPropagation.ts:84