Propositionalization
Deep Feature Synthesis, Featuretools
Compute columns such as order count and mean purchase amount. The model receives one feature row per customer.
Relational machine learning uses records from tables linked by keys to make a prediction for each sample. For a customer, the model can use the customer's country together with the amounts and types of their orders.
customers
| PKcustomer_id | country |
|---|---|
| c07 | CO |
| c12 | MX |
orders
| FKcustomer_id | amount |
|---|---|
| c07 | 24 |
| c12 | 42 |
| c07 | 36 |
features
| customer_id | mean_amount |
|---|---|
| c07 | 30 |
| c12 | 42 |
A model that predicts once per customer needs one feature row per customer. The source tables describe different things, so they have different numbers of rows linked to that customer.
| Table | Rows per customer | Example columns |
|---|---|---|
customers | 1 | customer_id, country, signup_channel |
orders | 0 to hundreds | customer_id, amount, type |
order_items | many per order | order_id, product_id, quantity |
products | 0 or more through order items, shared across customers | product_id, category, price |
A model that only sees customers can use country but has no order history. An aggregation can add that history as a feature, such as the number of express orders or the mean order amount. A direct join to orders would repeat the customer row and its label for every order. Before training a tabular model, summarize those orders at the level you predict for.
Deep Feature Synthesis, Featuretools
Compute columns such as order count and mean purchase amount. The model receives one feature row per customer.
TILDE, relational trees and forests
At a split, search for an order condition that separates the labels. A customer follows a branch based on how many orders match.
Graph neural networks, RelGT
Represent customers and orders as nodes connected by keys. A graph model combines information from neighboring nodes to predict for a customer.
count, mean, mode or nunique, and join them into one row per sample. Use those features to fit a tabular model. The choice of features determines which information the model gets. For example, the number of express orders and the largest order amount leave out whether the largest order was express.Information can leak through the training split or the records used to compute a feature.
A category seen only for c05 or c06 can enter the catalog used for evaluation.
Transform c05 and c06 with that catalog. Their orders can supply feature values during prediction.
The split defines which samples may teach the model. The cutoff defines which timestamped records each sample can see. A temporal task usually needs both.
scikit-link covers the first two approaches with the scikit-learn API:
RelationalFeaturizer produces a table of features for the samples in X. Each column has a name such as mean(orders.amount).scikit-link is in early development. See the roadmap and the comparison with other libraries.
groupby to a relational tree.The glossary defines these and more terms, each with a link you can cite.
customers.X). One row per sample. Each row names its entity and can carry a prediction cutoff. Several samples can refer to the same entity.orders.customer_id → customers.customer_id.count(orders) or mean(orders.amount).