retested max-min, and added some new logging to judge case proportions
This commit is contained in:
parent
e3dfcfd58e
commit
816b443658
@ -58,6 +58,7 @@
|
||||
(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)})
|
||||
(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)
|
||||
|
@ -48,8 +48,7 @@
|
||||
(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))]
|
||||
;;TODO: REMOVE THIS IT IS JUST FOR TESTING
|
||||
(prn {:data (some #(when (zero? (:index %)) %) indexed-training-data)})
|
||||
(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)
|
||||
@ -68,7 +67,7 @@
|
||||
best-individual-passes-ds (and (= (:parent-selection argmap) :ds-lexicase) (<= (:total-error best-individual) solution-error-threshold))
|
||||
;;best individual on all training-cases
|
||||
tot-best-individual (if best-individual-passes-ds (first full-evaluated-pop) best-individual)]
|
||||
(prn (first training-data))
|
||||
(prn {:ds-inputs (map #(first (:input1 %)) training-data)})
|
||||
(if (:custom-report argmap)
|
||||
((:custom-report argmap) ds-evaluated-pop generation argmap)
|
||||
(report ds-evaluated-pop generation argmap))
|
||||
|
@ -23,9 +23,12 @@
|
||||
:boolean_invert_first_then_and
|
||||
:boolean_invert_second_then_and
|
||||
:boolean_from_integer
|
||||
true
|
||||
false
|
||||
'close
|
||||
0
|
||||
1))
|
||||
1
|
||||
3))
|
||||
|
||||
(defn- target-function
|
||||
"If number is divisible by 3 but not 7, leave TRUE on the BOOLEAN stack else leave FALSE on the BOOLEAN stack"
|
||||
|
@ -5,8 +5,7 @@
|
||||
"filters a collection by a list of indices"
|
||||
[coll idxs]
|
||||
;(prn {:func :filter-by-index :coll coll :idxs idxs})
|
||||
(keep-indexed #(when ((set idxs) %1) %2)
|
||||
coll))
|
||||
(map (partial nth coll) idxs))
|
||||
|
||||
(defn drop-nth
|
||||
"drops the nth element from a collection"
|
||||
|
@ -156,3 +156,13 @@
|
||||
'({:index 0 :distances [2 2 2 2 2]} {:index 1 :distances [2 2 2 2 2]} {:index 2 :distances [2 2 2 2 2]} {:index 3 :distances [2 2 2 2 2]} {:index 4 :distances [2 2 2 2 2]}))
|
||||
'({:index 0 :distances [2 2 2 2 2]} {:index 1 :distances [2 2 2 2 2]} {:index 2 :distances [2 2 2 2 2]}
|
||||
{:index 3 :distances [2 2 2 0 0]} {:index 4 :distances [2 2 2 0 0]}))))))
|
||||
|
||||
(t/deftest case-maxmin-test
|
||||
(t/testing "case-maxmin selects correct downsample"
|
||||
(t/is (let [selected (ds/select-downsample-maxmin '({:input1 [0] :output1 [10] :index 0 :distances [0 5 0 0 0]}
|
||||
{:input1 [1] :output1 [11] :index 1 :distances [0 5 0 0 0]}
|
||||
{:input1 [2] :output1 [12] :index 2 :distances [5 5 5 5 5]}
|
||||
{:input1 [3] :output1 [13] :index 3 :distances [0 5 0 0 0]}
|
||||
{:input1 [4] :output1 [14] :index 4 :distances [0 5 0 0 0]})
|
||||
{:downsample-rate 0.4 :case-t-size 5})]
|
||||
(or (= (:index (first selected)) 1) (= (:index (second selected)) 1))))))
|
Loading…
x
Reference in New Issue
Block a user