liveBook · Manning

Logit

As explained in Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI

The logit function maps a probability in (0,1) to its log-odds and is the inverse of the logistic sigmoid.

The logit function converts a probability into its log-odds: log(p/(1−p)). Unlike a probability, the resulting scale extends from negative infinity to positive infinity, making it suitable for regression-style optimization. The sigmoid function reverses this transformation and returns a value between zero and one. section 5.2.2 section 5.2.1

Use the logit to connect probability-based classification with regression and model optimization:

  • Transform binary-class probabilities into an unbounded target for regression-style learning. section 5.2.2
  • Support logistic regression, where the link function connects the linear model with probabilities and Bernoulli optimization. section 4.3.3
  • Represent gradient boosting corrections on the logit of class probability before applying the sigmoid. section 5.2.1

Implementing logits in gradient boosting

A NumPy implementation clips probabilities away from zero and one before calculating log(x/(1−x)). It initializes the model with the logit of the mean target, then uses the sigmoid to produce bounded predictions. This lets gradient boosting fit regression trees while returning classification probabilities. section 5.2.2

How Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI covers it

How deep it goes
Defines the log-odds mapping and demonstrates clipping, initialization, gradients, and sigmoid conversion in a working implementation.
Examples
Uses above-median binary classification, logistic regression pipelines, and a hand-built gradient boosting classifier.
What it assumes
Assumes familiarity with probabilities, binary classification, and basic regression or gradient-based optimization.
What you can do after
Apply it via NumPy to convert probabilities into logits and recover probabilities with the sigmoid.
How it connects
Connects probability, odds, sigmoid, logistic regression, Bernoulli distribution, gradient boosting, and regression trees.

Also explained in

Compare how 17 books explain logit →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI. The section links point to the parts of the book it draws on.