fixed autods errors

This commit is contained in:
Ryan Boldi 2022-10-25 13:00:50 -04:00
parent fc738e2154
commit 1f62d9ca41
2 changed files with 8 additions and 6 deletions

View File

@ -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)))

View File

@ -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."