-
Notifications
You must be signed in to change notification settings - Fork 270
/
test_autom8.py
64 lines (49 loc) · 1.97 KB
/
test_autom8.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
63
64
def test_autom8():
import talos
import wrangle
from tensorflow.keras.optimizers.legacy import Adam
print('\n >>> start AutoParams()... \n')
p = talos.autom8.AutoParams()
p.params
p = talos.autom8.AutoParams(p.params)
p.resample_params(5)
p.activations(['relu'])
p.batch_size(20, 50, 2)
p.dropout(0, 0.22, 0.04)
p.epochs(5, 10, 1)
p.kernel_initializers(['zeros'])
p.last_activations(['softmax'])
p.layers(0, 2, 1)
p.losses([talos.utils.metrics.f1score])
p.lr([0.01])
p.networks(['dense'])
p.neurons(1, 5, 1)
p.optimizers([Adam])
p.shapes(['brick'])
p.shapes_slope(0, .2, .01)
p.resample_params(1)
print('finised AutoParams() \n')
# # # # # # # # # # # # # # # #
print('\n >>> start AutoModel(), AutoScan() and AutoPredict()... \n')
x, y = wrangle.utils.create_synth_data('binary', 50, 10, 1)
p.losses(['binary_crossentropy'])
auto = talos.autom8.AutoScan('binary', 'test_a', 1)
scan_object = auto.start(x, y, params=p.params)
talos.autom8.AutoPredict(scan_object, x, y, x, 'binary')
x, y = wrangle.utils.create_synth_data('multi_label', 50, 10, 4)
p.losses(['categorical_crossentropy'])
auto = talos.autom8.AutoScan('multi_label', 'test_b', 1)
auto.start(x, y)
talos.autom8.AutoPredict(scan_object, x, y, x, 'multi_label')
x, y = wrangle.utils.create_synth_data('multi_class', 50, 10, 3)
p.losses(['sparse_categorical_crossentropy'])
auto = talos.autom8.AutoScan('multi_class', 'test_c', 1)
auto.start(x, y, params=p.params)
talos.autom8.AutoPredict(scan_object, x, y, x, 'multi_class')
x, y = wrangle.utils.create_synth_data('continuous', 50, 10, 1)
p.losses(['mae'])
auto = talos.autom8.AutoScan('continuous', 'test_d', 1)
auto.start(x, y, params=p.params)
talos.autom8.AutoPredict(scan_object, x, y, x, 'continuous')
print('finised AutoModel(), AutoScan() and AutoPredict() \n')
# # # # # # # # # # # # # # # #