Perform Affinity Propagation Clustering of data.
Read more in the User Guide.
new AffinityPropagation(opts?: object): AffinityPropagation;
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 |
Defined in: generated/cluster/AffinityPropagation.ts:23
Disposes of the underlying Python resources.
Once dispose()
is called, the instance is no longer usable.
dispose(): Promise<void>;
Promise
<void
>
Defined in: generated/cluster/AffinityPropagation.ts:145
Fit the clustering from features, or affinity matrix.
fit(opts: object): Promise<any>;
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. |
Promise
<any
>
Defined in: generated/cluster/AffinityPropagation.ts:162
Fit clustering from features/affinity matrix; return cluster labels.
fit_predict(opts: object): Promise<ArrayLike>;
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. |
Promise
<ArrayLike
>
Defined in: generated/cluster/AffinityPropagation.ts:202
Get metadata routing of this object.
Please check User Guide on how the routing mechanism works.
get_metadata_routing(opts: object): Promise<any>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.routing? |
any |
A MetadataRequest encapsulating routing information. |
Promise
<any
>
Defined in: generated/cluster/AffinityPropagation.ts:246
Initializes the underlying Python resources.
This instance is not usable until the Promise
returned by init()
resolves.
init(py: PythonBridge): Promise<void>;
Name | Type |
---|---|
py |
PythonBridge |
Promise
<void
>
Defined in: generated/cluster/AffinityPropagation.ts:93
Predict the closest cluster each sample in X belongs to.
predict(opts: object): Promise<ArrayLike>;
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 . |
Promise
<ArrayLike
>
Defined in: generated/cluster/AffinityPropagation.ts:284
boolean
=false
Defined in: generated/cluster/AffinityPropagation.ts:21
boolean
=false
Defined in: generated/cluster/AffinityPropagation.ts:20
PythonBridge
Defined in: generated/cluster/AffinityPropagation.ts:19
string
Defined in: generated/cluster/AffinityPropagation.ts:16
any
Defined in: generated/cluster/AffinityPropagation.ts:17
Stores the affinity matrix used in fit
.
affinity_matrix_(): Promise<ArrayLike[]>;
Promise
<ArrayLike
[]>
Defined in: generated/cluster/AffinityPropagation.ts:400
Cluster centers (if affinity != precomputed
).
cluster_centers_(): Promise<ArrayLike[]>;
Promise
<ArrayLike
[]>
Defined in: generated/cluster/AffinityPropagation.ts:346
Indices of cluster centers.
cluster_centers_indices_(): Promise<ArrayLike>;
Promise
<ArrayLike
>
Defined in: generated/cluster/AffinityPropagation.ts:319
Names of features seen during fit. Defined only when X
has feature names that are all strings.
feature_names_in_(): Promise<ArrayLike>;
Promise
<ArrayLike
>
Defined in: generated/cluster/AffinityPropagation.ts:481
Labels of each point.
labels_(): Promise<ArrayLike>;
Promise
<ArrayLike
>
Defined in: generated/cluster/AffinityPropagation.ts:373
Number of features seen during fit.
n_features_in_(): Promise<number>;
Promise
<number
>
Defined in: generated/cluster/AffinityPropagation.ts:454
Number of iterations taken to converge.
n_iter_(): Promise<number>;
Promise
<number
>
Defined in: generated/cluster/AffinityPropagation.ts:427
py(): PythonBridge;
PythonBridge
Defined in: generated/cluster/AffinityPropagation.ts:80
py(pythonBridge: PythonBridge): void;
Name | Type |
---|---|
pythonBridge |
PythonBridge |
void
Defined in: generated/cluster/AffinityPropagation.ts:84