Compare commits

..

2 Commits

Author SHA1 Message Date
b166bacfb5 more imports, play analysis tools
Some checks are pending
CI / test-clj (push) Waiting to run
CI / test-cljs (push) Waiting to run
2025-02-25 23:51:35 -06:00
b698faae08 separate argmap from -main 2025-02-25 23:51:14 -06:00
2 changed files with 30 additions and 21 deletions

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}
(apply hash-map (map #(if (string? %) (read-string %) %) args)))))
integer-argmap
(apply hash-map (map #(if (string? %) (read-string %) %) args)))))

View File

@ -16,7 +16,10 @@
[propeller.variation :as variation]
[propeller.push.instructions :as instructions]
[propeller.push.interpreter :as interpreter]
[propeller.push.state :as state]))
[propeller.push.state :as state]
[propeller.problems.regression.integer-regression :as regression]
[propeller.downsample :as downsample]
))
;; Interpreting a simple Push program:
@ -31,9 +34,10 @@
;; A program with a conditional:
#_(interpreter/interpret-program
'(3 3 :integer_eq :exec_if (1 "yes") (2 "no"))
state/empty-state
1000)
'(3 3 :integer_eq :exec_if (1 "yes") (2 "no"))
;;(assoc state/empty-state :keep-history true)
state/empty-state
1000)
;; A program using an input instruction:
@ -66,14 +70,14 @@
;; items defined for the problem. Depending on your IDE and setup, you may
;; also have to open the problem's file and evaluate its contents.
#_(require '[propeller.problems.simple-regression :as regression])
;;#_(require '[propeller.problems.simple-regression :as regression])
#_(gp/gp {:instructions regression/instructions
:error-function regression/error-function
:training-data (:train regression/train-and-test-data)
:testing-data (:test regression/train-and-test-data)
:max-generations 500
:population-size 500
:max-generations 5
:population-size 50
:max-initial-plushy-size 100
:step-limit 200
:parent-selection :tournament
@ -111,3 +115,5 @@
#_(require '[propeller.problems.simple-regression :as regression])
#_(regression/-main :population-size 100 :variation {:umad 1.0})
;; Analyze how downsample indicies are assigned
#_(downsample/assign-indices-to-data (:train regression/train-and-test-data) regression/integer-argmap)