Recommend by episode-weighted shared people

Decision 04

Counting shared people equally made two shows look alike when they had cycled through the same one-episode guest actors. Each person is now weighted by the share of a show they actually made, and a shared person counts for the weaker of their two sides.

Context

The first version of the recommender counted. Two shows share an actor, that is one connection; share a director, that is two. Rank by the count. It was the simplest thing that could work, and for a while it did.

Then the ingest pulled TMDb’s full per-episode credits (ADR-02) and 84% of the cast entries turned out to be for a single episode.

Counting every shared person the same now meant two shows looked similar because they had cycled through the same pool of one-episode guests. That says nothing about whether the shows are alike. The results stopped being useful the day the data got better, which is a strange way to fail and a clear signal: counting is not enough. How much of a show a person actually made has to matter.

Decision

Weight each shared person by how much of each show they were really in, then add the weights up. That total is the similarity between two shows.

A person’s share of a show is their episode count divided by the show’s total episodes. A lead in all 62 episodes scores 1.0. A guest in 1 of 62 scores about 0.02. Using a share rather than a raw count means the lead of a 6-episode mini-series and the lead of a 62-episode drama both score 1.0, so a short show is not punished for being short.

A shared person has a share on each of the two shows, and the score takes the smaller one. If someone starred in one show and turned up in three episodes of another, that link should count for the weaker side.

score = sum, over each shared person, of min(share_on_A, share_on_B)
share = episode_count / number_of_episodes

The smaller rules:

Three approaches lost:

After Action Review

It worked. For Breaking Bad the top match becomes Better Call Saul, and the show that only looked similar because the two share a long list of mostly-minor people drops far down. 96 of 100 shows come back with at least one match, and tests lock the rules in so a later change cannot quietly undo them.

Two things I would improve. The code works the score out after pulling the rows from the database, because the per-show share does not fit neatly into a single query. That is fine at 100 shows and does not scale; the answer is a table of connections computed ahead of time, which ADR-07 later builds.

And the weighting does nothing at all for a show with no episodes recorded yet. Every score comes out zero, which needs its own answer: ADR-05.

← All decisionsRead this record in the tvlens repo →