Every formula outside the Exploring notes is implemented somewhere on this platform. Some draw a Lab visualization, some check whether a forecast earned its confidence, and a couple keep a marathon training plan from ramping too fast. Each entry opens with what the formula is for in plain English, then shows the textbook form and where it lives. You can skip the notation and still follow along.
Information Theory
How evenly or how lopsidedly something is spread, boiled down to one number.
Shannon entropy (normalized)
Measures how evenly a total is spread across its buckets, from everything in one bucket to a perfectly even split. Here it tells me when one project has crowded the rest out of the backlog.
H=−i∑pilog2pi,H^=log2NH
Lives in
Backlog health tooling caskeycoding-specs _shared/tooling/backlog.py (health: epic distribution)
Exploring
Formulas I have a use for but have not built yet.
Entropy-weighted digest diversity
Ranks a candidate higher when adding it would spread the digest across more sections, the way a good playlist avoids playing one album straight through.
H^=−s∑pslogps,scorei∝ui⋅H^S∪{i}
Opportunity: Score the diversity of digest sections the way backlog health already scores how concentrated the work is.
Probability & Statistics
Telling skill from luck, and working out how much a number deserves to be trusted.
Isotonic regression (pool-adjacent-violators)
Fits the best staircase that is only allowed to climb, never step down. A sensible grading curve follows the same rule: a higher raw score should never earn a lower grade.
Grades probability forecasts the way you would grade a weather forecaster. Did it rain about as often as they said it would, and did they tell you more than the seasonal average already does? What is left over is noise no forecaster could remove.
Marks a strategy’s risk-adjusted return down for every other strategy that was tried along the way. Flip enough coins and one will land heads ten times in a row, which says nothing about that coin.
Probabilistic Sharpe Ratio + Minimum Track Record Length
Says how confident you can be that a track record beats its benchmark on skill instead of luck, and how long the record has to run to earn that confidence. One good month proves little. This says how many it takes.
Splits history many different ways and counts how often the best performer in one part of the data finishes below the middle of the pack in the rest. A strategy that only wins on the data it was tuned on is a student who memorized the practice exam.
Raises the bar a result must clear for every other idea that was tested before it. Buy enough lottery tickets and a win stops being evidence of a system.
Compares the order a signal ranked stocks in with the order they actually finished. Think of scoring a preseason ranking against the final standings, where only the order counts and the margins do not.
Signal validation ai-blog-api src/finance/analysis/signal_validation.py
Stationary block bootstrap (Politis-Romano)
Builds alternate histories by reshuffling a time series in chunks of random length, so streaks and slumps survive the shuffle. Shuffling one day at a time would erase them.
Reruns an estimate on many reshuffled copies of the data and reports the range most of the answers fall in. That range is the shaded band you see around a line on a chart.
Four ways to put very different measurements on one scale so they can be compared, without letting one extreme value run the show. Grading on a curve does the same job, with a cap so a single freak score cannot wreck it.
Finds notes that mean what the query means even when they share no words with it, so a search for “car trouble” can turn up a note about a dead battery.
sim(q,d)=∥q∥∥d∥q⋅d
Opportunity: Search today is BM25 keyword matching only. Semantic lookup over embeddings would catch the notes that use different words.
Stochastic Processes
Randomness that unfolds over time, which is how options get priced and price paths get simulated.
Black-Scholes price + Greeks
Prices a stock option from five inputs: the stock price, the strike, the time left, interest rates, and how jumpy the stock is. The Greeks are the sensitivities, how much the option price moves when each input does.
Works backward from an option’s market price to the jumpiness the market must be assuming. No formula runs in that direction, so it guesses, checks, and narrows the range until the price matches.
Simulates thousands of possible futures for a price, one random step at a time. Any single path is only a story. The spread across all of them shows the range of outcomes to expect.
Shows how volatile a market has usually been over short and long windows, drawn as a cone of typical ranges. Put today’s reading on the cone and you can see whether this much calm, or this much chaos, is unusual.
Compares the turbulence option buyers paid to be protected from with the turbulence that actually arrived. Think of the gap between an insurance premium and the claims that came in.
Finds implied volatility by following the slope of the price curve toward the answer. Knowing the slope exactly, it gets there in fewer steps than halving a range. If the slope goes flat or a step overshoots, it switches to halving for the rest of the way.
Reading a history for what is normal, what just changed, and how much the recent past should count.
EWMA + standardized regime shift
Keeps a running average that weights recent days most, then asks how unusual today is against it. The same reading can be ordinary in a stormy month and alarming in a calm one.
Measures how much of a market’s movement comes from just a few shared forces. When that share climbs, stocks are moving as one crowd and diversification buys less.
Draws a smooth curve through interest rates of every maturity using just a level, a slope, and a hump. Three numbers stand in for the whole curve, which makes one day easy to compare with another.
Counts what share of stocks are trading above their own recent average. An index can rise on a handful of giants. This shows whether the rest of the market came along.
Scores a workout by multiplying how long it lasted by how hard it was. An easy hour and a hard half hour can land on the same number, which is what lets very different runs be added into one weekly total.
Compares this week’s training load with the average of recent weeks to flag doing too much too soon. It is the number behind the old advice to build mileage gradually.
Weights recent items more than old ones, halving the weight every fixed number of days. Older items fade instead of dropping off a cliff.
w(d)=2−d/h
Lives in
Digest ranking
Exploring
Formulas I have a use for but have not built yet.
Banister impulse-response (CTL/ATL/TSB)
Treats every workout as a deposit into two accounts: fitness, which builds and fades slowly, and fatigue, which builds and fades fast. Race readiness is the first minus the second, which is why a taper works.
Opportunity: The coach tracks training load and ramp rate today. Modeling fitness and fatigue separately is the next step up.
Riegel race-time prediction
Predicts a race time at one distance from a known time at another. It builds in the slowdown every runner feels: double the distance and the time more than doubles.
T2=T1(D1D2)α
Opportunity: The coach measures training load but does not yet predict a finish time.
Linear Algebra & Geometry
Treating many measurements at once as points and directions, so patterns show up as shapes.
PCA via cyclic Jacobi eigendecomposition
Finds the few directions along which a dataset varies the most, so many stocks can be placed on a map you can actually look at. It gets there by rotating the correlations a little at a time until the pattern lines up with the axes.
Cosine similarity + mutual top-K graph + force layout
Links each stock to the few it behaves most like, then lets those links pull like springs while everything else pushes apart. Similar stocks settle into neighborhoods without anyone drawing the borders.
Linear dynamical system + trace/determinant stability + RK4
Classifies whether a simple two-variable system settles back to rest or spirals away after a push, then traces the path it takes. Picture a marble in a bowl versus a marble balanced on top of one.
Removes the part of a signal already explained by known factors, keeping only what is new. If a new signal is mostly an old one under a different name, this is where it shows.
Nudges a set of portfolio weights as little as possible until none are negative and together they add up to the whole. It turns a rough wish list into an allocation you could actually hold.
Describes how many assets move together using one shared force and each asset’s sensitivity to it, which keeps the correlations consistent with each other. Turn the force up and everything moves as one, which is what a panic looks like.
Rebalances each period by giving a little more weight to what just did well and a little less to what did not. It is simple enough to serve as a benchmark that a smarter strategy has to beat.
Leans into whatever has dropped below its recent average, betting on a snap back. The yardstick beside it is the best fixed mix you could have picked with perfect hindsight, which no real strategy gets to know in advance.
Sizes a bet from how often you win and how much a win pays. Bet less than this and you leave growth on the table. Bet more and even a real edge can ruin you.
f∗=p−b1−p
Lives in
Position sizing ai-blog-api src/finance/engine/sizing.py
Volatility targeting + drawdown throttle
Scales exposure down when risk runs hot and eases off further after losses pile up. A careful driver does the same: slower in the rain, slower still after a skid.
wt=σ^tσ∗,wt↦wt⋅g(DDt)
Lives in
Position sizing ai-blog-api src/finance/engine/sizing.py
ICIR factor weighting with James-Stein shrinkage
Weights each signal by how consistently it has predicted returns, then shrinks every weight toward zero so a short lucky streak is not mistaken for a track record. One great week does not make a rookie a veteran.
Ranks documents by how well their words match a search. A hit on a rare word counts for more than a hit on a common one, and a long document does not win just for having more words.
Fills a fixed amount of space by repeatedly taking whichever item offers the most value for the room it takes up. Packing a carry-on works the same way: the bulky sweater has to earn its place.
Smaxi∈S∑uis.t.i∈S∑ci≤B,pick by ui/ci
Lives in
Digest packing
Grade banding with hysteresis
Changes a grade only when the score moves clearly past the line, so a score hovering at the border does not flip back and forth. A thermostat works the same way, waiting for a real change before it switches.
The plumbing that makes the rest computable and repeatable.
Acklam inverse normal CDF approximation
Turns a probability back into a distance from average, such as how far out a one-in-a-hundred day sits. It replaces a lookup people used to do from a printed table.
Estimates values between known points by connecting them with straight lines. If you know the rate at two years and at five, this gives the reasonable guess for three.
Sorts values into equal-width buckets to draw the shape of a distribution, the same way you might sort a class’s test scores into ten-point ranges to see where most people landed.
Makes every random-looking picture come out the same on every visit by starting the randomness from a fixed seed. If a chart looks odd, I can reproduce exactly what you saw.
seed↦{un},un∈[0,1)
Lives in
All stochastic visualizations ai-blog-web src/quant-viz/compute (all stochastic paths)