fix mongo observer
This commit is contained in:
parent
411ec3db86
commit
a4b75a3821
@ -46,15 +46,17 @@ def tokenize(x, x_test, pad_length, num_words):
|
||||
|
||||
|
||||
@ex.capture
|
||||
def evaluate_and_save(model, x, y, abs_path, build_number):
|
||||
def evaluate_and_save(model, x, y, abs_path, build_number, _run):
|
||||
loss, accuracy = model.evaluate(x, y, verbose=False)
|
||||
y_predicted = (model.predict(x) >= 0.5).astype(int)
|
||||
evaluation_file_path = os.path.join(abs_path, 'neural_network_evaluation.csv')
|
||||
with open(evaluation_file_path, 'a+') as f:
|
||||
result = f'{build_number},{accuracy},{loss},{precision_score(y, y_predicted)},{recall_score(y, y_predicted)},{f1_score(y, y_predicted)}'
|
||||
f.write(result + '\n')
|
||||
ex.log_scalar("loss", loss)
|
||||
ex.log_scalar("accuracy", accuracy)
|
||||
# ex.log_scalar("loss", loss)
|
||||
_run.log_scalar("loss", loss)
|
||||
# ex.log_scalar("accuracy", accuracy)
|
||||
_run.log_scalar("accuracy", accuracy)
|
||||
ex.add_artifact(evaluation_file_path)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user