forked from h2oai/h2o-2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_GLM_params_rand2_8977501266014959103.py
62 lines (55 loc) · 2.23 KB
/
test_GLM_params_rand2_8977501266014959103.py
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import unittest, random, sys, time
sys.path.extend(['.','..','py'])
import h2o, h2o_cmd, h2o_hosts, h2o_glm, h2o_import as h2i
def define_params():
paramDict = {
'standardize': [None, 0,1],
'lsm_solver': [None, 'AUTO','ADMM','GenGradient'],
'beta_epsilon': [None, 0.0001],
'expert_settings': [None, 0, 1],
'family': [None, 'gaussian', 'binomial', 'poisson'],
'thresholds': [None, 0.1, 0.5, 0.7, 0.9],
'lambda': [0, 1e-4],
'alpha': [0,0.5,0.75],
'beta_epsilon': [None, 0.0001],
'case': [1,2,3,4,5,6],
# inverse and log causing problems
# 'link': [None, 'logit','identity', 'log', 'inverse'],
'max_iter': [None, 10],
'weight': [None, 1, 2, 4],
}
return paramDict
class Basic(unittest.TestCase):
def tearDown(self):
h2o.check_sandbox_for_errors()
@classmethod
def setUpClass(cls):
global SEED, localhost
# SEED = h2o.setup_random_seed()
SEED = 8977501266014959103
localhost = h2o.decide_if_localhost()
if (localhost):
h2o.build_cloud(node_count=1)
else:
h2o_hosts.build_cloud_with_hosts(node_count=1)
@classmethod
def tearDownClass(cls):
h2o.tear_down_cloud()
def test_GLM_params_rand2_8977501266014959103(self):
csvPathname = 'covtype/covtype.20k.data'
parseResult = h2i.import_parse(bucket='smalldata', path=csvPathname, schema='put')
paramDict = define_params()
for trial in range(20):
# params is mutable. This is default.
params = {'y': 54, 'alpha': 0, 'lambda': 0, 'case': 1, 'n_folds': 1}
colX = h2o_glm.pickRandGlmParams(paramDict, params)
kwargs = params.copy()
start = time.time()
glm = h2o_cmd.runGLM(timeoutSecs=70, parseResult=parseResult, **kwargs)
# pass the kwargs with all the params, so we know what we asked for!
h2o_glm.simpleCheckGLM(self, glm, None, **kwargs)
h2o.check_sandbox_for_errors()
print "glm end on ", csvPathname, 'took', time.time() - start, 'seconds'
print "Trial #", trial, "completed\n"
if __name__ == '__main__':
h2o.unit_main()