separate argmap from -main

This commit is contained in:
Rowan Torbitzky-Lane 2025-02-25 23:51:14 -06:00
parent 960b561e3e
commit b698faae08

View File

@ -62,6 +62,21 @@
:total-error #?(:clj (apply +' errors)
:cljs (apply + errors))))))
(def integer-argmap
{:instructions instructions
:error-function error-function
:training-data (:train train-and-test-data)
:testing-data (:test train-and-test-data)
:max-generations 300
:population-size 1000
:max-initial-plushy-size 5
:step-limit 200
:parent-selection :lexicase
:tournament-size 5
:umad-rate 0.1
:variation {:umad 1.0 :crossover 0.0}
:elitism false})
(defn -main
"Runs the top-level genetic programming function, giving it a map of
arguments with defaults that can be overridden from the command line
@ -69,17 +84,5 @@
[& args]
(gp/gp
(merge
{:instructions instructions
:error-function error-function
:training-data (:train train-and-test-data)
:testing-data (:test train-and-test-data)
:max-generations 300
:population-size 1000
:max-initial-plushy-size 100
:step-limit 200
:parent-selection :lexicase
:tournament-size 5
:umad-rate 0.1
:variation {:umad 1.0 :crossover 0.0}
:elitism false}
integer-argmap
(apply hash-map (map #(if (string? %) (read-string %) %) args)))))