From 1f62d9ca419bccc0a303d70e67f2b2c284fce33b Mon Sep 17 00:00:00 2001 From: Ryan Boldi Date: Tue, 25 Oct 2022 13:00:50 -0400 Subject: [PATCH] fixed autods errors --- src/propeller/downsample.cljc | 2 +- src/propeller/tools/metrics.cljc | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/propeller/downsample.cljc b/src/propeller/downsample.cljc index 8037515..437ef3a 100644 --- a/src/propeller/downsample.cljc +++ b/src/propeller/downsample.cljc @@ -79,7 +79,7 @@ (utils/filter-by-index distance-list (map #(:index %) tournament))) (map #(:distances %) new-downsample))) selected-case-index (metrics/argmax min-case-distances)] - (if (or (<= (apply max min-case-distances) case-delta) (zero? (count cases-to-pick-from))) + (if (or (= 0 (count tournament)) (<= (apply max min-case-distances) case-delta)) new-downsample (do (if (sequential? (:input1 (first new-downsample))) diff --git a/src/propeller/tools/metrics.cljc b/src/propeller/tools/metrics.cljc index 2ead5ae..dfecf00 100755 --- a/src/propeller/tools/metrics.cljc +++ b/src/propeller/tools/metrics.cljc @@ -12,11 +12,13 @@ (defn argmax "returns the index of the maximum value in a list, randomly tiebreaking" [coll] - (->> coll - (map-indexed vector) - (filter #(= (apply max coll) (second %))) - rand-nth - first)) + (if (zero? (count coll)) + :null + (->> coll + (map-indexed vector) + (filter #(= (apply max coll) (second %))) + rand-nth + first))) (defn mean "Returns the mean of a collection."