Utility: can it do the job?
Train one model on synthetic rows and one on real rows, test both on rows neither saw, and read the ratio. Then see why more synthetic rows don't add information.
What runs in CodeSplash
- Synthetic data — sequential CART Verified in Python and R
- Synthetic data — Gaussian copula Verified in Python and R
You will be able to
- Explain train on synthetic, test on real, and read the utility ratio
- Predict when a generator's loss of structure will hurt a model
- Explain why extra synthetic rows don't add evidence
Read first
The test that matters for modeling
ReadFidelity asks whether a table looks right. If you plan to train a model, there's a more direct test: does a model trained on it work on real data?
That's train on synthetic, test on realTrain on synthetic, test on realTrains one model on synthetic rows and one on real rows, then tests both on real rows neither saw.. The app trains the same learner (LightGBM) twice, once on the synthetic rows and once on the real training rows. It tests both on the holdout, real rows neither model saw.
Can high fidelity hide low utility?
PredictPredict first
Every column matches well, and so do the pairwise correlations. Could a model trained on this table still do poorly on real rows?
Reveal
Yes. Column and pair checks can miss a pattern that only shows when three things combine, such as an effect of age that exists in one region only. If the generator drops that, a model trained on its rows can't learn it, and the fidelity scores never mention it.
What an interaction looks like
ExploreAn interactionInteractionWhen the effect of one predictor depends on the level of another. means the effect of one variable depends on another.
DExplorable · Interactions and simple slopes
When the effect of x depends on a moderator, where is it actually different from zero?
What is the slope of x at this moderator value?
Centering: with a mean far from zero, the coefficient on x describes a moderator value no one has.
Where the band excludes zero, the slope of x is significant at that moderator value. Johnson–Neyman (J–N) marks the boundaries.
Commit your prediction above to see the result
Make your prediction to see the result.
Raise the true interaction, and watch the slope of change with the moderator. A Gaussian copula has no way to store this: it keeps one correlation for each pair, whatever the other columns are doing. Sequential trees can keep it, since each column is drawn from a tree on the columns before it.
If interactions matter for your model, that's a reason to try trees first.
Read the ratio
ReadReading utility takes both numbers. A ratio can look fine when the real-data model is itself poor, so check the score on real rows first.
| Light | Relative utility |
|---|---|
| Good | At least 90% |
| Caution | At least 75% |
| Poor | Below that |
For Augment training data, the verdict needs both utility and fidelity: a poor light on either one gives Not useful for augmentation yet.
Measure it
In the appIn the studio, open Scorecard and choose a column under Utility target. Then press Score again.
The Utility section shows the score when trained on real rows, the score when trained on synthetic rows, and the relative utility. This needs a holdout, because the test rows have to be ones the generator never saw.
Try two generators with the same target. Do they differ by more than you'd expect from a rerun with another seed?
More rows, same information
PredictPredict first
You fit a generator to 258 rows and draw 500. Do you know more about penguins than you did?
Reveal
No. Everything in the new rows came from the fitted model, which came from the original rows. A formula will happily report a smaller standard error, because it believes it has more independent observations. That precision isn't real.
See the false precision
ExploreA standard error shrinks with , and the formula can't tell where the rows came from.
AExplorable · Standard error against n
How much more data does it take to halve the uncertainty of a mean?
If you quadruple the sample size, the spread of sample means becomes…
Commit your prediction above to see the result
Make your prediction to see the result.
Quadruple and watch the error halve. That's right for new, independent data. For synthetic rows the shrinkage is an illusion, as you can draw as many as you like.
So use synthetic rows to fill out a training set, or to test software. For standard errors and p-values, go back to the real data.
When might augmenting help?
ReflectAdding synthetic rows can help a model in specific cases, such as a small training set with a flexible learner, or a rare class. It can also hurt, by teaching the generator's mistakes.
Think of a model you've trained. What would you compare to find out? Make sure that your answer includes a test set of real rows that the generator never saw.
Check your understanding
CheckpointCheck yourself
A model trained on real rows scores an AUC of 0.80 on the holdout. Trained on synthetic rows, it scores 0.72. What is the relative utility, as a decimal?
Show the answer
Answer: 0.9
0.72 / 0.80 = 0.90, which is the edge of the good band.
Check yourself
Why are both models tested on the holdout, and not on synthetic rows?
Show the answer
Answer: a
A model tested on data from the same generator can score well by learning that generator's quirks.
Check yourself
An analyst pads 200 real rows with 2,000 synthetic ones, runs a t test on all of them, and gets p < .001. What's wrong?
Show the answer
Answer: a
The extra rows hold no new information about the population. Run the test on the 200 real rows.
Compute it yourself
In the appHere is the idea with a logistic model on numeric columns. The app uses LightGBM, so its numbers will differ.
import pandas as pd
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import roc_auc_score
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler
cols, target = ["age", "visits", "tenure_months"], "churned"
train, holdout, synth = (pd.read_csv(f).dropna(subset=cols + [target]) for f in ["train.csv", "holdout.csv", "synthetic.csv"])
def score(frame):
model = make_pipeline(StandardScaler(), LogisticRegression()).fit(frame[cols], frame[target])
return roc_auc_score(holdout[target], model.predict_proba(holdout[cols])[:, 1])
real, syn = score(train), score(synth)
print(f"real {real:.3f}, synthetic {syn:.3f}, relative utility {syn / real:.2f}")cols <- c("age", "visits", "tenure_months")
target <- "churned"
read_rows <- function(f) {
d <- na.omit(read.csv(f)[, c(cols, target)])
d[[target]] <- d[[target]] %in% c(TRUE, "TRUE", "True", "true", 1)
d
}
train <- read_rows("train.csv")
holdout <- read_rows("holdout.csv")
synth <- read_rows("synthetic.csv")
auc <- function(y, s) {
r <- rank(s)
n1 <- sum(y)
n0 <- sum(!y)
(sum(r[y]) - n1 * (n1 + 1) / 2) / (n1 * n0)
}
score <- function(frame) {
fit <- glm(reformulate(cols, target), binomial, frame)
auc(holdout[[target]], predict(fit, holdout))
}
real <- score(train)
syn <- score(synth)
cat(sprintf("real %.3f, synthetic %.3f, relative utility %.2f\n", real, syn, syn / real))Recap
Recap- Utility compares a model trained on synthetic rows with one trained on real rows, both tested on unseen real rows.
- High fidelity can hide low utility when a generator loses an interaction.
- Extra synthetic rows carry no new information, so don't let them shrink a standard error.
- Compare with and without augmentation on real test rows before you rely on it.
Concepts in this lesson