From f25cd75f2a8ef5128201b5be9ae773b7f4982b7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Flores=20Garc=C3=ADa?= Date: Sat, 31 Jul 2021 14:01:25 -0400 Subject: [PATCH] Add support for a custom-report function --- src/propeller/gp.cljc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/propeller/gp.cljc b/src/propeller/gp.cljc index 1ad3f71..e5dccf6 100755 --- a/src/propeller/gp.cljc +++ b/src/propeller/gp.cljc @@ -31,7 +31,7 @@ (defn gp "Main GP loop." [{:keys [population-size max-generations error-function instructions - max-initial-plushy-size] + max-initial-plushy-size custom-report] :as argmap}] ;; (prn {:starting-args (update (update argmap :error-function str) :instructions str)}) @@ -49,7 +49,9 @@ (partial error-function argmap (:training-data argmap)) population)) 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 ;; Success on training cases is verified on testing cases (zero? (:total-error best-individual))