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.
Python Reference (opens in a new tab)
Constructors
constructor()
Signature
new SpectralCoclustering(opts?: object): SpectralCoclustering;
Parameters
Name | Type | Description |
---|---|---|
opts? | object | - |
opts.init? | ArrayLike [] | Method for initialization of k-means algorithm; defaults to ‘k-means++’. Default Value 'k-means++' |
opts.mini_batch? | boolean | Whether to use mini-batch k-means, which is faster but may get different results. Default Value false |
opts.n_clusters? | number | The number of biclusters to find. Default Value 3 |
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. Default Value 10 |
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 (opens in a new tab), which is more accurate, but possibly slower in some cases. Default Value 'randomized' |
Returns
Defined in: generated/cluster/SpectralCoclustering.ts:29 (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/cluster/SpectralCoclustering.ts:146 (opens in a new tab)
fit()
Create a biclustering for X.
Signature
fit(opts: object): Promise<any>;
Parameters
Name | 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:163 (opens in a new tab)
get_indices()
Row and column indices of the i
’th bicluster.
Only works if rows\_
and columns\_
attributes exist.
Signature
get_indices(opts: object): Promise<ArrayLike>;
Parameters
Name | Type | Description |
---|---|---|
opts | object | - |
opts.i? | number | The index of the cluster. |
Returns
Promise
<ArrayLike
>
Defined in: generated/cluster/SpectralCoclustering.ts:205 (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
Name | Type | Description |
---|---|---|
opts | object | - |
opts.routing? | any | A MetadataRequest encapsulating routing information. |
Returns
Promise
<any
>
Defined in: generated/cluster/SpectralCoclustering.ts:244 (opens in a new tab)
get_shape()
Shape of the i
’th bicluster.
Signature
get_shape(opts: object): Promise<number>;
Parameters
Name | Type | Description |
---|---|---|
opts | object | - |
opts.i? | number | The index of the cluster. |
Returns
Promise
<number
>
Defined in: generated/cluster/SpectralCoclustering.ts:282 (opens in a new tab)
get_submatrix()
Return the submatrix corresponding to bicluster i
.
Signature
get_submatrix(opts: object): Promise<ArrayLike[]>;
Parameters
Name | 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:319 (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
Name | Type |
---|---|
py | PythonBridge |
Returns
Promise
<void
>
Defined in: generated/cluster/SpectralCoclustering.ts:94 (opens in a new tab)
Properties
_isDisposed
boolean
=false
Defined in: generated/cluster/SpectralCoclustering.ts:27 (opens in a new tab)
_isInitialized
boolean
=false
Defined in: generated/cluster/SpectralCoclustering.ts:26 (opens in a new tab)
_py
PythonBridge
Defined in: generated/cluster/SpectralCoclustering.ts:25 (opens in a new tab)
id
string
Defined in: generated/cluster/SpectralCoclustering.ts:22 (opens in a new tab)
opts
any
Defined in: generated/cluster/SpectralCoclustering.ts:23 (opens in a new tab)
Accessors
column_labels_
The bicluster label of each column.
Signature
column_labels_(): Promise<ArrayLike>;
Returns
Promise
<ArrayLike
>
Defined in: generated/cluster/SpectralCoclustering.ts:444 (opens in a new tab)
columns_
Results of the clustering, like rows
.
Signature
columns_(): Promise<ArrayLike[]>;
Returns
Promise
<ArrayLike
[]>
Defined in: generated/cluster/SpectralCoclustering.ts:390 (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/cluster/SpectralCoclustering.ts:498 (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/cluster/SpectralCoclustering.ts:471 (opens in a new tab)
py
Signature
py(): PythonBridge;
Returns
PythonBridge
Defined in: generated/cluster/SpectralCoclustering.ts:81 (opens in a new tab)
Signature
py(pythonBridge: PythonBridge): void;
Parameters
Name | Type |
---|---|
pythonBridge | PythonBridge |
Returns
void
Defined in: generated/cluster/SpectralCoclustering.ts:85 (opens in a new tab)
row_labels_
The bicluster label of each row.
Signature
row_labels_(): Promise<ArrayLike>;
Returns
Promise
<ArrayLike
>
Defined in: generated/cluster/SpectralCoclustering.ts:417 (opens in a new tab)
rows_
Results of the clustering. rows\[i, r\]
is true
if cluster i
contains row r
. Available only after calling fit
.
Signature
rows_(): Promise<ArrayLike[]>;
Returns
Promise
<ArrayLike
[]>
Defined in: generated/cluster/SpectralCoclustering.ts:363 (opens in a new tab)