This page shows the chapter notebook with its saved results. Constructed examples do not measure competition gains.
Chapter 37: Stacking Deep
Try the decision first
How far does a meta-model's score on its own OOF rows drift from an honest assessment as the library of base models grows, and when does a regularized meta-model overtake the unregularized one?
Write your expectation before opening the worked results. Use the chapter activity to compare supported inputs. To change the calculation itself, run the notebook on GitHub.
Your answers stay on this page until you download them. They are not sent to a server.
Worked notebook and saved results
How far does a meta-model's score on its own OOF rows drift from an honest assessment as the library of base models grows, and when does a regularized meta-model overtake the unregularized one?
Every extra base model is another column for the meta-model to fit. The score on the rows it was fitted to keeps improving, so it cannot say when to stop; the chapter asks for nested assessment and baselines to decide that.
Constructed data; the library size where regularization wins is a property of this generator. At 50 models the unregularized stack still beats the strongest single model on average, but by far less than its own-row score suggests.
The experiment
A constructed regression task with 250 development rows, 10 features, a bent signal and noise of variance 1. The library is the control: that many ridge, nearest-neighbor and shallow-tree models on random feature subsets. Five outer folds; inside each, 3-fold inner OOF predictions build the meta training matrix, the base models refit on the outer training rows predict the outer fold, and the meta-model (ordinary least squares, or ridge with alpha 50) predicts from those. A global scheme instead builds one OOF matrix and cross-validates the meta-model on it. Fresh-row scores come from 1,000 new rows. Results are means over 5 independent worlds.
Calculation code
import numpy as np
from sklearn.linear_model import LinearRegression, Ridge
from sklearn.model_selection import KFold
from sklearn.neighbors import KNeighborsRegressor
from sklearn.tree import DecisionTreeRegressor
from kaggle_companion.activities._common import clean
SEED = 37
REPLICATES = 5 # independent worlds per library size; results are means over them
N_DEV, N_FRESH, FEATURES = 250, 1000, 10
RIDGE_ALPHA = 50.0 # the "simple regularized meta model" the chapter prefers
def generate(n, rng):
"""A bent, interacting signal that no single base model captures, plus noise with variance 1."""
X = rng.normal(size=(n, FEATURES))
signal = 1.2 * np.sin(1.5 * X[:, 0]) + 0.8 * X[:, 1] * X[:, 2] + 0.6 * X[:, 3] ** 2 + 0.5 * X[:, 4] - 0.4 * X[:, 5]
return X, signal + rng.normal(0, 1.0, n)
def make_library(size, rng):
"""`size` base models: ridge, kNN and shallow trees, each seeing a random subset of 3 to 6 features."""
return [(i % 3, np.sort(rng.choice(FEATURES, rng.integers(3, 7), replace=False))) for i in range(size)]
def base_predictions(library, X_fit, y_fit, X_new):
"""Fit every base model on (X_fit, y_fit) and return their predictions for X_new as columns."""
out = np.empty((len(X_new), len(library)))
for j, (kind, cols) in enumerate(library):
model = (Ridge(alpha=1.0) if kind == 0 else KNeighborsRegressor(15) if kind == 1
else DecisionTreeRegressor(max_depth=4, min_samples_leaf=5, random_state=j))
out[:, j] = model.fit(X_fit[:, cols], y_fit).predict(X_new[:, cols])
return out
def oof_matrix(library, X, y, folds):
matrix = np.zeros((len(y), len(library)))
for fit, out in folds:
matrix[out] = base_predictions(library, X[fit], y[fit], X[out])
return matrix
def mse(pred, y):
return float(np.mean((pred - y) ** 2))
def one_world(size, seed):
rng = np.random.default_rng(seed)
X, y = generate(N_DEV, rng)
X_fresh, y_fresh = generate(N_FRESH, rng) # new rows: the reference no estimate may touch
library = make_library(size, rng)
outer = list(KFold(5, shuffle=True, random_state=1).split(X))
# Global scheme: one OOF matrix for the whole development set, then meta-CV on that matrix.
G = oof_matrix(library, X, y, outer)
global_cv = np.zeros(N_DEV)
for fit, out in KFold(5, shuffle=True, random_state=2).split(G):
global_cv[out] = LinearRegression().fit(G[fit], y[fit]).predict(G[out])
# Nested scheme: rebuild the base stage inside each outer training partition.
nested = {k: np.zeros(N_DEV) for k in ("ols", "ridge", "average", "best")}
own = {k: [] for k in nested} # each method scored on the rows it was fitted or selected on
fresh = {"ols": [], "ridge": []}
for fit, out in outer:
inner = list(KFold(3, shuffle=True, random_state=3).split(fit))
G_in = oof_matrix(library, X[fit], y[fit], inner) # inner OOF base predictions for outer training
both = base_predictions(library, X[fit], y[fit], np.vstack([X[out], X_fresh]))
G_out, G_new = both[:len(out)], both[len(out):]
best = int(np.argmin(((G_in - y[fit][:, None]) ** 2).mean(axis=0)))
metas = {"ols": LinearRegression().fit(G_in, y[fit]), "ridge": Ridge(alpha=RIDGE_ALPHA).fit(G_in, y[fit])}
for k, meta in metas.items():
nested[k][out] = meta.predict(G_out)
own[k].append(mse(meta.predict(G_in), y[fit]))
fresh[k].append(mse(meta.predict(G_new), y_fresh))
nested["average"][out], own["average"] = G_out.mean(axis=1), own["average"] + [mse(G_in.mean(axis=1), y[fit])]
nested["best"][out], own["best"] = G_out[:, best], own["best"] + [mse(G_in[:, best], y[fit])]
return {"global_cv": mse(global_cv, y), "nested": {k: mse(v, y) for k, v in nested.items()},
"own": {k: float(np.mean(v)) for k, v in own.items()}, "fresh": {k: float(np.mean(v)) for k, v in fresh.items()}}
def run(library_size):
worlds = [one_world(library_size, SEED * 100 + r) for r in range(REPLICATES)]
def avg(get):
return float(np.mean([get(w) for w in worlds]))
return clean({
"library_size": library_size,
"ols": {"own": avg(lambda w: w["own"]["ols"]), "global_cv": avg(lambda w: w["global_cv"]),
"nested": avg(lambda w: w["nested"]["ols"]), "fresh": avg(lambda w: w["fresh"]["ols"])},
"methods": {k: {"own": avg(lambda w, k=k: w["own"][k]), "nested": avg(lambda w, k=k: w["nested"][k])}
for k in ("best", "average", "ols", "ridge")},
"ridge_fresh": avg(lambda w: w["fresh"]["ridge"]),
"ridge_beats_ols_nested": float(np.mean([w["nested"]["ridge"] < w["nested"]["ols"] for w in worlds])),
"noise_variance": 1.0, "replicates": REPLICATES, "development_rows": N_DEV, "fresh_rows": N_FRESH,
})
Measure it across the control
The control is number of base models in the library. Each value below runs the whole experiment from the generator up.
Calculation code
import pandas as pd
from kaggle_companion.activities.ch37 import explain
VALUES = [2, 10, 30, 50]
results = {value: run(value) for value in VALUES}
table = pd.DataFrame({str(v): explain(results[v], v)['metrics'] for v in VALUES})
print(table.to_string())2 10 30 50 Own OOF rows 2.98 2.31 1.66 1.27 Global-matrix meta-CV 2.99 2.45 2.14 2.29 Nested 2.99 2.45 2.18 2.38 Fresh rows 3.01 2.43 2.23 2.32 Equal average, nested 3.00 2.80 2.74 2.75 Ridge stack, nested 3.05 2.47 2.13 2.01
Look at it
The figure shows the default setting, number of base models in the library = 30.
Calculation code
import matplotlib.pyplot as plt
from kaggle_companion.activities.ch37 import draw, NCOLS, HEIGHT
DEFAULT = 30
fig, axes = plt.subplots(1, NCOLS, figsize=(6.6 if NCOLS == 1 else 10.4, HEIGHT), layout='constrained')
draw(axes, results[DEFAULT], DEFAULT)
plt.show()What the result says
With 30 base models the least squares stack scores 1.66 on its own OOF rows but 2.18 under nested assessment (2.18 - 1.66 = 0.52 of optimism); the global OOF matrix gives 2.14 and fresh rows 2.23. Against the strongest single model the stack gains 1.08 on its own rows but +0.54 nested (2.72 - 2.18 = 0.54). The equal average scores 2.74 and the ridge stack 2.13, which is -0.05 relative to least squares (a negative sign means ridge is better; it was better in 40% of 5 worlds).
- Optimism of the least squares stack: 2.18 - 1.66 = 0.52.
- Honest gain over the strongest single model: 2.72 - 2.18 = 0.54.
- Gain the own-row scores would claim: 2.74 - 1.66 = 1.08.
- Nested ridge against nested least squares: 2.13 - 2.18 = -0.05.
Apply this to your competition
- Report a stack with nested assessment (base stage rebuilt inside each outer partition), never with its score on its own OOF rows.
- Compare against the strongest single model and the equal average under the same outer rows; a stack must beat both to be worth its extra stage.
- Limit the meta-model's freedom: ridge, nonnegative weights or a smaller library once the library is large relative to the rows it is fitted on.
- Archive the recipe and row IDs, and keep the negative result if the stack does not clear the baselines.
Book location: Chapter 37, Distinguish Meta Fitting from Outer Assessment.
Apply a lesson from this chapter
Select a lesson whose conditions match your project. State how you would test it and what would make you reject it.
Build an ensemble library across algorithms and feature sets
Conditions
- small datasets allow a diverse prediction library
Action
- Proposed adaptation of source observation: Cache validation predictions for varied feature/algorithm combinations and select additions by marginal ensemble benefit.
Check
- Proposed verification: Use an independent selection layer and monitor library size versus validation overfitting.
Limits
- The source supplies no selection algorithm details here and no guaranteed ensemble gain.
Build a text stack from matched validation and test predictions
Conditions
- several fine-tuned language models predict the same sentiment task
Action
- Proposed conditional application: Collect validation and test prediction files from the three models and train a stacker on the validation predictions.
Check
- Proposed check: Align row IDs/folds and train on OOF predictions; evaluate stacker on an untouched meta-holdout.
Limits
- Reusing stacker training predictions for evaluation leaks; full reproduction recommends substantial GPU/RAM.
Average multiple image prediction sets
Conditions
- small image classification data has several usable predictions
Action
- Proposed conditional application: Compare a bagged average of predictions against individual predictions.
Check
- Proposed check: Compare individual sets and averaged probabilities on duplicate/source-group holdouts using AUC and inference cost.
Limits
- Architecture and bagging construction absent; final AUC is not isolated averaging gain.
Compare fold coverage against selecting only strongest individual folds
Conditions
- ensemble selection may discard entire training folds
Action
- Proposed adaptation of source observation: Compare a fold-covering ensemble with a score-threshold subset on untouched validation.
Check
- Proposed verification: Keep aggregation fixed when comparing subsets and measure sensitivity to selection thresholds.
Limits
- Public scores come from tuned model subsets; they do not prove fold coverage alone caused the difference.
Prefer a simple linear blend when stacking fails
Conditions
- several direct and multi-horizon sales models give complementary forecasts
Action
- Proposed conditional application: Compare a linear blend against stacking of the four component models.
Check
- Proposed check: Compare equal/tuned linear blends and leakage-safe stacker on rolling holdouts; report marginal cost.
Limits
- Blend weights are source-specific; unknown stacking implementation limits failure generalization.
Blend class-weighted and unweighted classifiers for F1
Conditions
- class weighting trades false positives against false negatives
Action
- Proposed conditional application: Compare a soft-voting ensemble mixing weighted and unweighted models to each component.
Check
- Proposed check: Compare blends and tuned single-model thresholds on future holdouts with leakage-free features using F1 and error costs.
Limits
- Weighted probabilities need calibration; blend may not beat threshold tuning.
Stack sparse linear and boosted text predictions
Conditions
- sentiment classification has complementary sparse text learners
Action
- Proposed conditional application: Compare a stack of LASSO and XGBoost using text2vec representations.
Check
- Proposed check: Fit vectorizer/base models inside folds; compare OOF stack with linear learner and simple average on held-out reviews.
Limits
- Work-in-progress implementation details absent; vendor business benefit is speculative.
Size an ensemble library against unstable validation and cost
Conditions
- a small dataset has an unstable kappa metric
Action
- Proposed conditional application: Compare bagged ensemble selection from a diverse model library with the best single model, accounting for feature-extraction cost.
Check
- Proposed check: Plot held-out kappa and variance against library size and total feature/training/inference cost.
Limits
- Repeated selection can overfit small validation; hundreds/thousands of models are expensive.
Compare a final ensemble with its strongest ranking model
Conditions
- ranking ensembles may dilute a strong model
Action
- Proposed adaptation of source observation: Compare blend against each component and retain uncertainty about the final selection.
Check
- Proposed verification: Use independent device-grouped validation for model and ensemble comparison.
Limits
- Private superiority is retrospective and no numeric difference is provided.
Compare retrieval-context diversity against near-equal single-model quality
Conditions
- retrieval-augmented exam models can vary their context sources
Action
- Proposed adaptation of source observation: Compare complementary context pipelines and a strong single-model alternative with complete storage/runtime costs.
Check
- Proposed verification: Measure held-out exam accuracy, retrieval coverage, artifact storage and final wall time.
Limits
- This packet gives overall comparison, not isolated context gains; ensemble advantage is small and data cost extreme.
Do not assume confidence weighting improves an ensemble
Conditions
- per-prediction confidence estimates are available for an ensemble
Action
- Proposed adaptation of source observation: Compare confidence weighting with an equal-weight baseline before adopting it.
Check
- Proposed verification: Use matched predictions and held-out data and check whether confidence is calibrated across models.
Limits
- This was a preliminary unsuccessful experiment, not evidence that every confidence-weighting rule fails.
Aggregate predictions in the target transform space
Conditions
- regression was trained and scored in a log-transformed target regime
Action
- Proposed conditional application: Compare expm1(mean(log1p(prediction))) with raw-space averaging.
Check
- Proposed check: Compare raw and log-space ensemble means under the actual transformed-target metric on untouched time blocks, checking zero and invalid predictions.
Limits
- Aggregation preference depends on the metric; source also used generalized means and leak-derived holdouts.
Compare feature perturbation and subset models for ensemble diversity
Conditions
- many candidate features and specialist partitions feed an ensemble
Action
- Proposed adaptation of source observation: Compare feature-subset models and perturbation-based importance while enforcing sufficient subgroup samples.
Check
- Proposed verification: Measure marginal OOF contribution, subgroup errors and stability of rankings.
Limits
- Noise sensitivity is model-dependent; WOE grouping must be learned without held-out targets.
Retest ensemble reduction as diversity grows
Conditions
- a larger image ensemble combines varied architectures and optimizers
Action
- Proposed conditional application: Compare geometric mean with arithmetic mean on validation and avoid leaderboard-fitted model weights.
Check
- Proposed check: Compare mean/gmean for increasing fixed model subsets on untouched folds; inspect near-zero probabilities.
Limits
- Gmean suppresses a class when one model assigns near zero; public-selected weights can overfit.
Compare hard-vote model counts with a fixed validation budget
Conditions
- binary text classifiers make complementary errors
Action
- Proposed adaptation of source observation: Compare hard voting across a small candidate set and keep the simplest ensemble meeting the quality target.
Check
- Proposed verification: Check common test ordering and assess held-out marginal contribution versus inference cost.
Limits
- Scores are source-reported and selection may reuse the same test feedback.
Keep probability averaging as a baseline for learned stacking
Conditions
- limited OOF data supports multiple image predictors
Action
- Proposed adaptation of source observation: Compare hierarchical probability averaging and simple tuned weights before fitting a nonlinear meta-model.
Check
- Proposed verification: Evaluate meta-model on predictions from a separate validation layer and inspect stability.
Limits
- Source negative result is local; nested validation is a proposed safeguard absent from packet.
Compare conservative voting thresholds under noisy score feedback
Conditions
- binary ensembles trade recall against false positives
Action
- Proposed adaptation of source observation: Compare neighboring voting thresholds and inspect stability rather than choosing the highest noisy feedback score automatically.
Check
- Proposed verification: Use held-out precision/recall and score variance for each threshold.
Limits
- Their private comparison is retrospective, not an available tuning signal during a new competition.
Stack sparse text predictions with dense context conditionally
Conditions
- text fields and structured context carry potentially complementary signals
Action
- Proposed adaptation of source observation: Compare per-field linear text predictors and category-specific text models; proposed adaptation uses OOF predictions for a dense second stage.
Check
- Proposed verification: Compare text-only and text-plus-context predictions on the same independent folds.
Limits
- OOF construction is proposed because this packet does not document it.
Compare complementary recurrent and transformer text predictions
Conditions
- ordinal sentiment classes have uneven frequency
Action
- Proposed conditional application: Compare probability averaging with a logistic-regression stack of top base models.
Check
- Proposed check: Construct out-of-fold base probabilities, compare equal/weighted averaging with logistic stacking on untouched folds, and report minority-class quality and cost.
Limits
- Published README describes reported methodology; it is not execution proof and lacks validation and ensemble ablations.
Retest simple ensembles after an elaborate competition stack
Conditions
- a multilayer stack accumulates many base models
Action
- Proposed conditional application: Compare the top few base-model average with the full stack before accepting its training and maintenance burden.
Check
- Proposed check: Compare frozen top-three average/full stack on untouched time/entity holdouts and total lifecycle cost.
Limits
- Postcompetition selection is retrospective; rank equivalence is not metric equality.
Normalize scores within rule before cross-model averaging
Conditions
- different community rules yield different score scales
Action
- Proposed conditional application: Convert outputs to per-rule normalized ranks and ensemble those values.
Check
- Proposed check: Compare raw/ranked blends on rule-held-out data and check calibration/group sizes.
Limits
- Rank scores discard probability calibration; repeated public tuning can overfit even random splits.
Vary voxel resolution and feature extractors across detectors
Conditions
- multiple voxel-based3D detectors will be ensembled
Action
- Proposed recipe: test diversity through voxel sizes and feature extractors rather than only changing random seeds.
Check
- Proposed check: Compare seed-only and voxel/feature-diverse ensembles on the same out-of-fold boxes, measuring error correlation and total inference cost.
Limits
- Several3Ddetector fits are expensive; representation diversity does not guarantee useful residual diversity.
Separate leaderboard-derived blending from independent evaluation
Conditions
- ensemble weights are inferred using reported submission scores
Action
- Proposed: fit blend weights on legitimate held-out predictions and retain independent evaluation.
Check
- Proposed: identify the evaluation subset underlying every lb score and fit/assess weights on disjoint data; audit model-file ordering and ID correspondence.
Limits
- Independent holdout fitting is a proposed alternative. Source leaderboard constants lack subset and metric context, so they are not an independently validated blend gain. Files are cbinded positionally after ID sorting.
Join ensemble predictions by sample identifier
Conditions
- multi-output predictions with continuous coordinates and a categorical label
Action
- Proposed: join predictions on path, average only continuous outputs, and choose the categorical output from a named component.
Check
- Proposed: assert unique and complete path keys on both sides before the join and compare each output-specific blend on validation.
Limits
- The source gives fixed weights without ablation. An inner join may silently discard missing paths unless completeness is separately checked.
Record promising but unselected ensembles separately
Conditions
- an ensemble gains on retrospective feedback without local support
Action
- Proposed adaptation of source observation: Keep unselected alternatives in the experiment record and choose by the established validation protocol.
Check
- Proposed verification: Compare OOF blend against components and record final-selection status.
Limits
- Private score was unavailable for selection; no universal rejection of blending follows.
Compare a larger ensemble component with its full compute cost
Conditions
- a substantially larger VLM is proposed as an ensemble component
Action
- Proposed recipe: compare its contribution against the existing smaller model and account for additional GPUs and runtime.
Check
- Proposed check: Compare smaller-only and blended systems on identical video holdouts, record total GPU-hours, latency and memory, and quantify marginal output gains.
Limits
- Reported durations and hardware are source configuration/run descriptions, not a controlled timing benchmark; eight-GPU availability constrains feasibility.
Constrain probability blending weights on the simplex
Conditions
- multiclass validation probability arrays share row and class order
Action
- Proposed: optimize softmax-normalized ensemble weights against validation log loss.
Check
- Proposed: use independent validation to assess selected weights and verify component probability normalization plus row/class alignment.
Limits
- Test inference replaces some validation components with bagged versions, so selected weights transfer to altered predictors without independent evidence here.
Combine folds and backbone families with soft voting
Conditions
- multiple validated image backbones and folds are available
Action
- Proposed recipe: compare a probability-voting ensemble against each strong component.
Check
- Proposed check: Compare each strongest component, fold-only ensemble and multi-backbone voting on untouched folds, with load time and serving cost.
Limits
- Thirty checkpoints incur substantial cost; later private scores cannot guide predeadline selection.
Preserve component scales before a historical weighted blend
Conditions
- separate predictors produce outputs on differing scales
Action
- Proposed: standardize component outputs before testing a weighted average.
Check
- Proposed: fit any calibration or standardization using legitimate validation predictions; compare the blend to both components and inspect probability calibration.
Limits
- The README does not specify the standardization formula or its fitting data. The historical weights are not general defaults; rank is an author label.
Begin ensemble selection before the model library is complete
Conditions
- ensemble-library training is long-running
Action
- Proposed adaptation of author advice: Store completed model predictions and run selection incrementally rather than waiting for every model.
Check
- Proposed verification: Track marginal blend score and completion status for reproducibility.
Limits
- Early selection can bias choices toward fast models unless later additions are retested.
Interpolate reasoning checkpoints for accuracy and response cost
Conditions
- compatible checkpoints trade tool reasoning accuracy against response length
Action
- Proposed adaptation of source observation: Sweep linear CoT/TIR checkpoint mixtures and track majority accuracy, tokens and tool executions jointly.
Check
- Proposed verification: Use the same held-out problems and sampling count for every mixture and both components.
Limits
- Weights are source-specific and checkpoint compatibility is required; benchmark gains need target-task replication.
Select domain-pretrained models by incremental ensemble benefit
Conditions
- image ensembles contain models with distinct pretraining sources
Action
- Proposed adaptation of source observation: Test domain-pretrained members by their OOF blend contribution and select using consistent CV.
Check
- Proposed verification: Compare component and blend metrics and error correlation on the same folds.
Limits
- The claim that CropNet caused victory is attributed; no numerical isolated ensemble ablation is given.
Require validation contribution before adding ensemble members
Conditions
- several model families may add redundant prediction signals
Action
- Proposed adaptation of source observation: Test each model’s marginal OOF ensemble contribution rather than adding all trained families.
Check
- Proposed verification: Compare component, leave-one-model-out and final ensemble under consistent validation.
Limits
- The neural-network gain is qualitative and did not hold in other contests for the author.
Select molecular ensemble components separately by target and memory limits
Conditions
- molecular targets have different molecule-size and model-suitability distributions
Action
- Proposed adaptation of source observation: Track memory by molecule size and select ensemble membership per property rather than using every model for all targets.
Check
- Proposed verification: Evaluate target-wise incremental quality, excluded-size coverage and peak memory.
Limits
- The atom threshold and FFV failure are local; filtering large molecules may introduce distribution bias.
Add a specialist model for underrepresented taxonomic groups
Conditions
- rare groups lack representative training species
Action
- Proposed conditional application: Train a separate model on expanded Amphibia and Insecta species, and align only target-species columns for ensembling.
Check
- Proposed check: Compare specialist inclusion on rare-group holdouts; verify label mapping and zero-filled non-target columns.
Limits
- Expanded species training and specialist inference add cost; outside-species transfer is unproven.
Bag bootstrapped image estimators with distinct seeds until gains saturate
Conditions
- image regression has high single-estimator variance
- independent bootstrapped gaze models show variance
Action
- Proposed adaptation of source observation: Train distinct-seed bootstrap members and track incremental average-ensemble quality against compute.
- Proposed conditional application: Use distinct seeds for bootstrap models, average predictions, and monitor saturation around ten to thirty components.
Check
- Proposed verification: Use subject-disjoint validation and compare uncertainty and performance as ensemble size grows.
- Proposed check: Plot untouched validation gain and serving cost against ensemble size with distinct seeds and identical training availability.
Limits
- Subject splitting is proposed; plateau and runtime depend on this setup.
- The reported plateau is leaderboard-scoped; each model took 30–40 minutes on a K80 and thirty is not a universal limit.
Compare scale-normalized target models as ensemble components
Conditions
- building consumption varies with floor area
Action
- Proposed conditional application: Train on log1p(meter_reading/square_feet) alongside the raw log target and test ensemble diversity.
Check
- Proposed check: Invert both target transforms to original units before comparing and blending on blocked holdouts; inspect area-zero handling.
Limits
- Requires positive reliable floor area; gain is ensemble-specific and evaluation metric/split is not explicit in quoted span.
Bag independently downsampled negative datasets
Conditions
- negative examples dominate a binary click dataset
Action
- Proposed adaptation of source observation: Train repeated negative subsamples and compare prediction averaging with a single subsample.
Check
- Proposed verification: Measure held-out ranking and calibration at the natural class prevalence.
Limits
- Downsampling is hard-coded as expected by this repository; no sampling ratio or bagging gain is reported.
Test complementary representations despite weaker standalone scores
Conditions
- image models expose complementary spatial and frequency information
Action
- Proposed conditional application: Train spatial YCbCr and one-hot encoded DCT models, then fit a second-level network on their GAP bottleneck features.
Check
- Proposed check: Fit the second-level network without validation-label leakage; compare combined predictions against each representation on identical splits and inspect error complementarity.
Limits
- DCT encoding and a second-level network add implementation and training cost.
- Lower standalone score is insufficient justification: incremental held-out gain is required.
- The linked observation establishes the practice; comparison table requires a separate literal observation to export numeric evidence.
Carry original features and lower-level OOF predictions into deeper stacks
Conditions
- a sufficiently large dataset supports multilayer stacking
Action
- Proposed conditional application: Train stack levels on out-of-fold predictions and feed first-level predictions plus selected raw features into the highest level.
Check
- Proposed check: Ablate skip inputs and extra levels on nested untouched holdout; record AUC and total inference cost.
Limits
- Repeated stacking selection can overfit; full historical run took weeks and high memory.
Check alignment before averaging saved arrays
Conditions
- prediction files carry arrays without embedded example IDs
Action
- Proposed: verify identical row and class order before averaging stored predictions.
Check
- Proposed: store and compare row IDs, class vocabulary and shapes for every component before averaging.
Limits
- Alignment checks are proposed; the script itself only averages arrays.
Evaluate a blend of independent solution pipelines
Conditions
- Two solution pipelines target the same regression outputs.
Action
- Proposed conditional application: Preserve the component identities; the source used0.6AutoGluon and0.4public solution.
- Proposed conditional application: Treat those weights as a competition example rather than defaults.
Check
- Proposed check: Generate aligned out-of-fold component predictions, select weights on inner validation, and compare blend with both components on untouched measurements.
Limits
- Source's0.6/0.4are examples; pipeline complementarity and isolated gain are not demonstrated.
Accumulate OOF and test predictions with different denominators
Conditions
- multi-seed K-fold bagging produces one holdout prediction per seed and K test predictions per seed
Action
- Proposed: write holdout predictions at their original indices and normalize OOF by seeds but test by folds times seeds.
Check
- Proposed: assert each training row is predicted once per seed and every component shares class order; evaluate grouped spatial folds if neighboring points are dependent.
Limits
- ExtraTrees median imputation is fitted before folds, and random point stratification may not match spatial generalization. Source comments claiming usually better are not measured results.