Class: SpectralCoclustering
Spectral Co-Clustering algorithm (Dhillon, 2001).
Clusters rows and columns of an array X
to solve the relaxed normalized cut of the bipartite graph created from X
as follows: the edge between row vertex i
and column vertex j
has weight X\[i, j\]
.
The resulting bicluster structure is block-diagonal, since each row and each column belongs to exactly one bicluster.
Supports sparse matrices, as long as they are nonnegative.
Read more in the User Guide.
Constructors
new SpectralCoclustering()
new SpectralCoclustering(
opts
?):SpectralCoclustering
Parameters
Parameter | Type | Description |
---|---|---|
opts ? | object | - |
opts.init ? | ArrayLike [] | Method for initialization of k-means algorithm; defaults to ‘k-means++’. |
opts.mini_batch ? | boolean | Whether to use mini-batch k-means, which is faster but may get different results. |
opts.n_clusters ? | number | The number of biclusters to find. |
opts.n_init ? | number | Number of random initializations that are tried with the k-means algorithm. If mini-batch k-means is used, the best initialization is chosen and the algorithm runs once. Otherwise, the algorithm is run for each initialization and the best solution chosen. |
opts.n_svd_vecs ? | number | Number of vectors to use in calculating the SVD. Corresponds to ncv when svd_method=arpack and n_oversamples when svd_method is ‘randomized`. |
opts.random_state ? | number | Used for randomizing the singular value decomposition and the k-means initialization. Use an int to make the randomness deterministic. See Glossary. |
opts.svd_method ? | "randomized" | "arpack" | Selects the algorithm for finding singular vectors. May be ‘randomized’ or ‘arpack’. If ‘randomized’, use sklearn.utils.extmath.randomized_svd , which may be faster for large matrices. If ‘arpack’, use scipy.sparse.linalg.svds , which is more accurate, but possibly slower in some cases. |
Returns SpectralCoclustering
Defined in generated/cluster/SpectralCoclustering.ts:29
Properties
Property | Type | Default value | Defined in |
---|---|---|---|
_isDisposed | boolean | false | generated/cluster/SpectralCoclustering.ts:27 |
_isInitialized | boolean | false | generated/cluster/SpectralCoclustering.ts:26 |
_py | PythonBridge | undefined | generated/cluster/SpectralCoclustering.ts:25 |
id | string | undefined | generated/cluster/SpectralCoclustering.ts:22 |
opts | any | undefined | generated/cluster/SpectralCoclustering.ts:23 |
Accessors
column_labels_
Get Signature
get column_labels_():
Promise
<ArrayLike
>
The bicluster label of each column.
Returns Promise
<ArrayLike
>
Defined in generated/cluster/SpectralCoclustering.ts:427
columns_
Get Signature
get columns_():
Promise
<ArrayLike
[]>
Results of the clustering, like rows
.
Returns Promise
<ArrayLike
[]>
Defined in generated/cluster/SpectralCoclustering.ts:373
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/cluster/SpectralCoclustering.ts:481
n_features_in_
Get Signature
get n_features_in_():
Promise
<number
>
Number of features seen during fit.
Returns Promise
<number
>
Defined in generated/cluster/SpectralCoclustering.ts:454
py
Get Signature
get py():
PythonBridge
Returns PythonBridge
Set Signature
set py(
pythonBridge
):void
Parameters
Parameter | Type |
---|---|
pythonBridge | PythonBridge |
Returns void
Defined in generated/cluster/SpectralCoclustering.ts:81
row_labels_
Get Signature
get row_labels_():
Promise
<ArrayLike
>
The bicluster label of each row.
Returns Promise
<ArrayLike
>
Defined in generated/cluster/SpectralCoclustering.ts:400
rows_
Get Signature
get rows_():
Promise
<ArrayLike
[]>
Results of the clustering. rows\[i, r\]
is true
if cluster i
contains row r
. Available only after calling fit
.
Returns Promise
<ArrayLike
[]>
Defined in generated/cluster/SpectralCoclustering.ts:346
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/cluster/SpectralCoclustering.ts:137
fit()
fit(
opts
):Promise
<any
>
Create a biclustering for X.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.X ? | ArrayLike [] | Training data. |
opts.y ? | any | Not used, present for API consistency by convention. |
Returns Promise
<any
>
Defined in generated/cluster/SpectralCoclustering.ts:154
get_indices()
get_indices(
opts
):Promise
<ArrayLike
>
Row and column indices of the i
’th bicluster.
Only works if rows_
and columns_
attributes exist.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.i ? | number | The index of the cluster. |
Returns Promise
<ArrayLike
>
Defined in generated/cluster/SpectralCoclustering.ts:195
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/cluster/SpectralCoclustering.ts:233
get_shape()
get_shape(
opts
):Promise
<number
>
Shape of the i
’th bicluster.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.i ? | number | The index of the cluster. |
Returns Promise
<number
>
Defined in generated/cluster/SpectralCoclustering.ts:269
get_submatrix()
get_submatrix(
opts
):Promise
<ArrayLike
[]>
Return the submatrix corresponding to bicluster i
.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.data ? | ArrayLike [] | The data. |
opts.i ? | number | The index of the cluster. |
Returns Promise
<ArrayLike
[]>
Defined in generated/cluster/SpectralCoclustering.ts:305
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/cluster/SpectralCoclustering.ts:94