Quickstart
In this quickstart you load a public dataset, predict its labels with Kumo Tabular, and check the accuracy.
Before You Begin
- Python 3.11 or later
- About 1 GB of disk space for PyTorch and model weights
- Network access for the first run
- No GPU and no Hugging Face account are required
1. Install SDM
scikit-learn provides the example dataset.
For GPU setup and other options, see Installation.
2. Run a Classification
TableTensor.from_pandasconverts the data frame.infer_stypesassigns a semantic type to each column; the override markstargetas categorical, which makes this a classification task.KumoTabulardownloads pretrained weights.size="small"keeps the download and CPU time small; the default is"large".- The forward pass reads 300 labeled context rows and predicts the 269 query rows.
num_estimators=8averages eight randomized views of the table. The seededgeneratormakes the result reproducible. to_class_indicesaligns probability columns with the true labels by class name.
3. Check the Output
The result is a TableTensor with one probability column per class, named by class value.
Select classes by name, for example probs["1"], not by position: without a seeded generator, column order and probabilities can change between runs.
The first run prints a Hugging Face warning about unauthenticated requests. It is safe to ignore; the Kumo weights are public.
Try a Regression Task
When the target is numerical, Kumo Tabular performs regression and returns 999 quantiles named q001 to q999.
Reuse Context for Many Queries
If you score many batches against the same labeled rows, call fit once and predict per batch.
SDM caches the context side of the model, so each batch only computes the query side.
This example continues from the classification script:
The 269 query rows run in batches of 64, so the last batch of probabilities has shape torch.Size([13, 2]).
Run on a GPU
The quickstart script selects a CUDA device when PyTorch can see one, and creates its random generator on the same device.
First set up a CUDA-enabled PyTorch build as described in Set Up a GPU.
On a GPU, you can drop size="small" to use the default large model.
The random generator draws a different sequence on a GPU, so probabilities can differ slightly from the CPU output shown above.
Download the Example Notebook
Classify breast masses from four clinical features using the UCI Mammographic Mass dataset on Kumo Tabular (small).
The notebook installs its dependencies, downloads the dataset and pretrained weights, and runs without a GPU.
To run the example in Snowflake, download the Snowflake notebook. First configure Snowflake external access so the notebook can download model weights:
For import, download, device, and input errors, refer to Troubleshooting.