[Math] Number of Likes and Dislikes to Star Rating system

average

I have a 5 star rating system that outputs a recommendation.

A user inputs a rating based on a Like or Dislike.

What I would like to know is how to convert the number of likes and dislikes into a number which can be put into a 5 star rating system?

An Example:

Say if I have:

172 Likes

101 Dislikes

How would I then get then get the average of these likes and dislikes, to put into a 5 star system which resembles the number of likes compared to dislikes?

Best Answer

One fairly straightforward way is to compute the fraction of likes as

$$ \text{fraction}_\text{likes} = \frac{\text{number}_\text{likes}} {\text{number}_\text{likes}+ \text{number}_\text{dislikes}} $$

and then if $\text{fraction}_\text{likes}$ is below $0.2$, that's one star; if it's at least $0.2$ but less than $0.4$, it's two stars; and so on. More than $0.8$ is five stars.

ETA: If you allow for zero stars, you could break it down as follows: less than $0.1$, zero stars; at least $0.1$ but less than $0.3$, one star; and so on. More than $0.9$ is five stars.

Related Question