Backtesting in Python
OCT 15 2026 · 16 min
A backtest runs a trading rule over past prices and reports what would have happened: the return, the risk, the number of trades.
Building models with scikit-learn
OCT 15 2026 · 13 min
scikit-learn is one interface, fit and predict, wrapped around every classical machine-learning method, plus the scaffolding that turns a model into a result…
Choosing a model is a systems decision
OCT 15 2026 · 9 min
Accuracy is one column in the table. Training time, time per prediction and its worst case, whether the model keeps the data, whether it can be explained, how…
The Python stack for machine learning
OCT 15 2026 · 13 min
Almost all machine learning work is done in Python, through a few dozen libraries that each exist for one kind of job.
Boosting: models that learn from the last one's mistakes
OCT 14 2026 · 12 min
Boosting builds a strong model from many weak ones trained in sequence, each focusing on what the previous ones got wrong.
Random forests: bagging with one extra rule
OCT 12 2026 · 10 min
A random forest is bagging with one extra rule: at every split, each tree may only choose from a random handful of the features.
Portfolio optimisation: choosing the weights
OCT 9 2026 · 10 min
Portfolio optimisation chooses how much to put in each asset so that, for the risk you accept, the expected return is as high as possible; it works because…
Bagging: many copies of a model, averaged
OCT 6 2026 · 11 min
Bagging trains many copies of the same model, each on a slightly different random resample of the data, and averages their answers; the copies make different…
Beta and alpha: how much of the market you carry, and what is left
OCT 6 2026 · 9 min
Plot a stock's daily return against the market's and fit a straight line.
Sharpe, Sortino and information ratio: return per unit of risk
OCT 4 2026 · 12 min
A return on its own means little until you know the risk taken to get it; these three ratios divide extra return by risk, and they differ only in what they…
What a trade really costs
OCT 2 2026 · 9 min
A trading idea becomes profit only after paying the bid-ask spread, walking the order book, moving the price and, for a short, borrowing the shares.
Scoring a model: a number means nothing without a split, a metric and a baseline
OCT 1 2026 · 11 min
A model's score is meaningless on its own.
Bias and variance: where a model's errors come from
SEP 30 2026 · 11 min
A model's error on new data comes from three places: bias (it is too simple to capture the real pattern), variance (it changes too much depending on which data…
Data that lies: the bugs that look like alpha
SEP 29 2026 · 8 min
Most of the alpha in a backtest is a data bug with a name: a feature that used tomorrow's number, a universe built from today's survivors, a thousand ideas…
Covariance and correlation: why a mix is safer than its parts
SEP 27 2026 · 10 min
Covariance and correlation measure whether two things tend to move together; in a portfolio, that one number decides how much of the risk cancels out, which is…
Nearest neighbours: predict what similar past cases did
SEP 26 2026 · 10 min
k-nearest neighbours keeps every training row and, asked about a new case, finds the k most similar old ones and averages their answers.
Why prices are hard to beat: efficiency, random walks and a roulette wheel
SEP 24 2026 · 10 min
An efficient market is one where no reliable edge survives after costs, because any pattern worth money is traded away by the people who find it.
Decision trees: a model made of yes/no questions
SEP 22 2026 · 12 min
A decision tree makes a prediction by asking a short series of yes/no questions about the input, like a flowchart an expert would draw; it learns which…
Value is an estimate: discounting, growth and the margin of safety
SEP 21 2026 · 8 min
A price is observed; a value is estimated.
Mean and standard deviation: return and risk in two numbers
SEP 19 2026 · 9 min
The mean tells you where the middle of your data is, and the standard deviation tells you how far a typical value strays from that middle; in finance the first…
Returns compound: multiply, never add
SEP 17 2026 · 10 min
Returns chain by multiplying growth factors, not by adding percentages, and that one fact explains why +50% then −50% loses money, why a five-year gain is not…
Every feature has a timestamp: leakage, scaling and twin features
SEP 16 2026 · 10 min
For every feature a model uses, ask when its value became knowable and whether you could compute it live.
Linear regression: the first model, a straight line
SEP 14 2026 · 13 min
Linear regression draws the straight line that best fits your data, where "best" means the total of the squared misses is as small as possible; each number it…
Expected value: what a risky choice is worth on average
SEP 11 2026 · 9 min
Expected value is the average result you would get if you could repeat a risky situation many times: multiply each possible outcome by its probability and add…
Regression vs classification: predicting a number or a label
SEP 8 2026 · 9 min
Most machine learning answers one of two questions: "how much?" (regression, the answer is a number) or "which one?" (classification, the answer is a category).
Probability: how often something happens
SEP 5 2026 · 10 min
A probability is a number between 0 and 1 that says how often something happens in the long run.
The data is part of the model: splits, gaps and outliers
SEP 3 2026 · 11 min
Which rows a model trains on, how the test rows are chosen, what is done about missing values, and how far one wild value can pull a fit all change the result…
What machine learning is: rules learned from examples
SEP 1 2026 · 12 min
Machine learning is teaching a computer by example instead of by instruction: you show it many past cases with the right answers, it works out the pattern on…
Machine learning for quantitative finance in ten ideas
AUG 31 2026 · 6 min
Ten ideas carry machine learning for finance: the target decides the problem, the data is part of the model, every feature has a timestamp, a linear model is a…
What is quantitative finance?
AUG 31 2026 · 13 min
Quantitative finance is the practice of making investment and risk decisions from measured numbers and tested rules rather than judgement alone.
Quantitative finance in ten ideas
AUG 30 2026 · 6 min
Ten ideas carry most of quantitative finance: returns multiply, a return means little without the risk taken to earn it, correlation decides how much risk…
Letting my homelab do things on its own
AUG 29 2026 · 5 min
A chat window only answers when I ask. I wanted my homelab to also do small jobs for me on its own, so I tried two AI agents, OpenClaw and Hermes Agent.
Switching to a smaller model
AUG 20 2026 · 4 min
I expected a new, smaller model to be slower on my homelab, and at first it was. Then I found one setting that more than doubled its speed.
Setting up my homelab
AUG 16 2026 · 5 min
I wanted my own private AI, running at home, where nothing I ask leaves the house.