---
url: /blog/scikit-link-0-1-0.md
description: >-
  The first release of scikit-link: features, trees, forests, gradient boosting,
  clustering and anomaly detection on related tables, with the scikit-learn API.
---

# scikit-link 0.1.0 is out

**scikit-link 0.1.0, the first release, is on PyPI. It trains scikit-learn
models when the data is in several tables linked by keys, such as customers
and their orders, patients and their visits, or machines and their sensor
readings, without building a flat feature table by hand.**

```bash
pip install "scikit-link[pandas]"
```

The [introduction](./introducing-scikit-link) explains why we built it. This
post is about what the release contains and where to start.

## A first model in a few lines

`make_relational_classification` generates a database of customers, orders,
order items and products, and a label hidden in the orders. A relational
tree finds that rule, and a featurizer feeds the same tables to any
scikit-learn model.

```python
from sklearn.ensemble import HistGradientBoostingClassifier
from sklearn.model_selection import cross_val_score
from sklearn.pipeline import make_pipeline
from sklink.datasets import make_relational_classification
from sklink.feature_extraction import RelationalFeaturizer
from sklink.inspection import export_text
from sklink.tree import RelationalDecisionTreeClassifier

db, X, y = make_relational_classification(1000, signal="conditional", random_state=0)
common = {"entity": "customers", "key": "customer_id"}

tree = RelationalDecisionTreeClassifier(db, max_depth=2, **common).fit(X, y)
print(export_text(tree))

pipe = make_pipeline(
    RelationalFeaturizer(db, **common), HistGradientBoostingClassifier()
)
print(f"accuracy {cross_val_score(pipe, X, y, cv=5).mean():.3f}")
```

```text
|--- exists(orders[amount > 100.06 & type == 'express']) <= 0.500
|   |--- class: 0
|--- exists(orders[amount > 100.06 & type == 'express']) >  0.500
|   |--- class: 1

accuracy 0.960
```

The tree's question is a rule you can read and check: whether the customer
has an express order above an amount that the tree learned. On your own
data, a [`Database`](https://scikit-link.rodrigo-arenas.com/stable/tutorials/describe-your-database)
declares the tables, keys and relationships, and `X` has one row per
prediction.

## What is in 0.1.0

* **Features for any estimator.** `RelationalFeaturizer` turns related
  tables into columns, such as `count(orders[type == 'express'])`, inside a
  pipeline, so each cross-validation fold learns its catalog from its own
  training rows.
* **Models that learn on related rows.** Relational decision trees, random
  forests and gradient boosting, for classification and regression, learn
  which related rows to aggregate and with which conditions while they fit.
  Gradient boosting has the log loss for classification and the squared
  error, absolute error, Huber and quantile losses for regression.
* **No labels needed.** `RelationalKMeans` and `RelationalClusteringTree`
  group entities, and `RelationalIsolationForest` ranks unusual ones.
* **Time without leakage.** A cutoff date per row of `X` limits every
  feature and split to the rows dated before it, and `TemporalCutoffSplit`
  validates on later dates, with a label horizon and a gap.
* **Explanations.** `export_text` prints a tree as rules, `explain` shows
  what a model used for one prediction, `aggregate_importances` groups
  importances by table or expression, and `sklink.plotting` draws schemas,
  trees and predictions without a plotting library.
* **scikit-learn all the way.** The estimators are tested with
  scikit-learn's estimator checks and work in pipelines, searches, ensembles and threshold tuning.
  `TransformedTablesEstimator` fits scikit-learn transformers on the tables
  themselves, such as a scaler, or a `TfidfVectorizer` followed by
  `TruncatedSVD` to embed a text column.
* **Ready for production.** `sklink.detach` returns a copy of a fitted model
  without its table data, ready to pickle or save with skops, and
  `sklink.rebind` attaches the current tables after loading. Tables can be
  pandas, Polars or PyArrow tables, Parquet files or dictionaries of NumPy
  arrays, and Numba, which installs with the package, compiles the inner
  loops of trees, forests and gradient boosting.

The [release notes](https://scikit-link.rodrigo-arenas.com/stable/release-notes)
list every change.

## Where to start

* [Quickstart](https://scikit-link.rodrigo-arenas.com/stable/getting-started/quickstart):
  two models on a small shop database that comes with the package.
* [Case studies](https://scikit-link.rodrigo-arenas.com/stable/case-studies/):
  churn from raw tables to a deployed model, scikit-learn ensembles and
  cost-based thresholds, forecasts with calibrated intervals, and segments
  and anomalies without labels.
* [Use scikit-link with scikit-learn](https://scikit-link.rodrigo-arenas.com/stable/guides/scikit-learn)
  if you already have pipelines.
* [Migrate from Featuretools](https://scikit-link.rodrigo-arenas.com/stable/guides/migrate-from-featuretools)
  if you use deep feature synthesis today.
* [Benchmarks](../benchmarks) compare scikit-link with flattened-table
  pipelines on public relational datasets.

## What comes next

The [roadmap](../roadmap) lists the plans after 0.1.0. If you work with
multi-table data, tell us about your use case in
[Discussions](https://github.com/rodrigo-arenas/scikit-link/discussions), and
report problems in [Issues](https://github.com/rodrigo-arenas/scikit-link/issues).
If scikit-link helps your research, the
[README](https://github.com/rodrigo-arenas/scikit-link#citing) explains how
to cite it.
