screen

Fit every algorithm on your data and rank them. Returns a leaderboard sorted by validation performance. One call replaces the manual loop.

Signature

ml.screen(data, target=None, *, algorithms=None, seed, sort_by="auto", time_budget=None, keep_models=True, engine="auto")
ml_screen(data, target, algorithms = NULL, seed = NULL, sort_by = "auto", time_budget = NULL, keep_models = TRUE, ...)

Parameters

ParameterTypeDefaultDescription
dataSplitResult | CVResult | DataFrameData to screen on. Prefer a SplitResult.
targetstrNoneTarget column (inferred from SplitResult)
algorithmslist | NoneNoneSubset of algorithms to try. None = all available.
seedintRandom seed
sort_bystr"auto"Metric to rank by. "auto" = roc_auc (classification), rmse (regression).
time_budgetfloat | NoneNoneMaximum seconds per algorithm. Skip slow ones.
keep_modelsboolTrueStore fitted models in the leaderboard for later use.

Returns

Leaderboard — a ranked DataFrame with metrics and timing. Access the best model with .best.

—— Leaderboard [classification] ——————
  algorithm         roc_auc  accuracy  f1      time_seconds
  xgboost           0.8721   0.8321    0.7680  0.42
  random_forest     0.8647   0.8244    0.7579  0.31
  logistic          0.8512   0.8130    0.7423  0.08
  naive_bayes       0.8201   0.7863    0.6987  0.02
  decision_tree     0.7634   0.7557    0.6543  0.01

Examples

Screen all algorithms

lb = ml.screen(s, seed=42)
print(lb)
best = lb.best  # best algorithm name
lb <- ml_screen(s, "target", seed = 42)
print(lb)
best <- ml_best(lb)

With time budget

# Skip any algorithm that takes more than 5 seconds
lb = ml.screen(s, seed=42, time_budget=5.0)
lb <- ml_screen(s, "target", seed = 42, time_budget = 5.0)