lenskit / lenskit/lkpy

Add clamping to rating predictors

Open
#189 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

components
Dominant language
Python
Stars
314
Forks
77
Avg merge
4d 6m
Merged PRs (30d)
10

Description

We need the ability to return clamped rating predictions: they are restricted to be in the range of allowable ratings.

I think the easiest way to do this is likely to create a ClampedPredictor wrapper, that wraps another Predictor and clamps its predictions (using np.clip, probably). This will result in less code duplication than adding clipping/clamping support to each individual predictor.

One outstanding difficulty here is the deployment interactions with Top-N wrappers and setting up an algorithm that is both clamped and top-N, with the top-N using the unclamped scores. There are two fixes to that problem:

  • instead of clipping, use a default sigmoid that maps min and max to close-to-min and close-to-max. If we're clamping to a 1-5 scale, and a prediction of 1 transforms to 1.01, and 5 transforms to 4.99, that might work.
  • build a "package" class that can apply clamping (or other prediction transforms), and top-N (if the algorithm doesn't already recommend)

That should probably be a separate ticket, though.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the Predictor interface and the existing Top-N wrappers mentioned in the issue. Define how a ClampedPredictor should restrict predictions to allowable ratings, then verify its interaction with Top-N behavior, including which scores Top-N should use. Done means the wrapper behavior and deployment interaction are resolved and covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.