Update string-classification for new problem specification scheme; remove unused PSB2 argmap items

This commit is contained in:
Lee Spector 2021-07-13 23:11:58 -04:00
parent 20be7c04e3
commit f94b991864
2 changed files with 33 additions and 33 deletions

View File

@ -27,9 +27,7 @@
:tournament-size 5 :tournament-size 5
:umad-rate 0.1 :umad-rate 0.1
:variation {:umad 0.5 :crossover 0.5} :variation {:umad 0.5 :crossover 0.5}
:elitism false :elitism false}
:PSB2-path ""
:PSB2-problem (clojure.string/replace (first args) #"PSB2." "")}
(eval-problem-var (first args) "arglist") (eval-problem-var (first args) "arglist")
(apply hash-map (apply hash-map
(map #(if (and (string? %) (not (.contains % "/"))) (read-string %) %) (map #(if (and (string? %) (not (.contains % "/"))) (read-string %) %)

View File

@ -40,8 +40,7 @@
"G" "G"
"T")) "T"))
(defn train-and-test-data (def train-and-test-data
[]
(let [train-inputs ["GCG" "GACAG" "AGAAG" "CCCA" "GATTACA" "TAGG" "GACT"] (let [train-inputs ["GCG" "GACAG" "AGAAG" "CCCA" "GATTACA" "TAGG" "GACT"]
test-inputs ["GCGT" "GACTTAG" "AGTAAG" "TCCTCA" "GAACA" "AGG" "GAC"]] test-inputs ["GCGT" "GACTTAG" "AGTAAG" "TCCTCA" "GAACA" "AGG" "GAC"]]
{:train {:inputs train-inputs {:train {:inputs train-inputs
@ -54,11 +53,8 @@
the program's selected behavior match, or 1 if they differ, or 1000000 if no the program's selected behavior match, or 1 if they differ, or 1000000 if no
behavior is produced. The behavior is here defined as the final top item on behavior is produced. The behavior is here defined as the final top item on
the BOOLEAN stack." the BOOLEAN stack."
([argmap individual] [argmap data individual]
(error-function argmap individual :train))
([argmap individual subset]
(let [program (genome/plushy->push (:plushy individual) argmap) (let [program (genome/plushy->push (:plushy individual) argmap)
data (get (train-and-test-data) subset)
inputs (:inputs data) inputs (:inputs data)
correct-outputs (:outputs data) correct-outputs (:outputs data)
outputs (map (fn [input] outputs (map (fn [input]
@ -81,4 +77,10 @@
:behaviors outputs :behaviors outputs
:errors errors :errors errors
:total-error #?(:clj (apply +' errors) :total-error #?(:clj (apply +' errors)
:cljs (apply + errors)))))) :cljs (apply + errors)))))
(def arglist
{:instructions instructions
:error-function error-function
:training-data (:train train-and-test-data)
:testing-data (:test train-and-test-data)})