kumoai.encoder

View as Markdown

While Kumo automatically infers encoders based on each column’s dtype and stype, you can override the encoder for individual columns via ColumnProcessingPlan. The encoder you specify must be compatible with the column’s semantic type.


Enums

NAStrategy

Strategy for imputing missing values.

ValueDescription
ZEROFill missing values with zero.
MEANFill missing values with the column mean.
SEPARATETreat missing values as a separate category.
MOST_FREQUENTFill with the most frequent value.

Scaler

Scaling strategy for numerical features.

ValueDescription
STANDARDZ-score normalization (equivalent to scikit-learn StandardScaler).
MINMAXMin-max scaling to [0, 1] (equivalent to MinMaxScaler).
ROBUSTRobust scaling using median and IQR (equivalent to RobustScaler).

Encoders

Null

Skips encoding for the column entirely. Supported on all semantic types.

1from kumoai.encoder import Null
2
3encoder = Null()

Numerical

Encodes a numerical column with optional scaling and missing value imputation.

1from kumoai.encoder import Numerical, Scaler, NAStrategy
2
3encoder = Numerical(scaler=Scaler.STANDARD, na_strategy=NAStrategy.MEAN)
scaler
Optional[Scaler]Defaults to None

The scaling strategy. Kumo infers a suitable scaler if not specified.

na_strategy
NAStrategyDefaults to NAStrategy.MEAN

The missing value imputation strategy.


MaxLogNumerical

Applies a log transformation after clipping values at the column maximum. Useful for heavy-tailed distributions.

1from kumoai.encoder import MaxLogNumerical, NAStrategy
2
3encoder = MaxLogNumerical(na_strategy=NAStrategy.MEAN)
na_strategy
NAStrategyDefaults to NAStrategy.MEAN

The missing value imputation strategy.


MinLogNumerical

Applies a log transformation after clipping values at the column minimum.

1from kumoai.encoder import MinLogNumerical, NAStrategy
2
3encoder = MinLogNumerical(na_strategy=NAStrategy.MEAN)
na_strategy
NAStrategyDefaults to NAStrategy.MEAN

The missing value imputation strategy.


Index

Encodes a categorical or ID column as a learned embedding index. Rare values (below min_occ) are mapped to a shared out-of-vocabulary embedding.

1from kumoai.encoder import Index, NAStrategy
2
3encoder = Index(min_occ=2, na_strategy=NAStrategy.SEPARATE)
min_occ
intDefaults to 1

Minimum occurrence count for a value to receive its own embedding. Values appearing fewer times are treated as out-of-vocabulary.

na_strategy
NAStrategyDefaults to NAStrategy.SEPARATE

The missing value imputation strategy.


Hash

Encodes a categorical column via feature hashing. Suitable for very high-cardinality columns.

1from kumoai.encoder import Hash
2
3encoder = Hash(num_components=128)
num_components
intRequired

The number of hash buckets (output dimensionality).

na_strategy
NAStrategyDefaults to NAStrategy.SEPARATE

The missing value imputation strategy.


MultiCategorical

Encodes a multi-categorical column (a string containing multiple space- or comma-separated categories) as a bag-of-categories embedding.

1from kumoai.encoder import MultiCategorical
2
3encoder = MultiCategorical(min_occ=1)
min_occ
intDefaults to 1

Minimum occurrence count for a category to receive its own embedding.

na_strategy
NAStrategyDefaults to NAStrategy.ZERO

The missing value imputation strategy.


GloVe

Encodes a text column using pre-trained GloVe word embeddings.

1from kumoai.encoder import GloVe
2
3encoder = GloVe(model_name="glove.6B", embedding_dim=50)
model_name
strDefaults to glove.6B

The GloVe model identifier. Valid values: "glove.6B", "glove.42B", "glove.840B", "glove_twitter.27B".

embedding_dim
intDefaults to 50

The embedding dimensionality.

na_strategy
NAStrategyDefaults to NAStrategy.ZERO

The missing value imputation strategy.


NumericalList

Encodes a sequence or embedding column (a list of floats) with optional scaling.

1from kumoai.encoder import NumericalList
2
3encoder = NumericalList()
scaler
Optional[Scaler]Defaults to None

The scaling strategy applied to each element.

na_strategy
NAStrategyDefaults to NAStrategy.ZERO

The missing value imputation strategy.


Datetime

Encodes a timestamp column by decomposing it into cyclical calendar features. Each component is optional and enabled by default.

1from kumoai.encoder import Datetime
2
3encoder = Datetime(include_year=True, include_day_of_week=True)
include_minute
boolDefaults to True

Include the minute-of-hour component.

include_hour
boolDefaults to True

Include the hour-of-day component.

include_day_of_week
boolDefaults to True

Include the day-of-week component.

include_day_of_month
boolDefaults to True

Include the day-of-month component.

include_day_of_year
boolDefaults to True

Include the day-of-year component.

include_year
boolDefaults to True

Include the year component.

num_year_periods
Optional[int]Defaults to None

If specified, encodes year as a cyclical feature over this many periods.

na_strategy
NAStrategyDefaults to NAStrategy.ZERO

The missing value imputation strategy.