-
Notifications
You must be signed in to change notification settings - Fork 11
/
EvalModel2.py
37 lines (29 loc) · 1.2 KB
/
EvalModel2.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
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'
trainFile = '../Data/Training.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))
print('length of testing dataset: ', len(outPred))
inTrue, outTrue = modelfunctions.LoadInputs(trainFile, field_names_in, field_names_out)
outPred = model.predict(inTrue)
auc = sklearn.metrics.roc_auc_score(outTrue, outPred)
print('merged AUC on training data set: ' + str(auc))
print('length of training dataset: ', len(outPred))