[SC 16940] Fix matplotlib colormap API in statsmodels histogram tests#527
Conversation
|
Pull requests must include at least one of the required labels: |
1 similar comment
|
Pull requests must include at least one of the required labels: |
|
Pull requests must include at least one of the required labels: |
|
The matplotlib fix is correct — One thing worth discussing before merging: There's a quiet undocumented change in The |
Keep the kstest cleanup without adding an unnecessary scipy <2.0 cap, since scipy 2.0 is not currently released and the existing dependency should remain unconstrained. Co-authored-by: Cursor <cursoragent@cursor.com>
PR SummaryThis PR introduces two main sets of changes:
Overall, these changes ensure that dependency resolutions and test implementations are aligned with the new Python version requirements and modern library APIs. Test Suggestions
|
Removed scipy <2.0 dependency. |
Pull Request Description
What and why?
Replaces deprecated
matplotlib.cm.get_cmap("viridis")withmatplotlib.colormaps["viridis"]in three statsmodels visualization tests:PredictionProbabilitiesHistogramScorecardHistogramCumulativePredictionProbabilitiesBefore: Tests failed on newer matplotlib versions with
AttributeError: module 'matplotlib.cm' has no attribute 'get_cmap'.After: Colormaps are resolved via the supported matplotlib API, and the histogram tests run successfully across Python 3.9-3.14.
Additional change:
ModelPredictionResidualsKS testThis PR also updates the Kolmogorov-Smirnov normality test in
ModelPredictionResidualsfrom the string-based scipy call:to passing an explicit CDF callable:
This is equivalent for the current scipy API and produced the same statistic and p-value in local verification. It is not required for the matplotlib fix; it is included as a small cleanup to make the test more explicit and align with scipy's preferred callable-style usage.
Dependency fix for python 3.14 build
The failure comes from
shap(in the[all]extra), notscorecardpy.On Linux CI,
shapdeclaresnumbaandllvmlitewithout a minimum version. The resolver then picks the oldest compatible pair:numba==0.53.1llvmlite==0.36.0Those versions only support Python up to 3.9/3.10, so install fails on Python 3.14.
Explicit Python 3.14 floors were added in
pyproject.tomlfor the extras that pull inshap:Older Python versions (3.9–3.13) are unchanged.
How to test
Run the affected unit tests locally:
Or run the full statsmodels unit test suite if preferred.
What needs special review?
Please review the dependency notes alongside the
ModelPredictionResidualscleanup. Thekstestchange is intentional and behavior-preserving; the scipy version constraint should remain aligned with the intended compatibility policy before merge.Dependencies, breaking changes, and deployment notes
ModelPredictionResidualsRelease notes
Fixes statsmodels histogram tests that failed on newer matplotlib versions due to removal of the deprecated
cm.get_cmap()API.Checklist