Skip to content

Instantly share code, notes, and snippets.

@jaor
Last active November 22, 2018 21:10
Show Gist options
  • Save jaor/8118afc5b9e12e08cf41886f99dfad79 to your computer and use it in GitHub Desktop.
Save jaor/8118afc5b9e12e08cf41886f99dfad79 to your computer and use it in GitHub Desktop.
Model and evaluate over different ranges of a dataset rows
(define (model-range dataset from to)
(create-model dataset {"range" [from to]}))
(define (eval-range dataset model from to)
(let (ev-id (create-evaluation dataset model {"range" [from to]}))
[ev-id ((fetch (wait ev-id)) ["result" "model" "average_phi"])]))
(define (size-evaluations dataset-id steps)
(let (ds (fetch dataset-id)
rows (ds "rows")
step-rows (div rows steps)
tos (for (step (range (- steps 2)))
(* (+ 1 step) step-rows))
models (for (to tos) (model-range dataset-id step-rows rows))
evals (map (lambda (from model)
(eval-range dataset-id model 1 from))
tos models))
(map list tos evals)))
(define result (size-evaluations dataset-id 10))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment