> ## Documentation Index
> Fetch the complete documentation index at: https://kumo.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# kumoai.encoder

> Encoder overrides for column-level preprocessing

While Kumo automatically infers encoders based on each column's `dtype` and `stype`, you can override the encoder for individual columns via [`ColumnProcessingPlan`](/sdk/kumoai-trainer#columnprocessingplan). The encoder you specify must be compatible with the column's semantic type.

***

## Enums

### `NAStrategy`

Strategy for imputing missing values.

| Value           | Description                                  |
| --------------- | -------------------------------------------- |
| `ZERO`          | Fill missing values with zero.               |
| `MEAN`          | Fill missing values with the column mean.    |
| `SEPARATE`      | Treat missing values as a separate category. |
| `MOST_FREQUENT` | Fill with the most frequent value.           |

***

### `Scaler`

Scaling strategy for numerical features.

| Value      | Description                                                          |
| ---------- | -------------------------------------------------------------------- |
| `STANDARD` | Z-score normalization (equivalent to scikit-learn `StandardScaler`). |
| `MINMAX`   | Min-max scaling to \[0, 1] (equivalent to `MinMaxScaler`).           |
| `ROBUST`   | Robust scaling using median and IQR (equivalent to `RobustScaler`).  |

***

## Encoders

### `Null`

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

```python theme={null}
from kumoai.encoder import Null

encoder = Null()
```

***

### `Numerical`

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

```python theme={null}
from kumoai.encoder import Numerical, Scaler, NAStrategy

encoder = Numerical(scaler=Scaler.STANDARD, na_strategy=NAStrategy.MEAN)
```

<ParamField body="scaler" type="Optional[Scaler]" default="None">
  The scaling strategy. Kumo infers a suitable scaler if not specified.
</ParamField>

<ParamField body="na_strategy" type="NAStrategy" default="NAStrategy.MEAN">
  The missing value imputation strategy.
</ParamField>

***

### `MaxLogNumerical`

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

```python theme={null}
from kumoai.encoder import MaxLogNumerical, NAStrategy

encoder = MaxLogNumerical(na_strategy=NAStrategy.MEAN)
```

<ParamField body="na_strategy" type="NAStrategy" default="NAStrategy.MEAN">
  The missing value imputation strategy.
</ParamField>

***

### `MinLogNumerical`

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

```python theme={null}
from kumoai.encoder import MinLogNumerical, NAStrategy

encoder = MinLogNumerical(na_strategy=NAStrategy.MEAN)
```

<ParamField body="na_strategy" type="NAStrategy" default="NAStrategy.MEAN">
  The missing value imputation strategy.
</ParamField>

***

### `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.

```python theme={null}
from kumoai.encoder import Index, NAStrategy

encoder = Index(min_occ=2, na_strategy=NAStrategy.SEPARATE)
```

<ParamField body="min_occ" type="int" default="1">
  Minimum occurrence count for a value to receive its own embedding. Values appearing fewer times are treated as out-of-vocabulary.
</ParamField>

<ParamField body="na_strategy" type="NAStrategy" default="NAStrategy.SEPARATE">
  The missing value imputation strategy.
</ParamField>

***

### `Hash`

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

```python theme={null}
from kumoai.encoder import Hash

encoder = Hash(num_components=128)
```

<ParamField body="num_components" type="int" required>
  The number of hash buckets (output dimensionality).
</ParamField>

<ParamField body="na_strategy" type="NAStrategy" default="NAStrategy.SEPARATE">
  The missing value imputation strategy.
</ParamField>

***

### `MultiCategorical`

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

```python theme={null}
from kumoai.encoder import MultiCategorical

encoder = MultiCategorical(min_occ=1)
```

<ParamField body="min_occ" type="int" default="1">
  Minimum occurrence count for a category to receive its own embedding.
</ParamField>

<ParamField body="na_strategy" type="NAStrategy" default="NAStrategy.ZERO">
  The missing value imputation strategy.
</ParamField>

***

### `GloVe`

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

```python theme={null}
from kumoai.encoder import GloVe

encoder = GloVe(model_name="glove.6B", embedding_dim=50)
```

<ParamField body="model_name" type="str" default="glove.6B">
  The GloVe model identifier. Valid values: `"glove.6B"`, `"glove.42B"`, `"glove.840B"`, `"glove_twitter.27B"`.
</ParamField>

<ParamField body="embedding_dim" type="int" default="50">
  The embedding dimensionality.
</ParamField>

<ParamField body="na_strategy" type="NAStrategy" default="NAStrategy.ZERO">
  The missing value imputation strategy.
</ParamField>

***

### `NumericalList`

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

```python theme={null}
from kumoai.encoder import NumericalList

encoder = NumericalList()
```

<ParamField body="scaler" type="Optional[Scaler]" default="None">
  The scaling strategy applied to each element.
</ParamField>

<ParamField body="na_strategy" type="NAStrategy" default="NAStrategy.ZERO">
  The missing value imputation strategy.
</ParamField>

***

### `Datetime`

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

```python theme={null}
from kumoai.encoder import Datetime

encoder = Datetime(include_year=True, include_day_of_week=True)
```

<ParamField body="include_minute" type="bool" default="True">
  Include the minute-of-hour component.
</ParamField>

<ParamField body="include_hour" type="bool" default="True">
  Include the hour-of-day component.
</ParamField>

<ParamField body="include_day_of_week" type="bool" default="True">
  Include the day-of-week component.
</ParamField>

<ParamField body="include_day_of_month" type="bool" default="True">
  Include the day-of-month component.
</ParamField>

<ParamField body="include_day_of_year" type="bool" default="True">
  Include the day-of-year component.
</ParamField>

<ParamField body="include_year" type="bool" default="True">
  Include the year component.
</ParamField>

<ParamField body="num_year_periods" type="Optional[int]" default="None">
  If specified, encodes year as a cyclical feature over this many periods.
</ParamField>

<ParamField body="na_strategy" type="NAStrategy" default="NAStrategy.ZERO">
  The missing value imputation strategy.
</ParamField>
