The outlier_series placeholder in _transform_case_numba was hardcoded
to float64, which numba's nopython mode could not unify with the
float32 z-normalised series produced for features 13/14
(outlier_include / outlier_include_n), raising a TypingError for
any float32 input when outlier_norm=True.
Fixed by deriving the placeholder's dtype from the input series via
series[:0] / 1, matching the promotion rule _as_normalised_float
already uses elsewhere (float32 stays float32, everything else
becomes float64).
Verified against all dependent estimators: Catch22, Catch22Classifier,
Catch22Clusterer, CanonicalIntervalForestClassifier, DrCIFClassifier,
RISTClassifier, HIVECOTEV2.
Adds a regression test covering both outlier_norm=True and False on
float32 input.
Reference Issues/PRs
Closes #3724
What does this implement/fix? Explain your changes.
The
row_*functions inaeon/utils/numba/stats.py(row_mean,row_count_mean_crossing,row_count_above_mean,row_median,row_quantile25,row_quantile75,row_std,row_numba_min,row_numba_max,row_slope,row_iqr,row_ppv) allocated theiroutput array with
np.zeros(X.shape[0]), which always defaults tofloat64regardless of the input array's dtype. Forfloat32inputthis silently upcast the result to
float64, doubling memory usagefor the returned array.
This PR replaces the untyped allocation with one derived from the
input dtype, so
float32input now returnsfloat32output andfloat64input continues to returnfloat64.Also includes a cherry-picked fix for a related
numba.TypingErrorin
Catch22._transform(_outlier_include), which surfaced whileverifying this change against downstream estimators that consume
these row functions (it failed to unify
float64/float32arraysfor
outlier_series).Does your contribution introduce a new dependency? If yes, which one?
No.
Any other comments?
Added a regression test,
test_row_functions_preserve_dtype, inaeon/utils/numba/tests/test_stats.pycovering all affectedfunctions for both
float32andfloat64input.Verified no downstream regressions by running the fix against
CanonicalIntervalForestClassifier/Regressor,DrCIFClassifier/Regressor,SupervisedTimeSeriesForest,RISTClassifier,SevenNumberSummary,RandomIntervals, andSupervisedIntervals—all pass. Also ran the full
test_stats.py,interval_based, andfeature_based/catch22test suites locally(42 passed, 6 skipped as expected).