2026-04-25
Session 34: Fix sklearn 1.6+ squared= deprecation in regression metric registry
Engineering log for session 34.
Baseline: session 33 closed the public-surface drain. Test runs were emitting ~70 DeprecationWarnings about mean_squared_error(squared=False) per regression CV — a real bug introduced when sklearn 1.6 deprecated that path in favor of a dedicated root_mean_squared_error function. Session 34 fixes the registry.
FIXED — engine#
FIXED—packages/engine/pycaret/containers/metrics/regression.py—RMSEMetricContainer: now usessklearn.metrics.root_mean_squared_errordirectly when available, with asqrt(mse)shim fallback for sklearn < 1.6.argsdict no longer carriessquared=False. Eliminates ~7DeprecationWarningemissions per regression CV (n_folds + Mean + Std rows).FIXED—RMSLEMetricContainer— same pattern. Preferssklearn.metrics.root_mean_squared_log_errorwhen available; otherwise the existingsqrt(msle)shim withnp.abs()for negative-input safety.
ADDED — tests#
ADDED—packages/engine/tests/test_session34_metric_warnings.py— 4 tests:test_rmse_metric_does_not_use_mean_squared_error_directly— locks thescore_functo be the dedicated function (or our shim), never the deprecated reference.test_rmse_metric_args_does_not_carry_squared— ensuresargs["squared"]is gone.test_rmse_score_func_handles_kwargs_without_deprecation— calls the score_func directly withwarnings.simplefilter("error", DeprecationWarning).test_regression_cv_does_not_emit_squared_deprecation— full regressioncreate_modelunder strict warning filtering.
INTERNAL#
INTERNAL— Why a shim instead of just hard-requiring sklearn 1.6+. The 4.0 dependency floor isscikit-learn>=1.7(frompyproject.toml), so in practice the shim never runs. But it's cheap insurance: if a downstream user is on a slightly older sklearn (e.g. some numerical / scipy package pinning), they still get correct RMSE without the deprecation. Same logic for RMSLE.INTERNAL— What the deprecation was actually doing. EachDeprecationWarningwas harmless — sklearn would silently sqrt the MSE anyway and return the right value. The pollution was just to test output. But hiding deprecations would mask real ones; fixing them properly keeps the warning channel meaningful.
Session 34 delta summary#
| Metric | Session 33 end | Session 34 end |
|---|---|---|
| Engine tests (fast + slow) | 141 | 145 |
| Combined tests | 287 | 291 |
| Test-output warnings | ~500 | ~431 |