diff --git a/src/propeller/downsample.cljc b/src/propeller/downsample.cljc index 52897e3..25749c9 100644 --- a/src/propeller/downsample.cljc +++ b/src/propeller/downsample.cljc @@ -43,7 +43,8 @@ rest-of-cases)))))))) (defn select-downsample-maxmin - "uses tournament selection to select a downsample that has it's cases maximally far away" + "selects a downsample that has it's cases maximally far away by sequentially + adding cases to the downsample that have their closest case maximally far away" [training-data {:keys [downsample-rate case-t-size]}] (let [shuffled-cases (shuffle training-data) goal-size (int (* downsample-rate (count training-data)))] @@ -58,7 +59,9 @@ (utils/filter-by-index distance-list (map #(:index %) tournament))) (map #(:distances %) new-downsample))) selected-case-index (metrics/argmax min-case-distances)] - (prn {:cases-in-ds (map #(first (:input1 %)) new-downsample) :cases-in-tourn (map #(first (:input1 %)) tournament)}) + (if (sequential? (:input1 (first new-downsample))) + (prn {:cases-in-ds (map #(first (:input1 %)) new-downsample) :cases-in-tourn (map #(first (:input1 %)) tournament)}) + (prn {:cases-in-ds (map #(:input1 %) new-downsample) :cases-in-tourn (map #(:input1 %) tournament)})) (prn {:min-case-distances min-case-distances :selected-case-index selected-case-index}) (recur (conj new-downsample (nth tournament selected-case-index)) (shuffle (concat (utils/drop-nth selected-case-index tournament) diff --git a/src/propeller/gp.cljc b/src/propeller/gp.cljc index d64fe96..9b1f1e9 100644 --- a/src/propeller/gp.cljc +++ b/src/propeller/gp.cljc @@ -48,7 +48,6 @@ (fn [_] {:plushy (genome/make-random-plushy instructions max-initial-plushy-size)}) (range population-size)) indexed-training-data (downsample/assign-indices-to-data (downsample/initialize-case-distances argmap))] - (prn {:first-data (some #(when (zero? (:index %)) %) indexed-training-data)}) (let [training-data (if (= (:parent-selection argmap) :ds-lexicase) (case (:ds-function argmap) :case-avg (downsample/select-downsample-avg indexed-training-data argmap)