def get_scaled_average_rating(ratings):
 n = get_number_of_ratings(ratings)
 if (n == 0):
  return 0
 average_rating = get_average_rating(ratings)
 z = 1.9599639715843482
 x = ((average_rating - 1) / 4)
 a = (x + ((z ** 2) / (2 * n)))
 b = (z * math.sqrt((((x * (1 - x)) / n) + ((z ** 2) / (4 * (n ** 2))))))
 wilson_score_lower_bound = ((a - b) / (1 + ((z ** 2) / n)))
 return (1 + (4 * wilson_score_lower_bound))

def get_scaled_average_rating ( ratings ) : n = get_number_of_ratings ( ratings ) if ( n == 0 ) : return 0 average_rating = get_average_rating ( ratings ) z = 1.9599639715843482 x = ( ( average_rating - 1 ) / 4 ) a = ( x + ( ( z ** 2 ) / ( 2 * n ) ) ) b = ( z * math . sqrt ( ( ( ( x * ( 1 - x ) ) / n ) + ( ( z ** 2 ) / ( 4 * ( n ** 2 ) ) ) ) ) ) wilson_score_lower_bound = ( ( a - b ) / ( 1 + ( ( z ** 2 ) / n ) ) ) return ( 1 + ( 4 * wilson_score_lower_bound ) )
returns the lower bound wilson score of the ratings as a float .