train-and-test function added
This commit is contained in:
parent
62ac9e570c
commit
6def4035c3
@ -7,7 +7,11 @@
|
|||||||
|
|
||||||
(defn eval-problem-var
|
(defn eval-problem-var
|
||||||
[problem-name var-name]
|
[problem-name var-name]
|
||||||
(eval (symbol (str "propeller.problems." problem-name "/" var-name))))
|
(eval (symbol (str "propeller.problems." problem-name "/" var-name)))
|
||||||
|
;; Overload 2: PSB specific
|
||||||
|
;; Passes into eval
|
||||||
|
[problem-name var-name PSB2-name]
|
||||||
|
((eval (symbol (str "propeller.problems." problem-name "/" var-name))) PSB2-name))
|
||||||
|
|
||||||
(defn -main
|
(defn -main
|
||||||
"Runs propel-gp, giving it a map of arguments."
|
"Runs propel-gp, giving it a map of arguments."
|
||||||
@ -25,6 +29,14 @@
|
|||||||
(println (str "Set path to PSB2 as " (second args)))
|
(println (str "Set path to PSB2 as " (second args)))
|
||||||
(System/exit 1))
|
(System/exit 1))
|
||||||
|
|
||||||
|
;; Creates PSB2 problems
|
||||||
|
(when (= (first args) "PSB2")
|
||||||
|
;; For tomorrow, Figure out what this does?
|
||||||
|
(require (symbol (str "propeller.problems.PSB2" (first args))))
|
||||||
|
;; For tomorrow, add the gp/gp function here
|
||||||
|
;; ---
|
||||||
|
|
||||||
|
|
||||||
;; Creates regular problems
|
;; Creates regular problems
|
||||||
(require (symbol (str "propeller.problems." (first args))))
|
(require (symbol (str "propeller.problems." (first args))))
|
||||||
(gp/gp
|
(gp/gp
|
||||||
|
@ -1,3 +1,15 @@
|
|||||||
(ns propeller.problems.PSB2-Problems
|
(ns propeller.problems.PSB2-Problems
|
||||||
(:require [psb2.core :as psb2]))
|
(:require [psb2.core :as psb2]))
|
||||||
|
|
||||||
|
;; Get path from text file
|
||||||
|
(def PSB2-path (slurp "PSB2_path.txt"))
|
||||||
|
|
||||||
|
(defn train-and-test
|
||||||
|
"Returns the train and test sets from PSB2 using Prof. Helmuth's function"
|
||||||
|
;; Default to 200 train and 2000 test
|
||||||
|
[problem]
|
||||||
|
(psb2/fetch-examples PSB2-path problem 200 2000)
|
||||||
|
;; To with 2 extra args, can customise train and test set sizes
|
||||||
|
[problem train test]
|
||||||
|
(psb2/fetch-examples PSB2-path problem train test))
|
||||||
|
|
||||||
|
@ -72,3 +72,8 @@
|
|||||||
:errors errors
|
:errors errors
|
||||||
:total-error #?(:clj (apply +' errors)
|
:total-error #?(:clj (apply +' errors)
|
||||||
:cljs (apply + errors))))))
|
:cljs (apply + errors))))))
|
||||||
|
|
||||||
|
|
||||||
|
(defn test-thingy
|
||||||
|
[x]
|
||||||
|
(println x))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user