import pointblank as pb
import polars as pl
temps = [20 + (k * 37 % 11 - 5) * 0.6 for k in range(300)]
for k in range(0, 300, 25):
temps[k] *= 10
for k in range(7, 300, 40):
temps[k] = None
readings = pl.DataFrame({"temp": temps})
def evaluate(train, *, seed, variant):
sample = train.drop_nulls().sample(fraction=1.0, with_replacement=True, seed=seed)
return abs(sample["temp"].mean() - 20)
validation = (
pb.Validate(data=readings)
.col_vals_not_null(columns="temp")
.col_vals_between(columns="temp", left=-10, right=45, na_pass=True)
.col_vals_gt(columns="temp", value=19, na_pass=True)
.interrogate()
)
ablation = (
pb.Ablation(
validation, evaluate=evaluate, metric="error", higher_is_better=False, repeats=10
)
.drop_all()
.drop_all(steps=[1, 2])
.run()
)
ablation| Ablation report | |||
error on the full table (300 rows): 7.289 ± 1.827 (lower is better). Each version was evaluated 10 times; Δ is the mean paired difference from removing the same number of random rows. |
|||
| Variant | Removed | error | Δ vs random |
|---|---|---|---|
All steps 1: Expect that all values in temp should not be Null.2: Expect that values in temp should be between -10 and 45.3: Expect that values in temp should be > 19. |
121 40.3% |
1.196 ± 0.059 Δ vs full −6.093 |
−3.519 [−4.937, −2.100] helps |
All of steps 1, 2 1: Expect that all values in temp should not be Null.2: Expect that values in temp should be between -10 and 45. |
20 6.7% |
0.065 ± 0.060 Δ vs full −7.224 |
−8.012 [−9.937, −6.087] helps |
| Intervals are 95% paired t-intervals, not adjusted for multiple comparisons; verdicts use Holm-adjusted p-values. | |||