]> git.sesse.net Git - wloh/blobdiff - train.pl
Compute and calculate standard deviations.
[wloh] / train.pl
index 4981e44477fa9dc504184a2ba2774d168ac3e1a7..67b2b8d737e49f0dbde6f004923cc8f6af7b5c83 100755 (executable)
--- a/train.pl
+++ b/train.pl
@@ -47,19 +47,23 @@ WHERE deltager1.Nr > deltager2.nr
 $q->execute($last_season);
 
 while (my $ref = $q->fetchrow_hashref) {
+       next if ($ref->{'maalfor'} == 150 && $ref->{'maalmot'} == 0);
+       next if ($ref->{'maalfor'} == 0 && $ref->{'maalmot'} == 150);
+       next if ($ref->{'maalfor'} == 150 && $ref->{'maalmot'} == 150);
        printf DATA "%d %d %d %d %f\n", $ref->{'p1'}, $ref->{'p2'}, $ref->{'maalfor'}, $ref->{'maalmot'}, $ref->{'vekt'};
 }
 
 close DATA;
 
 $dbh->do('DELETE FROM ratings');
-my $iq = $dbh->prepare('INSERT INTO ratings ( id, rating ) VALUES (?, ?)');
+my $iq = $dbh->prepare('INSERT INTO ratings ( id, rating, rating_stddev ) VALUES (?, ?, ?)');
 
-open RATINGS, "/home/sesse/dev/bayeswf/bayeswf < $tmpnam |"
+open RATINGS, "$config::base_dir/bayeswf < $tmpnam |"
        or die "bayeswf: $!";
 while (<RATINGS>) {
-       /(.*) (.*)/ or next;
-       $iq->execute($2, $1);
+       /(.*) (.*) (.*)/ or next;
+       $iq->execute($3, $1, $2);
 }
 
 $dbh->commit;
+unlink($tmpnam);