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))) (utils/filter-by-index distance-list (map #(:index %) tournament)))
(map #(:distances %) new-downsample))) (map #(:distances %) new-downsample)))
selected-case-index (metrics/argmax min-case-distances)] 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 new-downsample
(do (do
(if (sequential? (:input1 (first new-downsample))) (if (sequential? (:input1 (first new-downsample)))

View File

@ -12,11 +12,13 @@
(defn argmax (defn argmax
"returns the index of the maximum value in a list, randomly tiebreaking" "returns the index of the maximum value in a list, randomly tiebreaking"
[coll] [coll]
(->> coll (if (zero? (count coll))
(map-indexed vector) :null
(filter #(= (apply max coll) (second %))) (->> coll
rand-nth (map-indexed vector)
first)) (filter #(= (apply max coll) (second %)))
rand-nth
first)))
(defn mean (defn mean
"Returns the mean of a collection." "Returns the mean of a collection."