Update fuel-cost for new problem specification scheme
This commit is contained in:
parent
e51bdf2fab
commit
1032895b8f
@ -18,6 +18,8 @@
|
||||
; Source: https://arxiv.org/pdf/2106.06086.pdf
|
||||
; ============================================================
|
||||
|
||||
(def train-and-test-data (psb2/fetch-examples "data" "fuel-cost" 200 2000))
|
||||
|
||||
; Random integer between -100 and 100 (from smallest)
|
||||
(defn random-int [] (- (rand-int 201) 100))
|
||||
|
||||
@ -34,11 +36,8 @@
|
||||
(list random-int 0 1 2 3))))
|
||||
|
||||
(defn error-function
|
||||
([argmap individual]
|
||||
(error-function argmap individual :train))
|
||||
([argmap individual subset]
|
||||
[argmap data individual]
|
||||
(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)
|
||||
correct-outputs (map (fn [i] (get i :output1)) data)
|
||||
outputs (map (fn [input]
|
||||
@ -59,5 +58,11 @@
|
||||
:behaviors outputs
|
||||
:errors 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