Update twitter for new problem specification scheme

This commit is contained in:
Lee Spector 2021-07-13 23:01:19 -04:00
parent b2fb5b1f53
commit 20be7c04e3

View File

@ -20,6 +20,8 @@
; Source: https://arxiv.org/pdf/2106.06086.pdf
; ===============================================================
(def train-and-test-data (psb2/fetch-examples "data" "twitter" 200 2000))
(defn random-int [] (- (rand-int 201) 100))
(def instructions
@ -35,11 +37,8 @@
(list 0 140 "Too many characters" "You didn't type anything" "your tweet has " " characters"))))
(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]
@ -65,6 +64,10 @@
:behaviors parsed-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)})