Skip to content

Choose a tutorial ​

Start with the table that identifies one prediction. Once its keys are in place, you can compute features for a pipeline or train a tree directly on the related records. For a first run with bundled data, use the shop quickstart.

Build a model ​

Describe your database first. You will define which key identifies each row and check that child records point to a parent. Then turn your own tables into X and y: one row per prediction, a cutoff date (the date each prediction is made) when it applies, and a label computed from what happens next. Then choose the example that matches your model.

If you want to…Start here
Add an entity's related history, such as a customer's orders, to a model you already useRelational features builds a transformer and puts it in a pipeline.
Learn which orders count toward a splitRelational decision trees fits a tree and reads its rule in terms of orders, amounts and categories.
Combine predictions from several relational treesRelational random forests trains a forest and examines its out-of-bag score.
Add shallow trees that correct each other, with early stopping or quantilesRelational gradient boosting fits a boosted model and watches its loss tree by tree.
Group entities by what they do, without a labelCluster entities runs relational k-means and a clustering tree whose clusters read as rules.
Find entities whose related rows look unlike anyone else'sFind unusual entities ranks them with a relational isolation forest.

Evaluate and interpret ​

  • Model selection shows how to choose a splitter and tune a model. Group by entity when you need to test on entities the model has never seen.
  • Time and cutoffs is for predictions made as of a date. Use it when later orders exist in the database but would have been unknown at prediction time.
  • Inspect a fitted model to find which columns it reads, trace one prediction and export its rules.
  • Plot a model to draw the schema it reads, the fitted tree or forest, one prediction and temporal splits.

Deploy and extend ​

Save and deploy explains how to store the fitted model and attach a compatible database for prediction. If you need an aggregation outside the built-in set, write a custom primitive.

Put it together ​

The case studies solve complete problems: churn from usage and support tickets, a cost-based decision with scikit-learn's ensembles and threshold tuning, forecasts with calibrated intervals, and segments and anomalies without labels.

For a short, self-contained answer to a particular task, browse the cookbook.

Released under the MIT License.