]> git.sesse.net Git - wloh/blobdiff - www/rating.pl
Make the Hessian calculation use the new all_matches vector.
[wloh] / www / rating.pl
index 2727534c949e6c03cf14ac205ce142a72505f6d3..7d0a2e25c66cfaa4e1ff0d209cfcb772076b4dd7 100755 (executable)
@@ -60,7 +60,8 @@ printf <<"EOF", $params{-3}, $match_stddev;
 
     <h2>Modellparametre</h2>
 
-    <p>For de som vet litt om slikt. Mer utførlig forklaring for begynnere kommer seinere.</p>
+    <p>For de som vet litt om slikt. Det finnes også en lengre, mer detaljert
+      <a href="/ratings-explained">forklaring</a> beregnet på ikke-matematikere.</p>
 
     <ul>
       <li>MLE-basert modell med én skalar (styrke) per spiller og to globale skalarer (begge standardavvik, se under), løst med syklisk MM (minorization-maximization). Antall iterasjoner før konvergens: $params{-1}.</li>
@@ -72,13 +73,42 @@ printf <<"EOF", $params{-3}, $match_stddev;
         150-0, 0-150 eller 150-150 ignoreres.</li>
     </ul>
 
+    <h2>Divisjonsoversikt</h2>
+
+    <table>
+      <tr>
+        <th>Div.</th>
+        <th>Snitt</th>
+        <th>Std.avvik</th>
+      </tr>
+EOF
+
+$q = $dbh->prepare('SELECT divisjon,AVG(rating) AS avg_rating,STDDEV(rating) AS stddev_rating FROM ratings NATURAL JOIN siste_divisjon GROUP BY divisjon ORDER BY divisjon');
+$q->execute;
+
+my $i = 0;
+while (my $ref = $q->fetchrow_hashref) {
+       if (++$i % 2 == 0) {
+               print "      <tr class=\"odd\">\n";
+       } else {
+               print "      <tr class=\"even\">\n";
+       }
+       printf "        <th>%d.</th>\n", $ref->{'divisjon'};
+       printf "        <td class=\"num\">%.1f</td>\n", $ref->{'avg_rating'};
+       printf "        <td class=\"num\">%.1f</td>\n", $ref->{'stddev_rating'};
+       print "      </tr>\n";
+}
+
+print <<"EOF";
+    </table>
+
   <h2>Rankingliste</h2>
 
   <table>
     <tr>
       <th></th>
       <th>Nick</th>
-      <th>Ranking</th>
+      <th>Rating</th>
       <th>Sist sett</th>
     </tr>
 EOF
@@ -91,7 +121,7 @@ FROM ratings
 ORDER BY rating DESC');
 $q->execute;
 
-my $i = 0;
+$i = 0;
 while (my $ref = $q->fetchrow_hashref) {
        if (++$i % 2 == 0) {
                print "    <tr class=\"odd\">\n";