The Claude Quant PlaybookDownload ebookDownload ebook

Family 5 of 9 · 10 formulas · each in 3D

Regression and machine learning

Fitting lines and planes, measuring fit, shrinking coefficients, descending gradients and finding the main directions in data. Most quant signals are a regression in disguise. Knowing how fits fail is how you avoid a model that only works on the past.

Build a trading system with Claude.Download ebook

Showing all 10

  1. 01beginner

    Least-squares slope

    The straight line that makes the squared vertical errors as small as possible. Its slope is the covariance of x and y divided by the variance of x.

    Used by quant researcher: Regresses next-day returns on a signal; the slope says how many percent of return each unit of signal is worth.

    Full lesson
  2. 02advanced

    Least squares in matrix form

    The same least-squares fit as a straight line, but with many signals at once. Solving the normal equations gives every coefficient together, each one measured holding the others fixed.

    Used by quant researcher: Fits a return forecast on several signals at once, so a signal only gets credit for what the others do not already explain.

    Full lesson
  3. 03beginner

    R-squared

    R² compares the errors of your line with the errors of the dumbest forecast, the average. It says what share of the variation in y the model accounts for.

    Used by quant researcher: Checks how much of next-day return a signal explains; in markets even a fraction of a percent can be worth trading.

    Full lesson
  4. 04advanced

    Ridge regression

    Least squares with a charge on the size of the coefficients. It pulls every coefficient towards zero, most of all along directions where the data say little.

    Used by quant researcher: Fits forecasts on many overlapping signals without the coefficients exploding in opposite directions.

    Full lesson
  5. 05advanced

    Lasso regression

    Like ridge, but the penalty is on absolute size. That sharp corner at zero makes the lasso switch weak signals off completely, so it picks a short list of signals for you.

    Used by quant researcher: Starts from hundreds of candidate signals and lets the lasso keep the handful that carry independent information.

    Full lesson
  6. 06intermediate

    Gradient descent

    Find the bottom of a loss by repeatedly stepping downhill. Each step moves the coefficients against the gradient, scaled by the learning rate.

    Used by quant researcher: Trains neural nets and other large models on market data, where there is no closed-form answer.

    Full lesson
  7. 07intermediate

    Logistic regression

    A model for yes-or-no outcomes. It fits a straight line to the log-odds and turns it into a probability with the S-shaped sigmoid.

    Used by quant researcher: Predicts the direction of the next move, or whether an order will be filled, from a handful of signals.

    Full lesson
  8. 08advanced

    Bias–variance trade-off

    Out-of-sample error splits into three parts: bias from a model that is too simple, variance from a model that chases noise, and noise nobody can remove. Making a model more complex trades one for the other.

    Used by quant researcher: Chooses how many signals or how deep a model to use by finding where test error stops falling.

    Full lesson
  9. 09advanced

    Principal component analysis

    PCA finds the directions along which data vary most. The first component is the longest stretch of the cloud, the second the longest stretch at right angles to it, and so on.

    Used by rates trader: Summarises moves across a whole yield curve by three components: level, slope and curvature.

    Full lesson
  10. 10intermediate

    k-nearest neighbours

    To predict at a new point, find the k most similar past examples and let them vote. Small k follows the data closely; large k averages over a wider area.

    Used by quant researcher: Forecasts from historical analogues: find the past days that looked most like today and see what happened next.

    Full lesson

Rather not code the maths yourself? Describe your trading idea and let AI build the bot.

Build a bot with AgenKit

Every model is drawn from the formula's own code, so what you see is the exact maths. Models simplify markets on purpose. This is education, not financial advice.