Release notes
Find new features, fixes, and removals by release. During development, upcoming changes are collected in the repository's changelog.d folder. Use the documentation version selector to read the guides for your installed release.
0.1.0 (2026-11-29)
The first release. scikit-link trains scikit-learn models on data spread over several tables linked by keys: features for any estimator, relational trees, forests and gradient boosting, clustering and anomaly detection, cutoff dates against leakage, explanations and figures. The launch post walks through a first model.
Features
Anomaly detection.
RelationalIsolationForestinsklink.ensembledescribes each entity by aggregates of its related rows and isolates the unusual ones with scikit-learn'sIsolationForest, withscore_samples,decision_function,predictandfit_predict.Clustering.
sklink.clusterhasRelationalKMeans, k-means on standardized relational features (optionally on their principal components withn_components), andRelationalClusteringTree, whosen_clustersleaves are each defined by questions about the related tables, such ascount(orders) > 2.5.export_text,export_dict,explain,TreeDisplayandExplanationDisplayname the cluster of each leaf and sample.Data.
sklink.Databaseis an immutable database of tables linked by primary and foreign keys, declared withSchemaandRelationshipand passed to estimators as thedatabasehyperparameter. It reads pandas, Polars and PyArrow tables, Parquet files and dictionaries of NumPy arrays, keeps datetime units and nullable integers, and refuses values it would silently change, such as datetimes outside 1678 to 2261 or integers beyond 2**53 inferred as numeric. Free text (strings that average 30 characters or more and are nearly all distinct, at least 100 of them, such as reviews) is inferred astextand feeds no feature, unless declaredcategorical. Time columns are optional.Database.tablereturns a table as pandas, Polars, PyArrow or NumPy;Database.describe(statistics=True)adds the children per parent row and the orphans of each relationship. Stored arrays are read-only views, so no model or cache can change the data.sklink.detachandsklink.rebindseparate a fitted model from its data for persistence; when a column of the new database got another inferred type, theSchemaErrorofrebindnames thecolumn_typesdeclaration that settles it. Parquet files and data frames are read and encoded one column at a time (Parquet in small groups of columns, with the rows of every group in the file's order), and tables are sorted one column at a time, which lowers the peak while building a database (RelBench H&M: 1.9 GB for 0.75 GB of tables).Datasets.
sklink.datasetshasmake_relational_classificationandmake_relational_regression, synthetic databases with a known rule, and the smallload_shopdatabase.Extending.
sklink.expressionsgives every relational feature a canonical, parseable name (the leaf sums ofleaf_weightshave a canonical name that is not parsed back),sklink.primitivesis a registry of aggregation primitives you can add to (kernels of primitives withrequires_time=Truereceive each aggregated row's time inKernelContext.row_seconds), andsklink.enginea pluggable evaluation engine with an in-memory NumPy backend.sklink.utils.estimator_checks(check_relational_estimator,parametrize_with_relational_checks) tests a relational estimator for leakage, batch independence, row order invariance and persistence, andsklink.utils.validationhascheck_relational_Xandcheck_temporal_setup, which warns when a temporal split is combined with a static model or another cutoff column.Features for any estimator.
sklink.feature_extraction.RelationalFeaturizerturns the population table into one column per relational expression, such asmean(orders.amount)orcount(orders[type == 'express']), in front of any scikit-learn estimator. It learns its frequent categories infit, from the related rows of the training samples only. By default it also builds conditional aggregates, themeanandsumof each numeric column over the rows of each category of columns with at mostmax_categoriescategories, such assum(orders.amount[type == 'express'])(conditional=Falsegives a smaller catalog; with an explicitprimitives=[...]only themeanandsumthe list names are used), and it aggregates the columns of the tables that the rows of the longest paths look up, such asmean(orders.order_items.products.price), without counting a hop (max_lookup_depth). Withset_output(transform="pandas")or"polars", categorical features come out with a native categorical dtype and booleans as nullable booleans, soHistGradientBoosting*(categorical_features="from_dtype")works without extra setup. Time windows take duration strings such as"30D"or"1D12h".Figures.
sklink.plottingdrawsSchemaDisplay(tables, relationships and the columns a model reads),TreeDisplay,ExplanationDisplay,ImportanceDisplay,ForestDisplay(score as trees or boosting iterations are added),SearchDisplay(the questions scored at a node, fromrecord_candidates),CutoffSplitDisplayandLiveFit, a callback forset_callbacks(scikit-learn 1.9 or later) that draws the progress offitwhile it runs. They need no plotting library: interactive HTML in notebooks, SVG where scripts do not run, text in terminals, andsavewrites HTML, SVG or JSON. In a notebook, aDatabaseshows its tables and relationships.Gradient boosting.
RelationalGradientBoostingClassifierandRelationalGradientBoostingRegressorinsklink.ensembleboost relational regression trees with the main parameters and losses of scikit-learn'sGradientBoosting*(log_loss;squared_error,absolute_error,huberandquantile),subsample, early stopping withn_iter_no_change,staged_predict,staged_predict_probaandtrain_score_. For the squared error and the log loss the trees are Newton trees by default, as in XGBoost and LightGBM: they split on the second-order gain of gradients and Hessians and set each leaf to the Newton step, whichl2_regularizationcan shrink (a node then splits only when its penalized gain is positive; the Numba kernels score the penalized splits too, with the same models as the NumPy loops: RelBench F1 driver DNF with a penalty of 1 fits in 580 s instead of 661 s). The default penalty is 0: on RelBench F1 and synthetic data no value won consistently over three seeds. Their trees take up to two learned conditions per aggregate (max_conditions=2), each payingcondition_penalty=2times its chance gain (see the trees), and rank high-cardinality categories by the residuals (negative gradients) of each iteration, in every task. Boosting searches the second condition of an aggregate after the best first condition only, where trees and forests extend their best four: it fits in about a third less time, and its scores stay within the spread over seeds (PKDD'99 loans, 5-fold AUC over three seeds: 0.921 ± 0.002 with one first condition, 0.919 ± 0.004 with four). Withleaf_weights(0, off, by default), each tree also fits a small tree over the rows of each path, as getML's Relboost does, and asks about the sum or mean of the leaf weights of each sample's rows: aLeafSumexpression insklink.expressions(PKDD'99 loans, 5-fold AUC over three seeds: 0.924 ± 0.003 withleaf_weights=2, 0.921 ± 0.002 without). Withcriterion="squared_error", without related tables and withmax_binsat least the number of distinct values of each column, the squared error and log loss models give scikit-learn's predictions.explaingives each expression a signed effect, and the baseline plus the effects equal the raw prediction.Inspection.
sklink.inspectionhasexport_text,export_dict,export_json,explain,aggregate_importancesanddescribe_expressions, which describe fitted trees, forests and boosting models with canonical expression names. Withrecord_candidates, each split node keeps its best scored questions intree_.candidates.aggregate_importancesandImportanceDisplayaccept a pipeline that puts aRelationalFeaturizerin front of any scikit-learn model, nested pipelines and searches included. They group the model'sfeature_importances_, or the importances passed with the newimportancesparameter (such as the absolute coefficients of a linear model or permutation importances of the featurizer's output), by expression, table, column, relationship or primitive.describe_expressionsandSchemaDisplaydescribe the featurizer of such a pipeline.Performance. Numba installs with the package, and the inner loops of relational trees, forests and boosting are compiled with it, with exactly the same models and predictions. Intel macOS and Python versions that Numba does not support yet install the package without it. Without Numba, the split search sums many targets at once, so a clustering tree fits about three times faster. The
tree_kernelsoption ofsklink.set_config("auto","numpy"or"numba") chooses the implementation; the first fit in a new environment compiles for a few seconds, and each process loads Numba once (about 1 s and 100 MB), so a small forest withn_jobscan be faster with"numpy". Free-threaded Python builds use the NumPy loops.set_config,get_configandconfig_contextalso bound memory withchunk_rowsandcache_bytes, and the errors ofsklink.exceptionsderive from the standardValueErrorandRuntimeError. Relational forests and gradient boosting predict (predict,predict_proba,decision_function,apply, the OOB score) a chunk of rows at a time, with about 256 MB of expression values per chunk and exactly the same results, so that thousands of expressions over many rows fit in memory. On large data,max_search_samplesbounds the cost of the condition search: a node with more samples searches its aggregates with learned conditions on that many, drawn at random once per tree and with the leaf limits scaled to that share, and scores the best few on all its samples. It is2000for gradient boosting, which fits several times faster on large data with the same accuracy within the spread over seeds (RelBench H&M user churn, 50 000 samples and 10 trees, three seeds: 6 times faster, AUC 0.572 ± 0.003 against 0.574 ± 0.005), andNone(all samples) for trees and forests. The training data of trees, forests and boosting keeps a column with few distinct values, such as one of a parent table that many rows reach, as those values and an index of one or two bytes per row, and the (sample, category) pairs of ranked categories in 32-bit integers, with the same models (RelBench H&M, 200 000 samples: 1.0 GB to 0.59 GB), and reads the rows of a relationship one column at a time while building it (RelBench H&M user churn, gradient boosting on 800 000 samples: peak memory 9.5 GB to 6.7 GB, in the same time). The Numba kernels of the condition scan bin counts through a table and other values by comparisons, fill the condition matrices without temporaries, skip empty bins when scoring and, for classification, give the bin of the samples without rows (a count or sum of 0, a mean of NaN) the node's totals minus the other bins, with the same models (RelBench H&M user churn: a decision tree on 8000 samples and a 3-tree boosting on 20 000 samples fit about a quarter faster, and a decision tree on RelBench F1 driver DNF, 11 411 samples, about 15 % faster). Evaluating expressions finds the codes of a category condition once and takes the rows selected by the same conditions and window once for all the expressions that share them, which makes predictions and featurizer transforms faster and lighter with the same values (RelBench H&M, a 10-tree forest predicting 74 575 customers: 154 s and 2.8 GB to 110 s and 2.4 GB).Random forests.
RelationalRandomForestClassifierandRelationalRandomForestRegressorevaluate candidate expressions once and share them between all trees, grow trees in worker processes withn_jobs, and give the same results for anyn_jobs. Each tree ranks high-cardinality categories on its own bootstrap sample, so out-of-bag scores stay unbiased. Bootstrapping withsample_weightfollows scikit-learn 1.9 whatever scikit-learn version is installed.estimators_samples_is drawn again from the seed of each tree when read, as in scikit-learn, so a fitted or saved forest does not hold one index per training row and tree.Time. With a cutoff column in
Xnamed bytime=, features and splits see only rows dated before each sample's cutoff. Thelast,firstandtrendprimitives give the latest or earliest non-missing value among those rows (the smallest one when several share that time) and the least-squares slope over time, per day;lastandtrendare default primitives of the numeric columns of tables with a time column.sklink.model_selection.TemporalCutoffSplitkeeps every training cutoff before the test cutoffs, with an optional gap and label horizon.Trees.
RelationalDecisionTreeClassifierandRelationalDecisionTreeRegressorask questions about aggregates of related tables with up to two conditions learned during fit (max_conditions, default 2;1fits about twice as fast), such asexists(orders[amount > 99.98 & type == 'express']). The best of many candidate conditions gains by chance alone, so each learned condition must paycondition_penaltytimes the gain one condition makes by chance at the node (its impurity for the Gini index and the squared error, a constant for the entropy, times the mean sample weight per row) and the log of the number of conditions its path offers, a Bonferroni-style correction as in CHAID; a question whose conditions do not pay for themselves is not asked, and improvements and importances stay the impurity decrease itself (default 0, off, for trees and forests). A condition can read a column of the row each aggregated row points to, such asproportion(orders.order_items[products.category == 'toys']), without counting as a hop (max_lookup_depthof the featurizer and every relational model, default 1;0turns it off). In regression and binary classification, the categories of a column with more thanmax_categoriesof them are ranked by the mean target of the training samples whose rows have them, so a condition can keep a set of them, such asproportion(orders[merchant in ('m017', 'm203')]); categories that fewer than 5 training entities reach are not ranked (an entity counts once at any number of cutoffs), so that a column of identifiers does not sort the samples by their own target. A split on a categorical feature, such asmode(orders.merchant), orders only the categories that at least 10 samples of the node have, as scikit-learn'sHistGradientBoosting*does, and that at least 5 training entities reach (sample weights count in units of their mean, so integer weights act as repeated rows and the scale of the weights changes nothing); the others go right, so that categories of one or two samples each, or a column with one value per entity such as a name, do not give a split that only memorizes them (RelBench F1 with the drivers' names, gradient boosting with its defaults, three seeds, validation split: driver DNF AUC 0.746 ± 0.014 to 0.785 ± 0.001, position MAE 3.30 to 2.92 ± 0.02, and top 3 AUC 0.824 to 0.853 with every seed; fit time unchanged). Withdatabase=Nonethey are standard CART trees.scikit-learn interoperability. Every estimator works in pipelines, grid searches and cross-validation, and is tested with scikit-learn's estimator checks. Repeated
fit,predictandtransformcalls on the same entities reuse the evaluated expressions from a cache (sklink.set_config(cache_bytes=...)), so tools such aspermutation_importanceandGridSearchCVdo not recompute them; nothing learned infitis cached. Models fitted in joblib workers come back sharing the caller'sDatabase, and models save with pickle or skops, the default format of MLflow's scikit-learn flavor; when loading with skops, pass the sklink types as trusted types. A saved model keeps the version of scikit-link that saved it, and loading it with another version emits anInconsistentVersionWarning(insklink.exceptions), as scikit-learn does for its own estimators. With scikit-learn 1.9 or later, trees, forests and gradient boosting models report progress to scikit-learn's callbacks, such asProgressBar, and stop when a callback asks. The error raised when the key or time column ofXcannot be found explains the usual scikit-learn causes: aColumnTransformerthat renamed it toremainder__<name>(fixed withverbose_feature_names_out=False), or a step that passedXon as an array (fixed withset_output(transform="pandas")or a column position).scikit-learn transformers on the tables of a database. The new
sklink.compose.TransformedTablesEstimatorwraps a relational estimator, a featurizer or a pipeline that starts with one, and fits scikit-learn transformers, such as a scaler, a discretizer or a text embedding, on the columns of chosen tables. Each transformer learns only from the rows that the training samples reach, before their cutoffs in temporal mode, and every row is then transformed. The transformers' parameters tune in searches as<table>__<parameter>, and a model rebound to new tables transforms them with what it learned in fit.
Documentation
- The documentation has a quickstart on a small shop database, the core concepts, tutorials from describing a database to boosting, clustering, anomaly detection and figures, a tutorial on building
Xandyfrom your own tables, a cookbook of short recipes (including lookalike customers, skrub, SHAP, skops, MLflow and joblib), a Colab quickstart notebook, a guide to migrate from Featuretools, a page of common errors and an API reference grouped by task. Every example that shows output is run, and its output checked, each time the documentation is built. - The website explains relational machine learning, compares scikit-link with Featuretools, getML, skrub and relational deep learning, and has a FAQ, a glossary, the roadmap, the benchmark protocol and blog tutorials. The documentation of each release stays online, with a version selector.
Maintenance
- A benchmark harness under
benchmarks/compares scikit-link with flattened-table baselines (manual features and deep feature synthesis with tuned gradient boosting) on public relational datasets under shared folds and tuning budgets.