Encoder Selection
Start with Kumo’s inferred encoders. Override a column only when it needs a specific transformation or feature representation.
First, check each column’s semantic type (stype): an integer category needs "categorical", not "numerical".
Kumo selects encoders from semantic types and column statistics, so an explicit constructor can replace a useful inferred configuration.
An override changes the encoding, not the semantic type or the graph’s relationships.
Set column types as described in Define Tables, then continue to Build a Graph.
Apply optional encoder overrides through plan.column_processing before training.
The examples on this page assume you have created a plan as shown in the Model Plan Guide.
How Encoders Build a Node
Each feature column passes through one encoder, and every encoder outputs a vector of the same width, the model’s channel count.
Kumo adds a row’s vectors together, rather than concatenating them, and applies the activation function chosen by the model search (ReLU, LeakyReLU, ELU, or GELU) to form the node’s initial representation.
Text columns are the exception to one vector per column: Kumo averages the word vectors of all of a row’s text columns together before one learned projection.
For a temporal task, timestamp columns also contribute the time elapsed before the anchor.
Primary and foreign keys are not features: they place the row in the graph and connect it to related rows.
Null() excludes a column from the features without removing any relationship.
The following diagram shows how column encoders contribute to a node’s initial representation.
Vector cells are illustrative. Each column’s encoding has the model’s channel width. The sum passes through the trial’s activation, and message passing then updates the result with information from the brand and orders.
Supported Encoders
Import encoders from kumoapi.encoder and Stype from kumoapi.typing.
The following table lists the inferred encoder choices for each semantic type and when to consider an override:
ID is uppercase. The preceding table lists the compatible encoders for each type. Null is also available for every type.
Constructor defaults in the following tables describe explicit instances, not the configuration that Kumo infers.
Image encoding is not part of this guide’s supported input types.
Numerical Encoders
The following table lists the arguments and defaults for explicit numerical encoder instances:
The logarithmic encoders compress a long tail on the corresponding side of the distribution.
They do not accept a scaler argument.
The legacy "raise" missing-value setting is retained for compatibility. Do not use it in new plans.
Categorical and ID Encoders
The following table lists the arguments and defaults for explicit Index and Hash instances:
Both encoders look up a learned row for each value.
Index gives every category that meets min_occ its own row.
Hash assigns categories to num_components rows by their frequency rank, so several categories share a row.
num_components sets the number of rows, not their width. The model’s channel count sets the width.
With the default na_strategy="separate", a null value or a value absent from the column statistics uses one extra missing-value row.
Hash does not accept min_occ or na_strategy="zero".
Because buckets follow frequency rank, the brands that share a row depend on the column statistics. num_components=4 is a teaching value. Inferred plans use far more rows.
The following example caps hashing at 4,096 buckets for a categorical products.brand column. That count is illustrative, not an inferred or optimal value.
Multicategorical Encoder
The following table lists the arguments and defaults for an explicit MultiCategorical instance:
Kumo processes each category in the value and combines the results.
Kumo infers the separator from column statistics. MultiCategorical does not accept a sep argument.
Sequence and Embedding Encoder
Use NumericalList for stype="sequence", including vectors computed outside Kumo.
The following table lists the NumericalList arguments and defaults:
These scaler choices differ from Numerical: "minmax" and "robust" are not sequence scaler options.
Timestamp Encoder
Datetime extracts calendar features from stype="timestamp" columns.
The following table lists the Datetime arguments and defaults:
Text Encoder
Use TextEmbedding for columns with stype="text", such as product descriptions and reviews.
It looks up pretrained vectors for recognized words in each cell and averages them into a feature vector.
It ignores unknown words. Missing cells and cells with no recognized words produce a zero vector.
The following table lists the TextEmbedding arguments and defaults:
Text Embedding Models
The default model is GloVe 6B with 50 dimensions. Add its vector package to the Python environment where Kumo Engine runs:
Use the package index configured during environment setup.
That index must provide compatible builds of both Kumo Engine and its optional kumo-glove-6b-50d dependency.
Kumo Engine does not download word vectors during training.
Automatic encoder selection can choose Null() to exclude text columns whose values are too short or contain too few recognized words.
To encode products.description explicitly, merge a text override into your plan before constructing the trainer:
Replace products.description with a text column in your graph.
If training reports a missing embedding model, install its vector package or register it as described in the following sections.
To exclude the column instead, use Null() in its encoder override.
Only columns that use TextEmbedding require word vectors.
Use Another GloVe Model
Use another vector vocabulary when it better matches your text. Retain the default when you have no specific alternative to evaluate.
Download and register another GloVe model
Download one of the supported original GloVe release archives from the GloVe project.
Pass the unchanged .zip file to GloVeVectors. It also accepts a directory of previously converted files.
The following table lists the supported archives and their dimensions:
For example, download glove.42B.300d.zip, replace the path in the following example with its local path, and register it as "descriptions":
The registration name is your choice and must match the encoder’s model value.
Installed models, including the default from the text extra, are also available in the store.
An archive is converted on first use into ~/.cache/kumo/embeddings.
Pass a writable cache_dir= to GloVeVectors to use another directory, and keep the model files accessible to training and prediction workers.
Reload a Trained Text Model
A saved model still needs the word vectors used during training. For the default model, keep the text package installed in the prediction environment. For a registered model, recreate the store with the same vectors and pass it when loading:
Replace bundle_dir with your saved model bundle directory.
Kumo matches the vectors by model identity, so the registration name can change but the vectors and tokenization must match.
Custom Word Vectors
Use custom vectors when you already have a vocabulary and embeddings suited to your text. Keep an installed model when you do not need a custom vocabulary or tokenizer.
Implement a custom token embedding model
To register your own word vectors, implement the TokenEmbeddingModel interface in an importable Python module.
The following two vectors only illustrate the protocol. They are not a useful pretrained language model.
Save the following code as example_vectors.py in your application package, available to every training and prediction worker:
The vocabulary order matches the vector rows. vectors() returns a float32 matrix with shape (vocabulary_size, dim).
For each input cell, tokenize() returns its vocabulary row indices between consecutive rowptr offsets.
Unknown words and null cells contribute no tokens.
For pd.Series(["Red shoe", None, "sock"]), this example returns rowptr=[0, 2, 2, 2] and rows=[0, 1].
Register the importable model and merge the text override into your existing plan:
Use the products.description column from the preceding example or replace it with a text column in your graph.
Keep the module importable after restart. Defining the class only in a notebook does not make it available to worker processes.
For large models, load vectors lazily from accessible files instead of storing them all in the pickled object.
The model identity includes its family, dimension, and fingerprint.
Update the fingerprint whenever vectors, vocabulary order, or tokenization behavior changes.
When you load a saved model, supply the same model identity through Trainer.load(bundle_dir, embedding_models=store).
Changing the registration name alone does not change that identity.
Encoder Overrides
Set encoder_overrides to a dictionary of case-sensitive "table.column" names and encoder instances.
Use the table names in your graph, not a warehouse’s fully qualified table path.
Leave it as None to retain inferred encoders.
The following example sets overrides for a graph containing products.price, products.category, and products.description, with semantic types numerical, categorical, and text, respectively:
This configuration scales prices, imputes missing prices with zero, groups rare categories as missing, and excludes descriptions from input features. Assigning this dictionary replaces any earlier encoder overrides. To retain earlier overrides, merge them into the new dictionary.
Transform a Regression Target
Use the special key "train_table.TARGET" to override the generated target encoder.
This key controls the value that the model learns to predict, rather than an input feature such as products.price.
The following example transforms a scalar numerical regression target with a long upper tail:
Pass this plan to Trainer before fitting your regression training table.
The transform uses log(x - min + 1), where min comes from the target statistics.
The transform clamps values below that fitted minimum to the same transformed value as the minimum, so decoding cannot recover those lower values.
Kumo reverses the target transform when producing regression predictions, so TARGET_PRED is in the original target units. Do not exponentiate it again.
Keep the saved model’s target encoder when reloading. This example does not apply to categorical, list, or forecasting targets, and a logarithmic transform does not guarantee better predictions.
Missing Values
Set plan.column_processing.na_strategy to choose missing-value defaults by semantic type.
Kumo applies each default to compatible inferred feature encoders of that type.
Leave a type out of the dictionary to keep its inferred strategy.
Use encoder_overrides for column-specific exceptions.
Before constructing Trainer(plan), the following example sets numerical features to zero imputation while using mean imputation for products.price:
Replace products.price with a numerical column in your graph.
The dictionary merge preserves other encoder overrides. The na_strategy assignment replaces any earlier type-wide defaults.
Choose strategies supported by the semantic type and encoder:
Precedence
A per-column override replaces the inferred encoder, including its missing-value configuration.
The type-wide default does not apply to a column with an explicit override.
If you omit na_strategy from an explicit Numerical() instance, it uses "mean" even when the type-wide numerical default is "zero".
A warm start reuses the source checkpoint’s fitted encoders ahead of both settings. Changing the destination plan’s missing-value defaults or overrides does not replace those fitted encoders. Use a fresh training run to fit different encoders.
Unsupported Strategies
An invalid combination of semantic type and strategy, such as "most_frequent" for Stype.numerical, fails model plan validation.
Assignment to the public plan alone does not establish that the combination is valid.
Use the supported values in the preceding encoder tables.
A strategy can be valid for a semantic type but unsupported by a particular inferred encoder.
For example, Stype.categorical: "zero" works with Index, but an inferred Hash encoder keeps its default strategy and emits a warning naming the column and allowed strategies.
Choose one of those strategies or use a compatible explicit encoder override.
Encoders without a missing-value option, such as Null, stay unchanged without this warning.
Check Your Configuration
Inspect plan.as_json() before passing the plan to Trainer.
Encoder constructors reject unsupported arguments and invalid option values.
During plan validation, Kumo checks that override columns exist and that each encoder supports the column’s semantic type.
If it reports an invalid column name, use the case-sensitive table and column names in the graph.
If it reports an incompatible encoder, correct the semantic type or select a compatible encoder from the Supported Encoders table.
For a missing text model, install the text extra, register the required model, or exclude the affected text column with Null().
When your graph snapshot and plan are ready, continue to Train a Model. Refer to the Model Plan Guide.