Update bowling for new problem specification scheme
This commit is contained in:
parent
5aaf914316
commit
e8d6670a2d
@ -6,7 +6,8 @@
|
|||||||
[propeller.push.utils.helpers :refer [get-stack-instructions]]
|
[propeller.push.utils.helpers :refer [get-stack-instructions]]
|
||||||
[propeller.push.state :as state]
|
[propeller.push.state :as state]
|
||||||
[clojure.pprint :as pprint]
|
[clojure.pprint :as pprint]
|
||||||
[propeller.tools.math :as math]))
|
[propeller.tools.math :as math]
|
||||||
|
[psb2.core :as psb2]))
|
||||||
|
|
||||||
; =========== PROBLEM DESCRIPTION ======================
|
; =========== PROBLEM DESCRIPTION ======================
|
||||||
; BOWLING from PSB2
|
; BOWLING from PSB2
|
||||||
@ -17,6 +18,8 @@
|
|||||||
; Source: https://arxiv.org/pdf/2106.06086.pdf
|
; Source: https://arxiv.org/pdf/2106.06086.pdf
|
||||||
; =========================================================
|
; =========================================================
|
||||||
|
|
||||||
|
(def train-and-test-data (psb2/fetch-examples "data" "bowling" 200 2000))
|
||||||
|
|
||||||
(defn random-int [] (- (rand-int 201) 100))
|
(defn random-int [] (- (rand-int 201) 100))
|
||||||
|
|
||||||
(def instructions
|
(def instructions
|
||||||
@ -32,11 +35,8 @@
|
|||||||
(list \- \X \/ \1 \2 \3 \4 \5 \6 \7 \8 \9 10 random-int))))
|
(list \- \X \/ \1 \2 \3 \4 \5 \6 \7 \8 \9 10 random-int))))
|
||||||
|
|
||||||
(defn error-function
|
(defn error-function
|
||||||
([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 (get argmap :train-and-test-data) subset)
|
|
||||||
inputs (map (fn [i] (get i :input1)) data)
|
inputs (map (fn [i] (get i :input1)) data)
|
||||||
correct-outputs (map (fn [i] (get i :output1)) data)
|
correct-outputs (map (fn [i] (get i :output1)) data)
|
||||||
outputs (map (fn [input]
|
outputs (map (fn [input]
|
||||||
@ -57,4 +57,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)})
|
Loading…
x
Reference in New Issue
Block a user