Search code examples
algorithmmathscalerating

Convert a rating scale


I have a website where people can evaluate some subjects. Here is the scale [1-4].

enter image description here

However I probably have a problem in terms of readability of the overall rating. The most common scale is [1-5] in web.

Currently I am using for example 1.5 / 4.

Google says:

Ratings that don't use a 5-point scale: By default, Google assumes that your site uses a 5-point scale, where 5 is the best possible rating and 1 is the worst, but you can use any other scale. If you do, you can mark up the best and worst ratings, and Google will scale that to the 5-star system used in rich snippets.

How can I do this type of conversion from a scale of 4 to 5?


Solution

  • If you want to do the scaling on your end, the obvious linear transformation is

    oneToFive = (oneToFour - 1.0) * (4.0/3.0) + 1.0
    

    Sanity check:

    (1 - 1.0) * (4.0/3.0) + 1.0 == 1.0
    (4 - 1.0) * (4.0/3.0) + 1.0 == 5.0
    

    If you want have Google do it, just keep reading on the instructions page. You just need to set a couple of values:

    reviewRating.bestRating Text*
    The highest value allowed in this rating system.
    * Required if the rating system is not on a 5-point scale. If bestRating > is omitted, 5 is assumed.

    reviewRating.worstRating Text*
    The lowest value allowed in this rating system.
    * Required if the rating system is not on a 5-point scale. If worstRating > is omitted, 1 is assumed.