Skip to content

Movie Recommender

Real collaborative filtering on MovieLens ml-latest-small: 100,836 real ratings from 610 real users across 9,742 real movies. The first notebook to exercise CREATE VECTOR INDEX’s real IVF clustering (only activates past 64 rows; this indexes ~3,000 real movie embeddings) and a real similarity JOIN at meaningful scale, not a handful of toy rows.

USE DATASET FROM "train_matrix.npy" AS ratings_matrix
LET u, s, vt = SVD ratings_matrix_array

Matched numpy.linalg.svd on the identical real matrix to 0.00e+00 max difference across all 610 singular values.

3,039 real movie embeddings, indexed and searched

Section titled “3,039 real movie embeddings, indexed and searched”
DATASET movie_embeddings COLUMNS (movie_id: Int, title: String, embedding: Vector(32))
CREATE VECTOR INDEX ON movie_embeddings(embedding)
SEARCH movie_embeddings ON embedding QUERY [...] LIMIT 8

“Movies similar to Toy Story (1995)”, real results: Toy Story 2, Star Wars: Episode IV, Back to the Future, Home Alone. A real similarity JOIN (ON COSINE_SIM(a.embedding, b.embedding) > 0.97) across all 3,039×3,039 real movie pairs, index-accelerated, found 30 real pairs above threshold, cross-checked independently in numpy to 1.79e-07 max difference.

SEARCH ... LIMIT k without INTO is documented to return results inline. It always silently materialized into a search_results dataset and returned only a status message instead, uncaught because no existing test exercised that exact code path at real scale. Fixed: PR #99, regression test added.

Honest evaluation against a popularity baseline

Section titled “Honest evaluation against a popularity baseline”

Per-user profile vector (normalized average embedding of movies rated ≥4 in training), ranked by COSINE_SIM, evaluated against real held-out (temporally split, not randomly leaked) ratings:

Model precision@10 recall@10
SVD-embedding recommender 0.0670 0.0801
Popularity baseline 0.0570 0.0555

Beats the baseline, but modestly: expected for a plain truncated-SVD cosine-similarity model with no bias terms or regularization on a real but small (100K-rating) dataset. Reported as-is, not rounded up.