Skip to content

Clustering, density estimation, and anomaly detection · Graph and community clustering · UCL035 · Model

Degree-corrected stochastic block model

Separate community structure from heterogeneous vertex activity by adding node-specific degree propensities. It is useful when an ordinary SBM groups hubs together mainly because they have many edges.

Runs in CodeSplash (Experimental) 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. The methods that run it are Experimental.

Do it in CodeSplash Run it on your own data. It's in the Experimental lane in the app.

Availability
Runs in CodeSplash (Experimental)
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.sbm. 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

Separate community structure from heterogeneous vertex activity by adding node-specific degree propensities. It is useful when an ordinary SBM groups hubs together mainly because they have many edges.

Question / hypotheses

Which partition or latent block structure best explains the supplied graph relationships? This entry defines an estimation or optimization objective, not an intrinsic null/alternative hypothesis test.

Architecture / computational structure

Latent blocks plus node activity propensities and a block intensity matrix.

Assumptions

Extra flexibility can absorb degree heterogeneity but also overfit small groups. A Poisson multigraph model is not identical to a Bernoulli simple-graph model.

Formula / computational definition

A common undirected Poisson formulation uses Aij∼Poisson⁡(θiθjωzi,zj)A_{ij}\sim\operatorname{Poisson}(\theta_i\theta_j\omega_{z_i,z_j}) for i<ji<j. Parameters θi>0\theta_i>0 control node degree propensity and ωab\omega_{ab} controls block interaction. An identifiability constraint such as ∑i:zi=aθi=1\sum_{i:z_i=a}\theta_i=1 is required; self-loop conventions need separate treatment.

Parameters and notation

Learned or fitted quantities: Block labels, node degree propensities, and block interaction intensities. User-set hyperparameters/design choices: Choose block count or prior, degree correction, edge multiplicity model, and inference budget. 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 after material edge or weight changes and compare several initializations. Warm-starting a partition can help computation but may preserve an obsolete solution; use the same graph construction when comparing versions.

How to use and calibrate

Compare with ordinary SBM using appropriate complexity penalties or held-out prediction. Inspect posterior predictive degree distributions, block interaction matrices, and stability. Degree correction should improve the intended structural explanation rather than merely training likelihood.

Example application

Recover network communities while allowing hubs inside every community. 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 graph-tool supports degree-corrected block states. R can bridge to Python or implement the constrained likelihood; do not assume every R SBM package includes this exact family. The component code evaluates Poisson edge intensities for supplied parameters.

Component: Degree-corrected SBM edge intensities. 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 — Degree-corrected SBM edge intensities. · needs numpy

import numpy as np
theta=np.array([.3,.7,1.]); z=np.array([0,0,1]); omega=np.array([[4.,.5],[.5,2.]])
result=np.outer(theta,theta)*omega[z[:,None],z]
np.fill_diagonal(result,0) # this demonstration excludes self-loops
print(result)
R

Component demo, not a trained model — Degree-corrected SBM edge intensities.

theta=c(.3,.7,1); z=c(1,1,2); omega=rbind(c(4,.5),c(.5,2))
result=outer(theta,theta)*omega[z,z]; diag(result)=0
print(result)

Sources

From the CodeSplash reference, entry UCL035.