Two users both rate a film 4. For a generous user who gives everything 4s and 5s, that's indifference. For a harsh user who rarely goes above 2, it's enthusiasm. Comparing raw ratings across users therefore compares their personalities as much as their tastes.
Mean-centering removes that. Subtract each user's own average and what's left is how they felt about the item relative to their usual.
Task: write normalize_ratings(ratings) returning the centred matrix, every value rounded to 4 decimal places.
ratings is a list of rows, one per user, with one column per item. None means that user never rated that item.Nones must not count toward it or toward the item count.None stays None in the output. A missing rating isn't zero; zero would mean "exactly average", which is a claim you don't get to make.After centring, a positive number means above that user's norm, negative means below, and 0 means exactly typical for them. That change of meaning is what makes the numbers comparable across users at all — and it's why a user who gave everything the same rating comes out as all zeros, correctly telling you their ratings carry no information about preference.