a calificación Bayesiana de Inundación crea valores fuera de rang

Estoy tratando de aplicar laBayesian rating formula, pero si califico 1 de cada 5 mil de cientos, la calificación final es mayor que 5.

Por ejemplo, un elemento dado no tiene votos y después de votar 170,000 veces con 1 estrella, su calificación final es 5.23. Si califico 100, tiene un valor normal.

Aquí es lo que tengo en PHP.

<?php
// these values came from DB
$total_votes     = 2936;    // total of votes for all items
$total_rating    = 582.955; // sum of all ratings
$total_items     = 202;

// now the specific item, it has no votes yet
$this_num_votes  = 0;
$this_score      = 0;
$this_rating     = 0;

// simulating a lot of votes with 1 star
for ($i=0; $i < 170000; $i++) { 
    $rating_sent = 1; // the new rating, always 1

    $total_votes++; // adding 1 to total
    $total_rating = $total_rating+$rating_sent; // adding 1 to total

    $avg_num_votes = ($total_votes/$total_items); // Average number of votes in all items
    $avg_rating = ($total_rating/$total_items);   // Average rating for all items
    $this_num_votes = $this_num_votes+1;          // Number of votes for this item
    $this_score = $this_score+$rating_sent;       // Sum of all votes for this item
    $this_rating = $this_score/$this_num_votes;   // Rating for this item

    $bayesian_rating = ( ($avg_num_votes * $avg_rating) + ($this_num_votes * $this_rating) ) / ($avg_num_votes + $this_num_votes);
}
echo $bayesian_rating;
?>

Incluso si me inunda con 1 o 2:

$rating_sent = rand(1,2)

La calificación final después de 100,000 votos es superior a 5.

Acabo de hacer una nueva prueba usando

$rating_sent = rand(1,5)

Y después de 100,000 obtuve un valor completamente fuera del rango (10.53). Sé que en una situación normal ningún artículo obtendrá 170,000 votos, mientras que todos los demás artículos no tendrán voto. Pero me pregunto si hay algo mal con mi código o si este es un comportamiento esperado de la fórmula bayesiana considerando los votos masivos.

Edita

Solo para aclararlo, aquí hay una mejor explicación para algunas variables.

$avg_num_votes   // SUM(votes given to all items)/COUNT(all items)
$avg_rating      // SUM(rating of all items)/COUNT(all items)
$this_num_votes  // COUNT(votes given for this item)
$this_score      // SUM(rating for this item)
$bayesian_rating // is the formula itself

La fórmula es:( (avg_num_votes * avg_rating) + (this_num_votes * this_rating) ) / (avg_num_votes + this_num_votes). Tomado deaqu