lkpy
lkpy copied to clipboard
Add clamping to rating predictors
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.