numpy==2.2.6
pandas==2.3.3
PyYAML==6.0.3
# Three packages. That is not minimalism for its own sake: every model in this
# repository is either a least-squares solve or a count table, and writing
# them out is what makes the cold branches visible. A cold user's ALS vector
# is zero because the right-hand side of its normal equations is an empty sum,
# and that line is the whole subject of the post. Behind
# `AlternatingLeastSquares.fit` it is invisible.
#
# Everything below is optional and deliberately not installed.
#
# What it would replace: the dense user-by-item arrays. `data/splits.py`
# builds a 3,000 by 1,200 boolean `seen_mask` and `models/priors.py` builds a
# 1,200 by 1,200 co-occurrence matrix, which are 3.6 MB and 11 MB and
# therefore fine. At a real catalogue they are not: 24 million users by 1.4
# million titles is 4 x 10^13 cells, so both become `scipy.sparse.csr_matrix`
# and the co-occurrence becomes `H.T @ H` on a sparse binary history matrix.
# The item-item product is the operation that flips first, because it is
# quadratic in the catalogue and the dense version stops fitting in memory at
# roughly 40,000 items.
# scipy==1.15.3
#
# What it would replace: three things, and only one of them is interesting.
# `linear_model.Ridge(fit_intercept=True)` is `models/cold_embed.py::_ridge`,
# which is four lines and is written out because the penalty must not hit the
# intercept column, and a hand-rolled version that penalises the intercept
# shrinks every predicted factor towards zero rather than towards the mean.
# `neighbors.NearestNeighbors` would replace the dense co-occurrence scan with
# an approximate index, which is the change that matters at scale: post 22
# measured the recall-versus-latency curve for exactly that swap.
# `model_selection.GroupShuffleSplit` would replace `data/splits.py`, and it
# should not: a cold-start split has to be temporal, and every grouped
# splitter in that module is a random splitter with a constraint attached.
# scikit-learn==1.7.2
#
# What it would replace: `models/mf.py`. Hu, Koren and Volinsky's implicit ALS
# with a conjugate-gradient solver and OpenMP threads, roughly 60x faster on
# this log and the right answer for anything real. It also exposes the cold
# behaviour more politely than this code does, which is part of the problem:
# `partial_fit_users` lets you fold a new user in from their first interaction
# and makes it easy to forget that a user with zero interactions still has a
# zero vector.
# implicit==0.7.2
#
# What it would replace: the content block. `models/cold_embed.py` regresses
# 46 metadata columns onto the factor space; the production version regresses
# a 384-dimensional sentence embedding of the title, blurb and author, which
# is post 22's representation. The ridge penalty is nearly irrelevant at 46
# columns and becomes the most important hyperparameter at 384.
# sentence-transformers==5.1.2
#
# Not used. Listed because the post's alternatives table compares against
# LightFM-style hybrid factorisation, which learns one embedding space over
# users, items and content features so that the hand-off is inside the model
# rather than gated outside it. That is a genuinely different answer to this
# problem rather than a faster version of this one.
# lightfm==1.17
