sdm-tabular-prediction
Installation
SKILL.md
Tabular prediction with SDM
Build an in-context task from labeled rows (x_context, y_context) and the features of the rows to predict (x_query). Use the requested model from sdm.models. For a new baseline, try KumoTabular if the installed version includes it. Check the model API for model-specific limits and outputs.
The package is structured-data-models and the import is sdm. Pretrained constructors can fetch weights on first use. TabFM requires acceptance of its noncommercial weights license for pretrained inference.
Prepare context and query rows
- Preserve the supplied split. When creating an evaluation split, reflect how predictions will be used, such as holding out later rows for a time-dependent task. Keep query labels for scoring and exclude the target and any features unavailable at prediction time from both feature tables.
- Select one target column. Use the
categoricalsemantic type for classification, including integer class labels, andnumericalfor regression. For classification, include the classes the model is expected to predict in the labeled context. - Infer feature semantic types on context rows and share the resulting column mapping with the query. Override ambiguous types with
sdm.infer_stypes(..., overrides=...), such as integer category codes or measurements with few distinct values. Start with the model's default recipe and fit any additional data-dependent preprocessing on context rows only.
This classification example assumes context_df and query_df are pandas DataFrames, target is the label column name, and feature_columns lists the selected features.
import torch
import sdm