-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathomain.py
More file actions
38 lines (23 loc) · 735 Bytes
/
Copy pathomain.py
File metadata and controls
38 lines (23 loc) · 735 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import rnn
import numpy as np
import math
def env(ts_id):
rnn.env(ts_id)
def main(job_id, params):
params['iter']=[itermap(params['iter'][0])]
no_array={}
# for some reason params are arrays!!
for aparam in params:
no_array[aparam]=params[aparam][0]
o=float(rnn.function(no_array,run_id=job_id))
if math.isnan(o): raise ValueError('got nan result')
return {'main':o}
def rootmap(y,scalex,p=.5):
"""map 0-1(y:x) to some (square?) root function (x->y)"""
return ((scalex**p)*y)**(p**-1)
def itermap(y,mostiter=20):
iterlim=99999
if y==1: y=.99999999
o=int(math.ceil(rootmap(y,mostiter)))
if o==mostiter: return iterlim
else: return o