robustcov is a Python library for robust multivariate geometry when ordinary covariance is unreliable under rowwise or cellwise contamination, heavy tails, high dimensionality, or structured observations.
Different data problems require different statistical objects. Rowwise contamination may call for high-breakdown covariance estimation; heavy tails may call for robust scatter or shape; cellwise corruption requires methods that do not discard an entire row because of one bad coordinate.
The fitted geometry can then be reused in anomaly detection, monitoring, whitening, PCA, precision estimation, kernels, structured models, and related workflows.
Current release: 0.2.0 · Python: 3.12–3.14 · License: Apache-2.0
GitHub · PyPI · Documentation
python -m pip install robustcovMany multivariate methods depend on an estimated center and covariance or scatter matrix:
The appropriate estimate depends on how the data depart from the classical setting.
A useful summary is:
failure mechanism → statistical object → geometry → downstream task
Here the problem is rowwise contamination: most observations follow one distribution, while a small subset is strongly displaced.
import numpy as np
import robustcov as rc
rng = np.random.default_rng(0)
X = rng.normal(size=(400, 5))
X[:30] += 8.0
est = rc.FastMCD(
quality="balanced",
random_state=42,
).fit(X)
scores = est.mahalanobis(X)
print("robust location:", est.location_)
print("support size:", int(est.support_.sum()))
print("largest distances:", np.argsort(scores)[-10:])FastMCD is appropriate here because the contamination is concentrated in a minority of complete rows. Heavy tails, cellwise corruption, and high-dimensional data call for different estimator families.
| Problem | Typical output |
|---|---|
| Rowwise contamination | robust subset, location, covariance |
| Heavy tails | robust scatter or shape |
| (p) comparable to or larger than (n) | regularized covariance or scatter |
| Cellwise corruption | robust covariance and cell diagnostics |
| Matrix-valued observations | structured covariance factors |
| Low-rank structure | robust subspace or decomposition |
| Covariance or subspace change | drift and monitoring diagnostics |
| Distorted feature geometry | robust precision or similarity |
The package includes FastMCD, MRCD, Tyler-family estimators, Student-t and Cauchy scatter, CellMCD and CellRCov, MatrixMCD, robust PCA and decomposition methods, sparse precision tools, anomaly and monitoring utilities, and SPD geometry.
For method selection and implementation details:
The repository includes task-specific benchmarks, external-data workflows, cross-platform CI, public API checks, method-provenance metadata, and generated release evidence tied to a source revision.
The documentation reports estimator trade-offs and reproducible commands rather than treating one method as universally best.
Validation report · Examples · Releases
robustcov is most useful when a downstream task depends on covariance-shaped structure and the reference data may contain outliers, heavy tails, cellwise corruption, unstable directions, or high-dimensional ill-conditioning.
It is not intended to replace general-purpose machine-learning libraries or domain-specific validation. Robust geometry can identify unusual structure, but it does not create labels, resolve missing predictive information, or provide causal explanations.
robustcov is pre-1.0 research software. The public API is classified by stability tier, and experimental methods are kept separate from the stable public surface.