Learning From Readers With Similar Preferences
A guide’s description may miss what readers value. Shared ratings let Botie compare preferences, provided missing ratings remain distinct from dislikes.
13 sections · 4 questions · 2 coding challenges
The arrow keys move between sections too.
Sharing Judgements Across Readers
BOTIE
Our small rating table uses the same broad idea, but the workshop is a transparent neighbourhood calculation rather than a recreation of the original service.
Sources for this history
What Did Readers With Similar Tastes Find Useful?
Two readers agree on several guides, even though those guides cover different subjects. Their shared preferences may reveal something that topic labels missed.
Collaborative filtering uses patterns across readers and items. We will start with an explicit rating table and a weighted neighbour prediction, keeping each reader’s usual rating level separate from their deviations.
Neighbour similarities and observed ratings are supplied teaching values.
Step 1 of 3
Separate taste from rating scale
Some readers give higher ratings generally.
| Reader | Neighbour means | Ratings for candidate |
|---|---|---|
| Neighbour A | 3 | 5 |
| Neighbour B | 4 | 3 |
Neighbour A
- Neighbour means
- 3
- Ratings for candidate
- 5
Neighbour B
- Neighbour means
- 4
- Ratings for candidate
- 3
Step 2 of 3
Compare deviations
A rating above a neighbour’s own mean indicates unusual enthusiasm.
| Reader | Deviations | Positive similarities |
|---|---|---|
| Neighbour A | 2 | 0.75 |
| Neighbour B | -1 | 0.25 |
Neighbour A
- Deviations
- 2
- Positive similarities
- 0.75
Neighbour B
- Deviations
- -1
- Positive similarities
- 0.25
Step 3 of 3
Adjust the target reader’s baseline
Transfer the weighted deviation, not the neighbours’ raw rating scale.
Weighted deviation = (0.75 × 2) + (0.25 × −1) = 1.25 Predicted rating = 3 + 1.25 = 4.25
Neighbour preferences are more useful when their baselines are visible
Centred deviations preserve preference relative to each neighbour’s rating scale.
What does a neighbour's rating mean on their own scale?
A generous reader and a strict reader can both like the same guide. Change their typical ratings and compare the centred preferences before weighting them by similarity.
BOTIE
Rating predicted from centred neighbour preferences
4.25
Follow the operations
1. Target reader mean
3
2. Positive similarity weights
- 00.75
- 10.25
3. Neighbour ratings
- 05
- 13
4. Neighbour means
- 03
- 14
5. Subtract
- 02
- 1-1
6. Dot product
1.25
7. Add a list
1
8. Divide
1.25
9. Add
4.25
10. Result
4.25
Weights must be non-negative with positive total. Missing neighbours are excluded before this calculation.
1. Keep Missing Ratings Missing
A blank rating means we haven't observed the reader's opinion. It is not a zero-star review. We can keep a mask beside the rating table to say which entries are known, then use only those entries for means and similarity calculations.
How much evidence supports a similarity? Two readers who agree on their only shared rated item may look close by accident. We can require more overlap or reduce the influence of similarities supported by few ratings.
Training means must be computed from training ratings only.
2. Compare Preferences After Centering
Subtract each reader’s observed-rating mean from their ratings. This separates a tendency to rate everything highly from a preference for one item relative to that reader’s usual level.
A neighbourhood model estimates similarity on co-rated items. Here those similarities are supplied so we can examine the prediction step. Positive weights only are used in this teaching example.
A supplied similarity is an input to this exercise, not a claim that similarity estimation is solved.
3. Transfer a Weighted Deviation
For neighbours who rated the candidate, calculate their deviations from their means. Weight and average those deviations, then add the target reader’s mean.
Neighbour deviations = [5-3, 3-4] = [2,-1]
Weighted deviation = (0.75 × 2 + 0.25 × -1) / 1 = 1.25
Prediction = 3 + 1.25 = 4.25If no suitable neighbours rated the item, use an explicit baseline rather than divide by zero.
Interpret one neighbour relative to their usual rating
This neighbour usually rates guides at two but gave this guide four. The target reader's own average is three.
import numpy as np
neighbour_rating = 4.0
neighbour_mean = 2.0
target_mean = 3.0
deviation = neighbour_rating - neighbour_mean
print(deviation)
print(target_mean + deviation)2.0
5.0The transferable evidence is the neighbour's positive deviation from their usual rating. Practice combines several such deviations with different similarity weights.
4. Evaluate Sparse and New Cases
Collaborative filtering needs shared interaction evidence. New readers, new items, and readers with unusual tastes may have little overlap. Compare these groups separately instead of relying only on an overall score.
Rating prediction error does not directly measure whether the top few recommendations are useful. We will distinguish those evaluation questions after learning a compact model of the rating table.
The workshop returns a raw rating estimate; clipping to a rating range is a separate declared choice.
5. Agreement on One Guide Is Weak Evidence
Two readers can match perfectly on their only shared rating. That correlation is not supported by the same evidence as agreement across many shared guides. Keep overlap counts beside similarities and define a minimum support or shrinkage rule if the task needs one.
Calculate each similarity on the intended shared observations. Treating missing ratings as zero makes absence look like a strong dislike and changes both the centring and the distance.
6. Restore the Target Reader’s Rating Scale
A generous reader and a strict reader can share preferences while using different numerical levels. Neighbour deviations describe whether a guide scored above or below that neighbour's usual level. Add the weighted deviation to the target reader's reference level.
Only neighbours who rated the candidate can contribute to that candidate's estimate. Keep the denominator's convention explicit, especially if negative similarities are allowed.
Transfer preferences rather than raw ratings
The target reader has a mean of three. Both similarities are positive in this example.
import numpy as np
target_mean = 3.
similarity = np.array([.8,.2])
neighbour_mean = np.array([4.,2.])
rating = np.array([5.,1.])
prediction = target_mean + similarity@(rating-neighbour_mean)/np.abs(similarity).sum()
print(round(float(prediction), 3))3.6The neighbours contribute opposite deviations. Their different rating scales do not enter as raw candidate scores.
7. What If Nobody Comparable Rated the Guide?
A new guide or reader can have no useful collaborative overlap. Define a fallback such as a content-based ranking or an appropriate popularity rule. A missing prediction should not silently become a zero rating.
Evaluate cold-start requests separately from requests with long histories. Split interactions in time so that the neighbourhood for a historical request contains only ratings already available then. A future rating can otherwise leak the answer into the similarity itself.
Check yourself
Questions on Parts 1 to 7
Question 1 of 4
What deviations should be combined?
Use the information below.
Ratings [5,3], neighbour means [3,4].Try it with Botie
Build with Botie
Write and run Python