---
url: /dev/tutorials.md
description: >-
  Choose a path from related tables to a scikit-learn pipeline or relational
  model, then validate, explain and deploy it.
---

# Choose a tutorial {#tutorials}

**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](../getting-started/quickstart).

## Build a model {#the-basics}

[Describe your database](./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`](./your-own-data): 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 use | [Relational features](./relational-features) builds a transformer and puts it in a pipeline. |
| Learn which orders count toward a split | [Relational decision trees](./relational-decision-trees) fits a tree and reads its rule in terms of orders, amounts and categories. |
| Combine predictions from several relational trees | [Relational random forests](./relational-random-forests) trains a forest and examines its out-of-bag score. |
| Add shallow trees that correct each other, with early stopping or quantiles | [Relational gradient boosting](./relational-gradient-boosting) fits a boosted model and watches its loss tree by tree. |
| Group entities by what they do, without a label | [Cluster entities](./clustering) runs relational k-means and a clustering tree whose clusters read as rules. |
| Find entities whose related rows look unlike anyone else's | [Find unusual entities](./anomaly-detection) ranks them with a relational isolation forest. |

## Evaluate and interpret {#real-projects}

* [Model selection](./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](./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](./inspect-and-explain) to find which columns it reads, trace one prediction and export its rules.
* [Plot a model](./plotting) to draw the schema it reads, the fitted tree or forest, one prediction and temporal splits.

## Deploy and extend {#advanced}

[Save and deploy](./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](./custom-primitives).

## Put it together {#case-studies}

The [case studies](../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](../cookbook/).
