 (ns matchmaker-sparql.evaluation.metrics
-  (:require [clojure.set :refer [union]]))
+  (:require [clojure.set :refer [union]]
+            [taoensso.timbre :as timbre]))
 
 (defn compute-metrics
   "Compute metrics of `matches` given correct `match`."

  "Compute aggregate metrics for an evaluation fold."
  [metrics]
  {:matches (union-matches metrics)
   :empty? (sequence (map :empty?) metrics) ; FIXME: Needless double iteration.
   :ranks (sequence (map :rank) metrics)})

(defn aggregate-evaluation-metrics

  (let [matches (union-matches metrics)]
    {:catalog-coverage (double (/ (count matches)
                                  bidder-count))
     :prediction-coverage (double (/ (count (filter false? (mapcat :empties metrics)))
                                     contract-count))
     :ranks (mapcat :ranks metrics)}))
