Skip to content

sin/rating-score

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rating-score

You are a web programmer. You have users. Your users rate stuff on your site. You want to put the highest-rated stuff at the top and lowest-rated at the bottom. You need some sort of “score” to sort by.

– Evan Miller, “How Not To Sort By Average Rating”

A better way to calculate ranking score to sort things on the web based on user upvotes or “stars”, using lower bound of Wilson score confidence interval for a Bernoulli parameter.

API

Table of Contents

averageToScore

Calculates the score from the average of all reviews.

This function is curried.

Parameters

  • confidence Number
  • averageRating Number Average review score.
  • maxRating Number Maximum review score.
  • totalReviews Number Total number of reviews.

Returns Number Calculated score.

starsToScore

Calculates the score from a list of review counts.

This function is curried.

Parameters

Returns Number Calculated score.

upvotesToScore

Calculates the score from the number of upvotes and downvotes.

This function is curried.

Parameters

  • confidence Number
  • upvotes Number Number of positive reviews.
  • downvotes Number Number of negative reviews.

Returns Number Calculated score.

About

Calculate score to sort things by on the web based on upvotes or “stars”, using lower bound of Wilson score confidence interval for a Bernoulli parameter.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published