A hotel-booking team at a travel site like Expedia asks: what are the advantages of logistic regression versus a random forest, and when would you pick each? Cover linearity assumptions, probability calibration, interpretability, and nonlinear feature interactions.

The Problem: A travel site must rank hotel listings by P(book) times commission in a flagship market with 48,000 bookings and a new market with only 150. The random forest beats logistic regression on flagship holdout AUC, 0.752 to 0.708, yet a partner wants a stated price effect and nobody has decided which model belongs where.
Answer
Logistic regression (LR) models the log-odds of the outcome as a linear function of the features. That makes it low-variance, cheap to serve, well calibrated when fit by log loss, and readable through one odds ratio per feature, but it only sees the nonlinear shapes and interactions you engineer into its inputs. A random forest (RF) averages hundreds of deep, decorrelated trees, so it finds thresholds and feature interactions on its own and usually wins on discrimination once data is plentiful. Its costs are higher variance on small samples, flat extrapolation outside the training range, and probabilities squeezed toward the middle that need recalibration before any expected-value use. Pick LR when positive events are scarce, when the probability itself is consumed downstream, or when someone needs a stated effect size. Pick RF plus isotonic calibration when you have tens of thousands of events, strong interactions, and ranking quality is the metric.
(1) Linear In The Log-Odds: LR assumes each feature shifts the logit by a constant amount per unit, not that features are Gaussian or that probability is linear. Curvature such as diminishing price sensitivity must enter through engineered features like log price, splines, or buckets, and a missed shape becomes systematic bias that more data never fixes.
(2) Interactions For Free Versus By Hand: A forest that splits on lead time and then on price inside each branch has learned a price by lead-time interaction without being told. LR needs an explicit product term for each one, and 40 features already imply 780 candidate pairs.
(3) Calibration: LR fit by log loss with an intercept is calibrated in the large by construction and usually per bucket when well specified. Forest scores are averages of noisy leaf fractions that rarely reach the extremes, so they need Platt scaling or isotonic regression on held-out data.
(4) Interpretability: An LR coefficient is a global effect size, readable as an odds ratio per unit of the feature. A forest needs permutation importance, partial dependence, or SHAP, and its default impurity importance is biased toward high-cardinality features such as hotel ID.
(5) Data Regime: LR estimates one parameter per feature and has low variance, so it usually wins with a few hundred positive events. Forest accuracy keeps climbing with data, so the learning curves cross, typically somewhere in the low thousands of events.
Mathematical Formulation:
Where:
is the predicted booking probability for feature vector
,
is the log-odds,
the coefficient vector,
the intercept, and
the logistic function.
and
are two features such as log price and lead time;
is the interaction coefficient LR only gets if you add the product column, while a forest captures it through nested splits.
is the L2-penalized log loss over
training sessions indexed by
,
the per-session log-likelihood,
the booking label,
, and
the shrinkage strength.
- The intercept condition holds because
is unpenalized: at the optimum the predicted probabilities sum to the observed bookings, which is calibration in the large.
is the multiplicative change in booking odds per one-unit increase in feature
, holding the others fixed.
is the fraction of bookings in the leaf of tree
that
falls into, averaged over
bootstrapped trees (
here).
is the expected revenue used for ranking and
the listing’s commission, so any distortion in
flows straight into revenue.
The intercept equation is the quiet reason LR is trusted for probabilities. When the logit is correctly specified, the same log-loss fit also makes the model calibrated bucket by bucket, not just on average. A forest has no comparable condition. Each leaf fraction is a noisy estimate, and bagging averages trees that disagree, so scores for genuinely likely or genuinely unlikely bookings are pulled toward the middle of the range. Niculescu-Mizil and Caruana documented this sigmoid-shaped distortion and showed that Platt scaling or isotonic regression on held-out data removes it.
Worked Example:
Listing A truly books with probability 0.10 and pays $30 commission, so its expected revenue is $3.00. Listing B books with probability 0.02 and pays $120, so it is worth $2.40, and A should rank first. A raw forest scores them 0.085 and 0.030, giving 0.085 x 30 = $2.55 for A and 0.030 x 120 = $3.60 for B, so B jumps ahead. A well-specified LR, or the forest after isotonic calibration, returns roughly 0.10 and 0.02 and restores the correct order. AUC is identical in both cases because A still outscores B, which is why AUC cannot detect the miscalibration that just cost revenue.

Figure 1: (a) Reliability of booking probabilities: logistic regression tracks the diagonal, while raw forest scores are squeezed toward the middle, so listing A scored 0.085 books 10% of the time and listing B scored 0.030 books 2%. (b) Holdout AUC against training bookings: LR leads below roughly 900 bookings and the forest leads above, reaching 0.752 against 0.708 at 48,000. Curves are schematic, shaped after the learning-curve crossover reported by Perlich et al.
The full trade-off on the axes interviewers usually probe:
| Property | Logistic regression | Random forest |
|---|---|---|
| Functional form | Linear in log-odds; curvature only through engineered features (log price, splines, buckets) | Piecewise-constant, axis-aligned splits; monotone transforms of a feature change nothing |
| Interactions | Added by hand; 40 features imply 780 pairwise terms | Learned automatically by nested splits (lead time, then price) |
| Calibration | Calibrated in the large by construction; good per bucket when well specified | Scores squeezed toward the middle; needs isotonic or Platt on held-out data |
| Interpretability | One coefficient per feature, read as an odds ratio; unstable under collinearity | Permutation importance, SHAP, partial dependence; impurity importance favors high-cardinality IDs |
| Small data | Few parameters, low variance; usually wins below about 1,000 events | Deep trees memorize; needs thousands of events to pay off |
| Extrapolation | Keeps the fitted slope beyond the training range | Flat beyond the last split threshold |
| Preprocessing | Scaling, one-hot encoding, imputation, collinearity checks | Little: no scaling, robust to outliers and skewed features |
| Serving cost | One dot product, kilobytes of weights | 500 tree traversals, often hundreds of MB at full depth |
Leave a Reply