Print average hypervariability when using autoconstructive hypervariability
This commit is contained in:
parent
5103463cd8
commit
139e395f60
@ -20,16 +20,28 @@
|
|||||||
"Reports information for each generation."
|
"Reports information for each generation."
|
||||||
[pop generation argmap]
|
[pop generation argmap]
|
||||||
(let [best (first pop)]
|
(let [best (first pop)]
|
||||||
(clojure.pprint/pprint {:generation generation
|
(clojure.pprint/pprint
|
||||||
:best-plushy (:plushy best)
|
(merge {:generation generation
|
||||||
:best-program (genome/plushy->push (:plushy best) argmap)
|
:best-plushy (:plushy best)
|
||||||
:best-total-error (:total-error best)
|
:best-program (genome/plushy->push (:plushy best) argmap)
|
||||||
:best-errors (:errors best)
|
:best-total-error (:total-error best)
|
||||||
:best-behaviors (:behaviors best)
|
:best-errors (:errors best)
|
||||||
:genotypic-diversity (float (/ (count (distinct (map :plushy pop))) (count pop)))
|
:best-behaviors (:behaviors best)
|
||||||
:behavioral-diversity (float (/ (count (distinct (map :behaviors pop))) (count pop)))
|
:genotypic-diversity (float (/ (count (distinct (map :plushy pop))) (count pop)))
|
||||||
:average-genome-length (float (/ (reduce + (map count (map :plushy pop))) (count pop)))
|
:behavioral-diversity (float (/ (count (distinct (map :behaviors pop))) (count pop)))
|
||||||
:average-total-error (float (/ (reduce + (map :total-error pop)) (count pop)))})
|
:average-genome-length (float (/ (reduce + (map count (map :plushy pop))) (count pop)))
|
||||||
|
:average-total-error (float (/ (reduce + (map :total-error pop)) (count pop)))}
|
||||||
|
(if (> (or (:ah-umad (:variation argmap)) 0) 0) ;; using autoconstructive hypervariability
|
||||||
|
{:average-hypervariability
|
||||||
|
(let [variabilities (map (fn [i]
|
||||||
|
(let [p (:plushy i)]
|
||||||
|
(if (empty? p)
|
||||||
|
0
|
||||||
|
(/ (reduce + (variation/ah-rates p 0 1))
|
||||||
|
(count p)))))
|
||||||
|
pop)]
|
||||||
|
(float (/ (reduce + variabilities) (count variabilities))))}
|
||||||
|
{})))
|
||||||
(println)))
|
(println)))
|
||||||
|
|
||||||
(defn gp
|
(defn gp
|
||||||
@ -54,7 +66,7 @@
|
|||||||
(utils/pmapallv
|
(utils/pmapallv
|
||||||
(partial error-function argmap (:training-data argmap))
|
(partial error-function argmap (:training-data argmap))
|
||||||
population
|
population
|
||||||
argmap))
|
argmap))
|
||||||
best-individual (first evaluated-pop)
|
best-individual (first evaluated-pop)
|
||||||
argmap (if (= (:parent-selection argmap) :epsilon-lexicase)
|
argmap (if (= (:parent-selection argmap) :epsilon-lexicase)
|
||||||
(assoc argmap :epsilons (selection/epsilon-list evaluated-pop))
|
(assoc argmap :epsilons (selection/epsilon-list evaluated-pop))
|
||||||
@ -69,8 +81,8 @@
|
|||||||
(prn {:total-test-error
|
(prn {:total-test-error
|
||||||
(:total-error (error-function argmap (:testing-data argmap) best-individual))})
|
(:total-error (error-function argmap (:testing-data argmap) best-individual))})
|
||||||
(when (:simplification? argmap)
|
(when (:simplification? argmap)
|
||||||
(let [simplified-plushy (simplification/auto-simplify-plushy
|
(let [simplified-plushy (simplification/auto-simplify-plushy
|
||||||
(:plushy best-individual)
|
(:plushy best-individual)
|
||||||
error-function argmap)]
|
error-function argmap)]
|
||||||
(prn {:total-test-error-simplified
|
(prn {:total-test-error-simplified
|
||||||
(:total-error (error-function argmap
|
(:total-error (error-function argmap
|
||||||
|
Loading…
x
Reference in New Issue
Block a user