1
1
#!/usr/bin/env python
2
2
import pytest
3
+ import numpy as np
3
4
4
5
5
6
def test_train_small_model_single_target (subset_moddata , tf_session ):
@@ -21,6 +22,7 @@ def test_train_small_model_single_target(subset_moddata, tf_session):
21
22
22
23
model .fit (data , epochs = 2 )
23
24
model .predict (data )
25
+ assert not np .isnan (model .evaluate (data ))
24
26
25
27
26
28
def test_train_small_model_single_target_classif (subset_moddata , tf_session ):
@@ -49,6 +51,7 @@ def is_metal(egap):
49
51
)
50
52
51
53
model .fit (data , epochs = 2 )
54
+ assert not np .isnan (model .evaluate (data ))
52
55
53
56
54
57
def test_train_small_model_multi_target (subset_moddata , tf_session ):
@@ -70,6 +73,7 @@ def test_train_small_model_multi_target(subset_moddata, tf_session):
70
73
71
74
model .fit (data , epochs = 2 )
72
75
model .predict (data )
76
+ assert not np .isnan (model .evaluate (data ))
73
77
74
78
75
79
def test_train_small_model_presets (subset_moddata , tf_session ):
@@ -109,6 +113,7 @@ def test_train_small_model_presets(subset_moddata, tf_session):
109
113
models = results [0 ]
110
114
assert len (models ) == len (modified_presets )
111
115
assert len (models [0 ]) == num_nested
116
+ assert not np .isnan (model .evaluate (data ))
112
117
113
118
114
119
def test_model_integration (subset_moddata , tf_session ):
@@ -134,6 +139,7 @@ def test_model_integration(subset_moddata, tf_session):
134
139
loaded_model = MODNetModel .load ("test" )
135
140
136
141
assert model .predict (data ).equals (loaded_model .predict (data ))
142
+ assert not np .isnan (model .evaluate (data ))
137
143
138
144
139
145
def test_train_small_bayesian_single_target (subset_moddata , tf_session ):
@@ -156,6 +162,7 @@ def test_train_small_bayesian_single_target(subset_moddata, tf_session):
156
162
model .fit (data , epochs = 2 )
157
163
model .predict (data )
158
164
model .predict (data , return_unc = True )
165
+ assert not np .isnan (model .evaluate (data ))
159
166
160
167
161
168
def test_train_small_bayesian_single_target_classif (subset_moddata , tf_session ):
@@ -186,6 +193,7 @@ def is_metal(egap):
186
193
model .fit (data , epochs = 2 )
187
194
model .predict (data )
188
195
model .predict (data , return_unc = True )
196
+ assert not np .isnan (model .evaluate (data ))
189
197
190
198
191
199
def test_train_small_bayesian_multi_target (subset_moddata , tf_session ):
@@ -208,6 +216,7 @@ def test_train_small_bayesian_multi_target(subset_moddata, tf_session):
208
216
model .fit (data , epochs = 2 )
209
217
model .predict (data )
210
218
model .predict (data , return_unc = True )
219
+ assert not np .isnan (model .evaluate (data ))
211
220
212
221
213
222
def test_train_small_bootstrap_single_target (subset_moddata , tf_session ):
@@ -232,6 +241,7 @@ def test_train_small_bootstrap_single_target(subset_moddata, tf_session):
232
241
model .fit (data , epochs = 2 )
233
242
model .predict (data )
234
243
model .predict (data , return_unc = True )
244
+ assert not np .isnan (model .evaluate (data ))
235
245
236
246
237
247
def test_train_small_bootstrap_single_target_classif (small_moddata , tf_session ):
@@ -264,6 +274,7 @@ def is_metal(egap):
264
274
model .fit (data , epochs = 2 )
265
275
model .predict (data )
266
276
model .predict (data , return_unc = True )
277
+ assert not np .isnan (model .evaluate (data ))
267
278
268
279
269
280
def test_train_small_bootstrap_multi_target (small_moddata , tf_session ):
@@ -333,3 +344,5 @@ def test_train_small_bootstrap_presets(small_moddata, tf_session):
333
344
models = results [0 ]
334
345
assert len (models ) == len (modified_presets )
335
346
assert len (models [0 ]) == num_nested
347
+
348
+ assert not np .isnan (model .evaluate (data ))
0 commit comments