Skip to content

Clustering, density estimation, and anomaly detection · Biclustering · UCL037 · Algorithm

Spectral co-clustering

Partition rows and columns simultaneously as two vertex types in a bipartite graph. It suits document–term or user–item matrices with nonnegative association weights and approximately diagonal block structure after…

Runs in CodeSplash Component demo, not a trained model CodeSplash's run and the reference's record

In CodeSplash

A CodeSplash method runs this entry in Python and R. Set it up from the method's page.

Do it in CodeSplash Run it on your own data, in Python or R.

Availability
Runs in CodeSplash
Code example
Component demo, not a trained model
Who ran it
CodeSplash's run and the reference's record
CodeSplash's run
Verified in Python and R through discover.bicluster. The reference's example ran in Python and R here, and they agree.
The reference's record
Python: Ran in the reference's review. The report doesn't record which version of the code ran. R: Reviewed but not run: R wasn't available to the reference's authors.

Purpose

Partition rows and columns simultaneously as two vertex types in a bipartite graph. It suits document–term or user–item matrices with nonnegative association weights and approximately diagonal block structure after reordering.

Question / hypotheses

Which row and column groups exhibit coherent joint structure in the measurement matrix? This entry defines an estimation or optimization objective, not an intrinsic null/alternative hypothesis test.

Architecture / computational structure

A normalized bipartite matrix, SVD embedding, and joint row/column clustering.

Assumptions

Each row and column belongs to one cluster; arbitrary overlapping biclusters are outside this formulation. Negative data require a scientifically defensible transformation, not an unexamined shift.

Formula / computational definition

For nonnegative matrix AA, form A~=Dr−1/2ADc−1/2\tilde A=D_r^{-1/2}AD_c^{-1/2}, where Dr,DcD_r,D_c contain row and column sums. Singular vectors supply row and column coordinates for a shared clustering step related to bipartite normalized cuts.

Parameters and notation

Learned or fitted quantities: Row labels, column labels, and spectral coordinates. User-set hyperparameters/design choices: Choose cluster count, retained singular vectors, initialization, and treatment of zero-sum rows or columns. Tune these against the stated objective and stability/validation criteria; do not select settings on the final evaluation set.

Fitting, fine-tuning, and adaptation

Neural fine-tuning is not applicable. Refit row/column structure when new measurements change normalization. To evaluate prediction, hide entries before fitting; do not select a bicluster on all entries and then report its in-sample coherence as held-out evidence.

How to use and calibrate

Reorder the matrix and inspect block concentration, held-out association prediction, and stability of both row and column labels. Judge both sides of the bipartite partition rather than row labels alone.

Example application

Jointly organize document and term groups in a nonnegative count matrix. Define the reference population, measurement units, and success criterion before fitting; investigate whether discovered groups or alerts reflect the intended phenomenon.

Interpretation / pitfalls

Watch out

The reported result is conditional on the representation and objective. A stable partition can reflect nuisance structure such as batch, collection site, or missingness. Confirm the interpretation in original variables and an independent sample.

Python and R code examples

Python provides sklearn.cluster.SpectralCoclustering. R can implement the normalization and SVD with base matrix tools, followed by the specified joint embedding clustering, or bridge to Python for a complete documented estimator.

Component: Bipartite spectral normalization and singular values. Python: executed successfully; R: not executed (Rscript unavailable). These small fixtures establish the arithmetic operation, not full-method accuracy or reproduction of paper results.

Python and R

The reference's own programs, shown as written. A component demo shows one central piece of the method; it doesn't train a full model.

Python

Component demo, not a trained model — Bipartite spectral normalization and singular values. · needs numpy

import numpy as np
A=np.array([[4.,3.,0.],[3.,4.,1.],[0.,1.,5.]])
N=A/np.sqrt(A.sum(1)[:,None]*A.sum(0)[None,:])
result=np.linalg.svd(N,compute_uv=False)
print(result)
R

Component demo, not a trained model — Bipartite spectral normalization and singular values.

A=rbind(c(4,3,0),c(3,4,1),c(0,1,5))
N=A/sqrt(outer(rowSums(A),colSums(A))); result=svd(N)$d
print(result)

Sources

From the CodeSplash reference, entry UCL037.