-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathEvalModel.py
30 lines (22 loc) · 861 Bytes
/
EvalModel.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
import gc
import numpy as np
import sklearn as sklearn
import pdb as check
import modelfunctions
#set name of weights/biases file
weightFile = '../Data/TheBestWeights.h5'
predFile = './Predicted.h5'
testFile = '../Data/Testing.h5'
#names of features
field_names_in = ['stresses_full_xx', 'stresses_full_yy', 'stresses_full_xy', 'stresses_full_xz','stresses_full_yz','stresses_full_zz']
#name of label
field_names_out = 'aftershocksyn'
#load model
model = modelfunctions.create_model()
#assess performance of training network on testing data set
model.load_weights(weightFile)
inTrue, outTrue = modelfunctions.LoadInputs(testFile, field_names_in, field_names_out)
outPred = model.predict(inTrue)
modelfunctions.writeHDF(predFile, inTrue, outPred)
auc = sklearn.metrics.roc_auc_score(outTrue, outPred)
print('merged AUC on testing data set: ' + str(auc))