Skip to content
Snippets Groups Projects
Commit 590035e1 authored by Simon Belak's avatar Simon Belak
Browse files

Add tests

parent 54907619
No related branches found
No related tags found
No related merge requests found
......@@ -118,14 +118,20 @@
{:model (model offset slope)
:formula (formula offset slope)}))))
(apply redux/juxt))
:validation-set ((map (juxt fx fy)) (reservoir-sample validation-set-size))})
:validation-set ((keep (fn [row]
(let [x (fx row)
y (fy row)]
(when (and x y)
[x y]))))
(reservoir-sample validation-set-size))})
(fn [{:keys [validation-set fits]}]
(->> fits
(remove nil?)
(apply min-key #(transduce identity
(rmse (comp (:model %) first) second)
validation-set))
:formula))))
(some->> fits
(remove nil?)
not-empty
(apply min-key #(transduce identity
(rmse (comp (:model %) first) second)
validation-set))
:formula))))
(defn- timeseries?
[{:keys [numbers datetimes others]}]
......
(ns metabase.sync.analyze.fingerprint.insights-test
(:require [expectations :refer :all]
[metabase.sync.analyze.fingerprint.insights :refer :all]))
(def ^:private cols [{:base_type :type/DateTime} {:base_type :type/Number}])
(expect
700
(-> (transduce identity (insights cols) [["2014" 100]
["2015" 200]
["2016" nil]
[nil 300]
[nil nil]
["2017" 700]])
first
:last-value))
;; Here we just make sure we don't blow up on empty input
(expect
nil
(-> (transduce identity (insights cols) [])
first
:last-value))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment