Update dice-game for new problem specification scheme
This commit is contained in:
parent
b3b1363942
commit
e51bdf2fab
@ -65,7 +65,7 @@
|
|||||||
|
|
||||||
|
|
||||||
(defn error-function
|
(defn error-function
|
||||||
([argmap data individual]
|
[argmap data individual]
|
||||||
(let [program (genome/plushy->push (:plushy individual) argmap)
|
(let [program (genome/plushy->push (:plushy individual) argmap)
|
||||||
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)
|
||||||
@ -92,7 +92,7 @@
|
|||||||
:behaviors parsed-outputs
|
:behaviors parsed-outputs
|
||||||
:errors errors
|
:errors errors
|
||||||
:total-error #?(:clj (apply +' errors)
|
:total-error #?(:clj (apply +' errors)
|
||||||
:cljs (apply + errors))))))
|
:cljs (apply + errors)))))
|
||||||
|
|
||||||
(def arglist
|
(def arglist
|
||||||
{:instructions instructions
|
{:instructions instructions
|
||||||
|
@ -17,6 +17,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" "dice-game" 200 2000))
|
||||||
|
|
||||||
(defn map-vals-input
|
(defn map-vals-input
|
||||||
"Returns all the input values of a map (specific helper method for bouncing-balls)"
|
"Returns all the input values of a map (specific helper method for bouncing-balls)"
|
||||||
[i]
|
[i]
|
||||||
@ -40,11 +42,8 @@
|
|||||||
(list 0.0 1.0))))
|
(list 0.0 1.0))))
|
||||||
|
|
||||||
(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] (map-vals-input i)) data)
|
inputs (map (fn [i] (map-vals-input i)) data)
|
||||||
correct-outputs (map (fn [i] (map-vals-output i)) data)
|
correct-outputs (map (fn [i] (map-vals-output i)) data)
|
||||||
outputs (map (fn [input]
|
outputs (map (fn [input]
|
||||||
@ -66,4 +65,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