← Lab
cdintercept
confirmedupstream bugPython · pyodSystems & data structuresJuly 25, 2026
the question
Does pyod's CD detector compute Cook's distance leverage consistently with its intercept-fitted regression?
what came out
pyod's _Cooks_dist computes leverage from X alone while LinearRegression fits [1, X], so leverages sum to n_predictors not n_predictors+1. The top outlier's Cook's distance is understated 10x (0.1915 vs 1.9321) and the CD ranking reorders; fit_intercept=False matches statsmodels.
method & receipts
- Result: confirmed
- Reproducible — one script re-runs the whole thing from scratch.
- Tested — a correctness/benchmark suite ships alongside the code.
→ read the code and re-run it
github.com/v-code01/cdintercept