1
0
Эх сурвалжийг харах

add logarithmic scoring rule, update filename to reflect variety

George C. Privon 6 жил өмнө
parent
commit
d1b625a549

+ 0 - 16
code/brier_score.rkt

@@ -1,16 +0,0 @@
-#lang racket/base
-; brier_score.rkt
-;
-; Compute Brier score for probabilistic predictions
-; https://en.wikipedia.org/wiki/Brier_score
-
-(provide brier-score)
-
-(require math)
-
-; compute Brier score
-; f - forecast probability, [0, 1]
-; o - actual outcome, 0 or 1
-(define (brier-score f o)
-    (expt (- f o) 2))
-

+ 24 - 0
code/scoring_rules.rkt

@@ -0,0 +1,24 @@
+#lang racket/base
+; scoring_rules.rkt
+;
+; Compute scores for probabilistic predictions
+; https://en.wikipedia.org/wiki/Scoring_rule#Proper_scoring_rules
+
+(provide brier-score
+         log-score)
+
+(require math)
+
+; compute Brier score
+; f - forecast probability, [0, 1]
+; o - actual outcome, 0 or 1
+(define (brier-score f o)
+    (expt (- f o) 2))
+
+; compute logarithmic score
+; L(r,i) = ln(r_i)
+(define (log-score f o)
+    (cond
+        [(eq? o 1) (log f)]
+        [(eq? o 0) (log (- 1 f))]))
+

+ 1 - 1
code/update_predictions.rkt

@@ -6,7 +6,7 @@
 (require racket/date)
 (require db)
 
-(require "brier_score.rkt")
+(require "scoring_rules.rkt")
 
 (define progname "update_predictions.rkt")