How Not To Sort By Average Rating

Share your advanced PureBasic knowledge/code with the community.
kvitaliy
Enthusiast
Enthusiast
Posts: 162
Joined: Mon May 10, 2010 4:02 pm

How Not To Sort By Average Rating

Post by kvitaliy »

Original article
Lower bound of Wilson score confidence interval for a Bernoulli parameter.

Code: Select all

Procedure.f Rating(positive.l,negative.l)
  rtg.f = ((positive + 1.9208) / (positive + negative) - 1.96 * Sqr((positive * negative) / (positive + negative) + 0.9604) /(positive + negative)) / (1 + 3.8416 / (positive + negative))
  ProcedureReturn rtg
EndProcedure

;Example of rating changes when you change the positive and negative reviews.
positive=1000
negative=1

For i = 0 To 999
  Debug "+" + positive + "\-"+negative+" Rating = "+ StrF(Rating(positive,negative)*100,0) + "%"
  positive-1
  negative+1
Next