MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / eval

Function eval

modelzoo/esmm/train.py:581–603  ·  view source on GitHub ↗
(sess_config, input_hooks, model, test_init_op, test_steps, output_dir, checkpoint_dir)

Source from the content-addressed store, hash-verified

579
580
581def eval(sess_config, input_hooks, model, test_init_op, test_steps, output_dir, checkpoint_dir):
582 hooks = []
583 hooks.extend(input_hooks)
584
585 scaffold = tf.train.Scaffold(
586 local_init_op=tf.group(tf.local_variables_initializer(), test_init_op))
587 session_creator = tf.train.ChiefSessionCreator(
588 scaffold=scaffold, checkpoint_dir=checkpoint_dir, config=sess_config)
589 writer = tf.summary.FileWriter(os.path.join(output_dir, 'eval'))
590 merged = tf.summary.merge_all()
591
592 with tf.train.MonitoredSession(session_creator=session_creator,
593 hooks=hooks) as sess:
594 for _in in range(1, test_steps + 1):
595 if (_in != test_steps):
596 sess.run([model.acc_op, model.auc_op])
597 if (_in % 1000 == 0):
598 print(f'Evaluation complete:[{_in}/{test_steps}]')
599 else:
600 eval_acc, eval_auc, events = sess.run([model.acc_op, model.auc_op, merged])
601 writer.add_summary(events, _in)
602 print(f'Evaluation complete:[{_in}/{test_steps}]')
603 print(f'ACC = {eval_acc}\nAUC = {eval_auc}')
604
605def main(stock_tf, tf_config=None, server=None):
606 # check dataset and count data set size

Callers 1

mainFunction · 0.70

Calls 6

rangeFunction · 0.50
extendMethod · 0.45
groupMethod · 0.45
joinMethod · 0.45
runMethod · 0.45
add_summaryMethod · 0.45

Tested by

no test coverage detected