Add support for a custom-report function
This commit is contained in:
parent
4058b8e7b0
commit
f25cd75f2a
@ -31,7 +31,7 @@
|
|||||||
(defn gp
|
(defn gp
|
||||||
"Main GP loop."
|
"Main GP loop."
|
||||||
[{:keys [population-size max-generations error-function instructions
|
[{:keys [population-size max-generations error-function instructions
|
||||||
max-initial-plushy-size]
|
max-initial-plushy-size custom-report]
|
||||||
:as argmap}]
|
:as argmap}]
|
||||||
;;
|
;;
|
||||||
(prn {:starting-args (update (update argmap :error-function str) :instructions str)})
|
(prn {:starting-args (update (update argmap :error-function str) :instructions str)})
|
||||||
@ -49,7 +49,9 @@
|
|||||||
(partial error-function argmap (:training-data argmap))
|
(partial error-function argmap (:training-data argmap))
|
||||||
population))
|
population))
|
||||||
best-individual (first evaluated-pop)]
|
best-individual (first evaluated-pop)]
|
||||||
(report evaluated-pop generation argmap)
|
(if (custom-report argmap)
|
||||||
|
((custom-report argmap) evaluated-pop generation argmap)
|
||||||
|
(report evaluated-pop generation argmap))
|
||||||
(cond
|
(cond
|
||||||
;; Success on training cases is verified on testing cases
|
;; Success on training cases is verified on testing cases
|
||||||
(zero? (:total-error best-individual))
|
(zero? (:total-error best-individual))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user