From a1252c5c0ac01c69888e4a9da7f84cb9ec374b91 Mon Sep 17 00:00:00 2001
From: Lee Spector <lspector@hampshire.edu>
Date: Mon, 28 Mar 2022 12:29:04 -0400
Subject: [PATCH] Update session.cljc to specify training/testing data among
 other things

---
 src/propeller/session.cljc | 197 +++++++++++--------------------------
 1 file changed, 55 insertions(+), 142 deletions(-)

diff --git a/src/propeller/session.cljc b/src/propeller/session.cljc
index c9a159d..ead64f2 100755
--- a/src/propeller/session.cljc
+++ b/src/propeller/session.cljc
@@ -3,8 +3,6 @@
             [propeller.gp :as gp]
             [propeller.selection :as selection]
             [propeller.variation :as variation]
-            [propeller.problems.simple-regression :as regression]
-            [propeller.problems.string-classification :as string-classif]
             [propeller.push.instructions :as instructions]
             [propeller.push.interpreter :as interpreter]
             [propeller.push.state :as state]))
@@ -15,143 +13,58 @@
 #_(interpreter/interpret-program
     '(1 2 :integer_add) (assoc state/empty-state :keep-history true) 1000)
 
-;#_(interpreter/interpret-program
-;    '(3 3 :integer_eq :exec_if (1 "yes") (2 "no"))
-;    state/empty-state
-;    1000)
-;
-;#_(interpreter/interpret-program
-;    '(:in1 :string_reverse 1 :string_take "?" :string_eq :exec_if
-;       (:in1 " I am asking." :string_concat)
-;       (:in1 " I am saying." :string_concat))
-;    (assoc state/empty-state :input {:in1 "Can you hear me?"})
-;    1000)
-;
-;#_(interpreter/interpret-program
-;    '(:in1 :string_reverse 1 :string_take "?" :string_eq :exec_if
-;       (:in1 " I am asking." :string_concat)
-;       (:in1 " I am saying." :string_concat))
-;    (assoc state/empty-state :input {:in1 "I can hear you."})
-;    1000)
-;
-;#_(genome/plushy->push
-;    (genome/make-random-plushy (instructions/get-stack-instructions #{:float :integer :exec :boolean}) 20))
-;
-;#_(gp/gp {:instructions            propeller.problems.software.number-io/instructions
-;          :error-function          propeller.problems.software.number-io/error-function
-;          :max-generations         500
-;          :population-size         500
-;          :max-initial-plushy-size 100
-;          :step-limit              200
-;          :parent-selection        :lexicase
-;          :tournament-size         5
-;          :umad-rate               0.1
-;          :variation               {:umad 0.5 :crossover 0.5}
-;          :elitism                 false})
-;
-;#_(gp/gp {:instructions            propeller.problems.simple-regression/instructions
-;          :error-function          propeller.problems.simple-regression/error-function
-;          :max-generations         500
-;          :population-size         500
-;          :max-initial-plushy-size 100
-;          :step-limit              200
-;          :parent-selection        :tournament
-;          :tournament-size         5
-;          :umad-rate               0.01
-;          :variation               {:umad      1.0
-;                                    :crossover 0.0}
-;          :elitism                 false})
-;
-;#_(gp/gp {:instructions            propeller.problems.simple-regression/instructions
-;          :error-function          propeller.problems.simple-regression/error-function
-;          :max-generations         500
-;          :population-size         500
-;          :max-initial-plushy-size 100
-;          :step-limit              200
-;          :parent-selection        :tournament
-;          :tournament-size         5
-;          :umad-rate               0.1
-;          :variation               {:umad      1.0
-;                                    :crossover 0.0}
-;          :elitism                 false})
-;
-;
-;#_(gp/gp {:instructions            propeller.problems.simple-regression/instructions
-;          :error-function          propeller.problems.simple-regression/error-function
-;          :max-generations         500
-;          :population-size         500
-;          :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})
-;
-;#_(gp/gp {:instructions            propeller.problems.simple-regression/instructions
-;          :error-function          propeller.problems.simple-regression/error-function
-;          :max-generations         500
-;          :population-size         500
-;          :max-initial-plushy-size 100
-;          :step-limit              200
-;          :parent-selection        :lexicase
-;          :tournament-size         5
-;          :umad-rate               0.1
-;          :diploid-flip-rate       0.1
-;          :variation               {:umad         0.8
-;                                    :diploid-flip 0.2}
-;          :elitism                 false
-;          :diploid                 true})
-;
-;
-;#_(gp/gp {:instructions            propeller.problems.software.smallest/instructions
-;          :error-function          propeller.problems.software.smallest/error-function
-;          :max-generations         500
-;          :population-size         500
-;          :max-initial-plushy-size 100
-;          :step-limit              200
-;          :parent-selection        :lexicase
-;          :tournament-size         5
-;          :umad-rate               0.1
-;          :diploid-flip-rate       0.1
-;          :variation               {;:umad 0.8
-;                                    ;:diploid-flip  0.2
-;                                    :umad 1
-;                                    }
-;          :elitism                 false
-;          :diploid                 false})
-;
-;#_(gp/gp {:instructions            propeller.problems.software.smallest/instructions
-;          :error-function          propeller.problems.software.smallest/error-function
-;          :max-generations         500
-;          :population-size         500
-;          :max-initial-plushy-size 200                      ;100
-;          :step-limit              200
-;          :parent-selection        :lexicase
-;          :tournament-size         5
-;          :umad-rate               0.1
-;          :diploid-flip-rate       0.1
-;          :variation               {:umad         0.8
-;                                    :diploid-flip 0.2
-;                                    ;:umad 1
-;                                    }
-;          :elitism                 false
-;          :diploid                 true})
-;
-;
-;(gp/gp {:instructions            propeller.problems.string-classification/instructions
-;          :error-function          propeller.problems.string-classification/error-function
-;          :max-generations         500
-;          :population-size         500
-;          :max-initial-plushy-size 100
-;          :step-limit              200
-;          :parent-selection        :lexicase
-;          :tournament-size         5
-;          :umad-rate               0.1
-;          :diploid-flip-rate       0.1
-;          :variation               {:umad         0.8
-;                                    :diploid-flip 0.2
-;                                    }
-;          :elitism                 false
-;          :diploid                 true})
+#_(interpreter/interpret-program
+    '(3 3 :integer_eq :exec_if (1 "yes") (2 "no"))
+    state/empty-state
+    1000)
+
+#_(interpreter/interpret-program
+    '(:in1 :string_reverse 1 :string_take "?" :string_eq :exec_if
+       (:in1 " I am asking." :string_concat)
+       (:in1 " I am saying." :string_concat))
+    (assoc state/empty-state :input {:in1 "Can you hear me?"})
+    1000)
+
+#_(interpreter/interpret-program
+    '(:in1 :string_reverse 1 :string_take "?" :string_eq :exec_if
+       (:in1 " I am asking." :string_concat)
+       (:in1 " I am saying." :string_concat))
+    (assoc state/empty-state :input {:in1 "I can hear you."})
+    1000)
+
+#_(genome/plushy->push
+    (genome/make-random-plushy (instructions/get-stack-instructions #{:float :integer :exec :boolean}) 20))
+
+#_(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-initial-plushy-size 100
+        :step-limit              200
+        :parent-selection        :tournament
+        :tournament-size         5
+        :umad-rate               0.01
+        :variation               {:umad      1.0
+                                  :crossover 0.0}
+        :elitism                 false})
+
+#_(require '[propeller.problems.string-classification :as sc])
+
+#_(gp/gp {:instructions            sc/instructions
+          :error-function          sc/error-function
+          :training-data           (:train sc/train-and-test-data)
+          :testing-data            (:test sc/train-and-test-data)
+          :max-generations         500
+          :population-size         500
+          :max-initial-plushy-size 100
+          :step-limit              200
+          :parent-selection        :lexicase
+          :tournament-size         5
+          :umad-rate               0.1
+          :variation               {:umad 0.5 :crossover 0.5}
+          :elitism                 false})
+