cursus.processing.categorical.numerical_categorical_processor¶
Numerical Categorical Processor for Converting Numbers to Categories
This module provides atomic conversion of numerical values to categorical labels. Extracted from TSA numerical categorization requirements.
- class NumericalCategoricalProcessor(binning_strategy='equal_width', n_bins=5, bin_edges=None, thresholds=None, labels=None, columns=None)[source]¶
Bases:
ProcessorConverts numerical values to categorical labels using binning or thresholds.
Extracted from TSA str(int(float(cur_var))) conversion patterns.
- Parameters:
- fit(data)[source]¶
Learn binning parameters from data.
For
equal_width/equal_frequencythe bin edges are LEARNED here. Forcustom/thresholdthe bins come from the constructor params (bin_edges/thresholds) and there is nothing to learn — but we still validate the required param is present sois_fittedis never set True for a strategy that has no usable bins (which previously caused a silent mis-binning at transform time).