Lesson 20 · Practical engineering
Choosing a model for tabular data
The problem
The pizza shop wants to warn customers whose pizza will be late. It has a table of past orders: distance, traffic, rain, the hour, the number of items and the driver, and whether each one was late.
This course has taught eight ways to answer that question. Each one could be trained on this table in a few lines of scikit-learn. Which should you try first? How will you know if it's any good? And what does each one cost you, beyond its accuracy?
This lesson is a practical guide to those choices. It puts every model from the course on the same data, side by side. The Choosing an architecture lesson in Neural-net foundations asks the other question: trees or a network? Here we stay with the classical models.
Start with a baseline
Predict first
A model gets 91% of late-or-not calls right. Is it a good model?
The thing to compare with is a baseline: the simplest sensible model, such as "predict the average" or "always the commonest class". A real model must beat it to be worth anything.
Build two baselines before anything else:
- A model with no skill. For classes, always predict the commonest one. For numbers, always predict the average. scikit-learn calls these
DummyClassifierandDummyRegressor. - A simple model. Logistic regression for classes, or linear regression for numbers, with scaled features. It takes seconds and is hard to get badly wrong.
The first says whether there's anything to learn. The second says what an easy win looks like. Any fancier model has to beat both, on the same held-out rows (see train, validation and test sets).
Worked example
Is 91% good? Two baselines
The first nine months of deliveries. 93 of 900 were late. "Always on time" gets the other 807 right: .
A third number helps when you can get it: the best possible score. With real data you never know it exactly. But two people labelling the same rows, or the noise in repeated measurements, give a rough ceiling. If a model is already near it, stop tuning and spend the time elsewhere.
Every model on one picture
Here is every classifier from the course on the rush-hour data from the boundary lessons: distance and the time sent, late or not. Each was trained on the same 200 deliveries with common settings, and scored on the same 200 new ones.
Baseline (commonest class)
validation 46.5%
Logistic regression
validation 76.0%
Naive Bayes
validation 81.5%
Decision tree
validation 91.0%
Boosted trees
validation 91.0%
Random forest
validation 92.5%
RBF SVM
validation 93.5%
kNN
validation 94.5%
Each picture: time sent across (17:00–23:00), distance up (0–8 km); ○ on time, × late. Shading is P(late); for the SVM it's a squashed score, not a probability. Sorted from worst to best.
Things to notice:
- The baseline ignores the picture and says "late" everywhere: 46.5%.
- Logistic regression draws one straight line (76%). Naive Bayes bends a little, but it can't make the dip at 19:00 either (81.5%).
- The other five all find the dip, each in its own style. The tree makes a staircase (91%), and boosted trees a smoother one (91%). The forest blurs its edges (92.5%), and the SVM curves smoothly (93.5%). kNN follows every local crowd (94.5%).
- The five are within 3.5 points of each other. With 200 validation deliveries, one delivery is half a point. Small gaps here are mostly luck.
The settings differ a little from the lessons where each model was taught, so the numbers can differ by a point. On two features, the flexible models all do well. The differences between them show up with more columns, more rows, and the costs that accuracy leaves out.
When to use what
The table sums up each model's strengths and costs. These are rules of thumb, not laws.
| Model | Good at | Needs | Fails when |
|---|---|---|---|
| Logistic or linear regression | Few rows; many columns; explaining decisions | Scaled features; features built for bumps and curves | The pattern bends, like the 19:00 dip |
| Naive Bayes | Word counts; few rows; speed | Features that are roughly independent within each class | You need its probabilities: they're too extreme |
| kNN | Few, meaningful columns; odd-shaped boundaries | Scaled features; choosing | There are many columns, or answers must be fast |
| Decision tree | A few readable rules | A depth or leaf-size limit | Used alone for accuracy: it's jumpy |
| Random forest | Good results with almost no tuning | Memory for hundreds of deep trees | Model size or answer speed matters |
| Boosted trees | Most tables, from a thousand rows up | Early stopping; some tuning | Rows are few, or someone must follow each decision |
| RBF SVM | Small and medium tables with few columns | Scaled features; tuning and C | Rows pass a few tens of thousands; you need probabilities |
What about a small network, an MLP? It can match the boosted trees on big tables, but it needs far more rows and tuning. The Neural-net foundations lesson measures that.
How many rows?
The rush-hour data has only 2 features and 200 rows. Real tables are bigger. So switch to the deliveries table, with its 6 columns. Draw training sets of 100 to 30,000 rows from the same generator, and test every model on 3,000 fresh rows.
The driver stays a single numbered column here, not one-hot encoded as the features lesson advises. That's on purpose: the driver has no effect on lateness, so it's noise either way.
Predict first
An RBF SVM takes 0.8 seconds to train on 10,000 rows. About how long does it take on 30,000, three times as many?
| Model | Accuracy | Train (ms) | Answer 1k (ms) |
|---|---|---|---|
| Baseline | 48.7% | 0.27 | 0.01 |
| Logistic | 88.6% | 7.4 | 0.20 |
| Naive Bayes | 88.2% | 0.98 | 0.15 |
| kNN | 86.8% | 3.3 | 13 |
| Tree | 88.9% | 2.5 | 0.11 |
| Forest | 89.6% | 130 | 6.8 |
| Boosted trees | 90.0% ★ | 29 | 1.6 |
| RBF SVM | 89.2% | 9.7 | 9.0 |
Accuracy is on 3,000 fresh deliveries; ★ marks the best. “Answer 1k” is the time to predict 1,000 new rows. Times are in milliseconds, the median of 3 runs on one computer: compare them with each other, not with your own machine. The data has random noise, so about 91% is the best any model can do.
Things to notice:
- With 100 rows, the simple and the averaged models hold up. Boosted trees score 88.7%, logistic regression 88.2% and the forest 87.7%. A single tree manages only 78.3%: it fits the noise in so few rows. With only 100 rows, the order of the simple models depends on which rows you draw. Averaged over several draws, as in the Neural-net foundations lesson, logistic regression edges ahead.
- Logistic regression stops at about 88.5%, no matter how many rows it gets. Its straight line in the hour can't make the rush-hour bump. Add a "rush hour: yes or no" column and it scores 91.1% at 3,000 rows, level with the boosted trees (feature engineering).
- Boosted trees lead at every size, and reach 91.4% at 30,000. That's as close as anything gets to the best possible on these 3,000 test rows, 91.3%. Any score above it is luck in the test rows.
- The SVM catches up slowly (90.6% at 30,000) but takes 6.1 seconds to train, 25 times as long as the boosted trees.
- kNN trains in milliseconds but answers slowly. It must search every stored row for each new one. Answering 1,000 orders takes it 17 ms, against 0.21 ms for logistic regression. The SVM is slower still, at 240 ms, because it compares each new row with every support vector.
The times were measured on one computer, so only their sizes relative to each other matter. A real system might answer one order at a time, or millions an hour. For a few hundred orders an evening, every model here is fast enough. For an ad server answering thousands of requests a second, the difference between 0.2 and 240 ms per thousand decides the choice.
Rows per column
Data size isn't only rows. What matters is rows compared with the number of columns, and with how complicated the pattern is. A rough guide:
- Few rows, or many columns per row (say, under 10 rows per column): use a model with few weights and a penalty. That means ridge, lasso, regularised logistic regression or naive Bayes.
- Thousands of rows and a few dozen columns: boosted trees or a forest.
- Hundreds of thousands of rows: boosted trees that bin their columns (LightGBM, XGBoost's
histmethod, scikit-learn'sHistGradientBoostingClassifier). Kernel SVMs and plain kNN get too slow.
Useless columns
Real tables carry columns that don't matter, like the driver in the deliveries table. Some models shrug them off. Others are thrown by them.
Predict first
You add 50 columns of random numbers to the 6 real ones. Which model loses the most accuracy?
1,000 training rows; 6 real columns plus 0 columns of random numbers. The thin line marks each model's accuracy with no noise columns; pink bars have lost more than 3 points. In brackets: the change in percentage points.
Things to notice:
- kNN falls fastest: 86.8%, then 85.0% with 5 noise columns, 80.5% with 20 and 73.8% with 50.
- A single tree falls too, from 88.9% to 82.4%. With 50 extra columns, some split on noise looks good by chance in a small group of rows.
- The forest loses about 2 points. Each split chooses from a random subset of the columns, so with many noise columns it often has only noise to choose from.
- Boosted trees and logistic regression barely change. These are the two to reach for when a table has many columns of doubtful use.
So clean out columns that can't matter, such as IDs and row numbers, before fitting a distance-based model. A model's permutation importance helps find the rest.
Beyond accuracy
Accuracy is one column of several. Four more decide many real choices.
Can you explain a decision?
Sometimes a person needs to know why. A customer was refused a loan, or a patient sent home. Then the model must give a reason someone can check.
- Linear and logistic regression give one weight per column. After scaling, you can read off how much each column pushed this decision.
- A small tree is a handful of yes/no rules. Anyone can follow a decision down it.
- Forests, boosted trees, kNN and kernel SVMs give no reason a person can follow. Permutation importance says which columns the model relies on overall, but not why it made this one call.
There's usually a trade: the readable models are a little less accurate. On the deliveries table, plain logistic regression gives up about 2.5 points to the boosted trees. One well-built column wins them back, as the benchmark showed. Whether the remaining gap, if any, is worth it is a question about the job, not about the data.
Can you trust the probabilities?
If the shop texts "70% chance your pizza is late", 70% had better be right. That's calibration.
Here is each model at 3,000 rows. The calibration gap is the average distance between what a model says and what happens, over 10 bins of its predictions. Log loss is the cross-entropy loss on the test rows. Lower is better for both.
| Model | Calibration gap | Log loss |
|---|---|---|
| Boosted trees | 0.009 | 0.203 |
| Random forest | 0.012 | 0.271 |
| Logistic regression | 0.019 | 0.242 |
| kNN ( = 15) | 0.038 | 0.306 |
| Decision tree | 0.052 | 1.447 |
| Naive Bayes | 0.083 | 0.296 |
- Boosted trees and logistic regression are trained on cross-entropy, so their probabilities come out close to right.
- A single tree's log loss is terrible. Many of its leaves hold only a few rows, all late or all on time, so it says 0% or 100%. One confident miss costs a lot.
- Naive Bayes is overconfident. Columns that carry the same evidence get counted twice, as its lesson showed.
- By default an SVM gives only a score;
probability=Trueadds a calibration step inside.
If you need probabilities from a model that's off, repair them on held-out rows with CalibratedClassifierCV, as in the measuring-success lesson.
Missing values and categories
Real tables have blanks and names. Models differ in what they accept as they are.
- Missing values. XGBoost,
HistGradientBoostingClassifier, and scikit-learn's trees and forests handle blanks themselves: each split learns which way to send them. Most other models need missing values filled in first, inside a pipeline. - Categories. Linear models, kNN and SVMs need one-hot encoding. Trees can also work with categories coded as numbers, because they split one column at a time.
HistGradientBoostingClassifierand CatBoost can split on categories directly. - Scaling. kNN, SVMs and penalised linear models need scaled features. Trees and naive Bayes don't.
Upkeep
A model has to be stored, served, monitored and retrained. Logistic regression is a few numbers in a file. A forest of 100 deep trees can take megabytes. kNN has to keep every training row. And a blend of ten models means ten things that can break. The case of the Netflix Prize, below, shows how much that can matter.
A recipe
For a new table, a sensible order of work:
- Set aside a test set, and decide how to split: random rows, by time or by group (see the evaluation lesson, time-based splits).
- Fit the no-skill baseline.
- Fit logistic or linear regression in a pipeline with scaling, filling blanks and one-hot encoding.
- Fit gradient-boosted trees with early stopping.
- Tune the best one or two with cross-validation, all on the same folds.
- Check calibration if anyone will read the probabilities.
- Pick the simplest model within noise of the best. If logistic regression is within the fold-to-fold spread of the trees, keep logistic regression.
- Score the winner on the test set, once.
The guide below turns the rest of this lesson into four questions.
Try first
Gradient-boosted trees (XGBoost, LightGBM or HistGradientBoosting)
The usual winner on tables: no scaling, mixed columns, useless columns and missing values all handled.
Baseline to beat
Always predict the commonest class (or the average), then logistic or linear regression.
Also try
A random forest: nearly as good, with less to tune.
Avoid
Kernel SVMs past a few tens of thousands of rows: training time grows faster than the rows.
Rules of thumb, not laws. Whatever you pick, compare it with the baseline on the same validation folds.
Case studies
The Netflix Prize: the most accurate blend wasn't used
In 2006 Netflix offered $1 million to anyone who could predict its customers' film ratings 10% better than its own system. Thousands of teams entered.
A year in, the team called Korbell won the first Progress Prize with an 8.43% improvement. Xavier Amatriain and Justin Basilico of Netflix described what happened next in a 2012 Netflix Tech Blog post. Amatriain told it again in a 2013 paper, "Big & Personal: data and models behind Netflix recommendations".
The team reported more than 2,000 hours of work, and their final answer blended 107 models. Netflix took the two best single models from that blend and put them into production. Even that took work: they were built for 100 million ratings, and Netflix had more than 5 billion.
The Grand Prize was won in 2009 by a blend of hundreds of models. Netflix tested some of the new methods. In Amatriain's words, the extra accuracy "did not seem to justify the engineering effort needed to bring them into a production environment."
The lesson: accuracy has a price. A blend of hundreds of models is a large system to build, run and keep correct. Past a point, the last fraction of a percent isn't worth it.
Boosted trees in competitions, and 179 classifiers
When Tianqi Chen and Carlos Guestrin introduced XGBoost ("XGBoost: A scalable tree boosting system", KDD 2016), they counted its use in competitions. Of the 29 winning solutions published on Kaggle's blog during 2015, 17 used XGBoost. Eight used it alone; deep networks appeared in 11. In the KDD Cup 2015, every team in the top 10 used XGBoost.
An earlier study took a broad view. Fernández-Delgado and colleagues asked "Do we need hundreds of classifiers to solve real world classification problems?" (Journal of Machine Learning Research, 2014). They ran 179 classifiers from 17 families on 121 datasets. Random forests came out best: the top one reached 94.1% of the maximum accuracy, the best any classifier got on each dataset. An RBF SVM was close behind, at 92.3%, and the gap between the two wasn't statistically significant.
Both point the same way: tree ensembles are the safe first choice for a table. Neither is a law. The 2014 study left out the largest datasets, and competitions reward the last fraction of a point, which real projects often don't need.
The pneumonia model that said asthma was good for you
In the mid-1990s, a large project tried to predict which pneumonia patients were likely to die, so the low-risk ones could be treated at home. Rich Caruana and colleagues told the story in "Intelligible Models for HealthCare" (KDD 2015).
The most accurate models were neural networks. But a rule-based model, tested alongside them, learned the rule "has asthma ⇒ lower risk". The pattern was real in the data. Asthmatic patients with pneumonia were usually sent straight to intensive care, and that care worked, so they died less often.
A model that sent asthmatics home would have been dangerous. Because the rules were readable, someone could spot the rule and remove it. Nobody could see whether the networks had learned the same thing, and they almost certainly had. So the project judged the networks too risky to use on patients, and used logistic regression instead.
The lesson: a model learns whatever separates the labels in the data, including patterns created by past decisions. When a decision matters, being able to read the model can be worth some accuracy.
The pizza shop's late-warning model (a made-up example)
This one is invented, to show the recipe at work.
The shop builds its late-warning model on 3,000 past orders. Always saying "on time" scores 51%. Logistic regression scores 88.5%, and boosted trees 91%. The trees win, and the shop ships them.
A month later, the dispatchers ask why a short trip at 21:00 was flagged. Nobody can say. The shop adds a rush-hour column to the logistic regression, and it scores 91% too. The shop switches back, because a dispatcher can read each warning's reasons off the weights. A better column cost nothing in accuracy and bought a model the people using it trust.
Pitfalls checklist
The mistakes that cost the most, roughly in order:
- No baseline. You can't tell whether 91% is good until you know what doing nothing scores.
- Choosing on the test set. Compare models with validation data or cross-validation; open the test set once.
- Forgetting to scale for kNN, SVMs and penalised linear models. Trees don't need it; these do.
- Trusting built-in feature importance. It can credit useless columns. Use permutation importance on held-out rows.
- Reading tiny gaps as wins. Compare models on the same folds, and treat gaps smaller than the fold-to-fold spread as ties.
- A kernel SVM or kNN on a big table. Training or answering gets slow; boosted trees scale far better.
- Useless columns in a distance-based model. Drop IDs and row numbers before kNN or an SVM.
- Quoting probabilities nobody checked. Look at a reliability diagram first.
- Ignoring cost. A model 0.5 points better but 100 times slower to answer, or impossible to explain, may be the wrong choice.
In scikit-learn
Every model in the lesson, as scikit-learn estimators. Models that use distances or weight sizes get a StandardScaler in front, in a pipeline:
def make_models(knn_k: int = 15, svm_gamma: float | str = "scale") -> dict[str, ClassifierMixin]:
"""Every classifier in the course, with common settings. Models that use distances or
weight sizes get a StandardScaler in front; trees and naive Bayes don't need one."""
return {
"baseline": DummyClassifier(strategy="most_frequent"), # always the commonest class
"logistic": make_pipeline(StandardScaler(), LogisticRegression()),
"naive Bayes": GaussianNB(),
"kNN": make_pipeline(StandardScaler(), KNeighborsClassifier(n_neighbors=knn_k)),
"tree": DecisionTreeClassifier(min_samples_leaf=5, random_state=0),
"forest": RandomForestClassifier(n_estimators=100, random_state=0, n_jobs=1),
"boosted": XGBClassifier(n_estimators=200, max_depth=3, learning_rate=0.1, random_state=0, n_jobs=1),
"SVM": make_pipeline(StandardScaler(), SVC(kernel="rbf", C=1.0, gamma=svm_gamma)),
}DummyClassifier(strategy="most_frequent")is the no-skill baseline.DummyRegressor()predicts the average.XGBClassifierfollows the samefitandpredictinterface, so it can sit in the same dictionary and pipelines.n_jobs=1keeps the forest and the boosted trees on one core, so the times compare fairly.
The baselines on the rush-hour data:
def baseline_check(x_train, y_train, x_test, y_test) -> dict[str, float]:
"""The first thing to fit: a model that ignores the features. Anything else must beat it."""
lazy = DummyClassifier(strategy="most_frequent").fit(x_train, y_train)
simple = make_pipeline(StandardScaler(), LogisticRegression()).fit(x_train, y_train)
return {"always the commonest class": lazy.score(x_test, y_test), "logistic regression": simple.score(x_test, y_test)}rush-hour, always the commonest class: 46.5%
rush-hour, logistic regression: 76.0%The benchmark loops over training sizes and models. clone makes a fresh, untrained copy of a model, so each fit starts from scratch:
def benchmark(sizes: list[int], test_seeds: range = range(500, 510), timed: bool = True) -> dict:
"""Test accuracy, and (if timed) fit and predict times, for every model at each training size.
Training rows come from seeds 100 onwards; the 3,000 test rows from seeds 500-509."""
x_test, y_test = delivery_table(test_seeds)
pool_x, pool_y = delivery_table(range(100, 100 + max(sizes) // 300 + 1))
out: dict[str, dict[str, list]] = {}
for n in sizes:
x, y = pool_x[:n], pool_y[:n]
for name, model in make_models().items():
row = out.setdefault(name, {"accuracy": [], "fit_ms": [], "predict_ms": []})
fit_s, predict_s = [], []
for _ in range(3 if timed else 1): # times wobble, so keep the median of 3 runs
t0 = time.perf_counter()
fitted = clone(model).fit(x, y)
t1 = time.perf_counter()
pred = fitted.predict(x_test)
fit_s.append(t1 - t0)
predict_s.append(time.perf_counter() - t1)
row["accuracy"].append(accuracy_score(y_test, pred))
if timed:
row["fit_ms"].append(float(np.median(fit_s)) * 1000)
row["predict_ms"].append(float(np.median(predict_s)) * 1000 * 1000 / len(x_test)) # per 1,000 rows
return outdeliveries: test accuracy by training rows
100 300 1,000 3,000 10,000 30,000
baseline 48.7% 48.7% 48.7% 51.3% 51.3% 51.3%
logistic 88.2% 88.5% 88.6% 88.6% 88.5% 88.3%
naive Bayes 82.6% 87.8% 88.2% 88.7% 88.9% 89.0%
kNN 83.7% 85.5% 86.8% 88.6% 89.9% 89.8%
tree 78.3% 84.9% 88.9% 89.4% 89.1% 89.8%
forest 87.7% 88.7% 89.6% 90.2% 89.5% 89.7%
boosted 88.7% 89.3% 90.0% 91.2% 91.2% 91.4%
SVM 84.7% 87.7% 89.2% 89.4% 90.1% 90.6%The baseline jumps from 48.7% to 51.3% because the commonest class in the training rows changes from "late" to "on time" as they grow. The script also prints the times; yours will differ from the figure's.
Adding noise columns is one np.hstack:
def useless_columns(extra: list[int], n: int = 1000, seed: int = 0) -> dict[str, list[float]]:
"""Test accuracy at n training rows after adding columns of pure noise."""
x_test, y_test = delivery_table(range(500, 510))
x, y = delivery_table(range(100, 100 + n // 300 + 1))
x, y = x[:n], y[:n]
rng = np.random.default_rng(seed)
out: dict[str, list[float]] = {}
for k in extra:
noise_tr, noise_te = rng.normal(size=(len(x), k)), rng.normal(size=(len(x_test), k))
xa, xb = np.hstack([x, noise_tr]), np.hstack([x_test, noise_te])
for name, model in make_models().items():
out.setdefault(name, []).append(accuracy_score(y_test, clone(model).fit(xa, y).predict(xb)))
return outuseless columns added, 1,000 training rows
logistic 88.6% 88.6% 88.6% 87.9%
naive Bayes 88.2% 88.6% 87.0% 86.8%
kNN 86.8% 85.0% 80.5% 73.8%
tree 88.9% 86.9% 85.3% 82.4%
forest 89.6% 89.1% 87.8% 87.3%
boosted 90.0% 89.1% 89.1% 90.0%
SVM 89.2% 87.7% 86.2% 87.7%And the one built column that lets logistic regression catch up:
def with_rush_flag(n: int = 3000) -> float:
"""Logistic regression with one built feature: 1 if the order was sent 18:00-19:59, else 0."""
def add_flag(x: np.ndarray) -> np.ndarray:
hour = x[:, COLUMNS.index("hour")]
return np.column_stack([x, (hour >= 18) & (hour <= 19)])
x, y = delivery_table(range(100, 100 + n // 300))
x_test, y_test = delivery_table(range(500, 510))
model = make_pipeline(StandardScaler(), LogisticRegression()).fit(add_flag(x), y)
return model.score(add_flag(x_test), y_test)logistic regression + rush-hour flag, 3,000 rows: 91.1%The script runs in under a minute. Most of that is the SVM on 30,000 rows.
Putting it together
The shop's late-warning model, following the recipe on 3,000 orders:
- Baseline: always "on time" scores 51.3% on fresh orders.
- Simple model: logistic regression, scaled, scores 88.6%. It can't make the rush-hour bump.
- Boosted trees: 91.2%, with no scaling, and within a whisker of the best possible 91.3%.
- Check the costs: 43 ms to train and 1.5 ms to answer 1,000 orders. Its calibration gap is 0.009, so its probabilities can be quoted.
- Decide: the trees are the most accurate and fast enough. If dispatchers need reasons, logistic regression with a rush-hour column scores 91.1%, as good as the trees, and its weights can be read.
Common misconceptions
"Pick the model with the highest accuracy." Also weigh training time, answer time, size, calibration and whether you must explain its decisions. The Netflix Prize's winning blend was never put into production.
"Boosted trees always win." They're the best first try on most tables. But on the rush-hour picture, kNN, the SVM and the forest beat them, and with 100 rows logistic regression was only half a point behind.
"Half a point better means a better model." With a few hundred validation rows, half a point is one or two rows. Compare on the same folds, and treat small gaps as ties.
"More columns can only help." 50 useless columns cost kNN 13 points. Distance-based models are the most exposed; boosted trees and penalised linear models the least.
"A model's probabilities are as good as its accuracy." A single tree is about as accurate as the forest. Its log loss is five times worse. Naive Bayes and SVM scores need calibrating before you quote them.
"Every model needs scaled features." Trees and naive Bayes don't. kNN, SVMs and penalised linear models do.
Recap
- Always build a baseline first: the no-skill model (commonest class or average) and a simple one (logistic or linear regression). A score means nothing without them.
- On a table, try gradient-boosted trees first. Here they led at every size, ignored useless columns, and they handle blanks.
- With few rows or many columns, a penalised linear model or naive Bayes is often as good, and far simpler.
- kNN and kernel SVMs need scaled, meaningful columns, and get slow as rows grow: kNN to answer, SVMs to train and answer.
- Accuracy is one cost of several. Weigh answer time, size, upkeep, calibration and whether decisions must be explained. These are rules of thumb.
- Pick the simplest model within noise of the best, and score it on the test set once.
- Python names in this lesson: scikit-learn's
DummyClassifier,DummyRegressor,LogisticRegression,GaussianNB,KNeighborsClassifier,DecisionTreeClassifier,RandomForestClassifier,SVC,HistGradientBoostingClassifier,CalibratedClassifierCV,make_pipeline,StandardScalerandclone; XGBoost'sXGBClassifier.