10 examples of 'history.history keras' in Python

Every line of 'history.history keras' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
7def test_history(self):
8 attention = SeqSelfAttention(return_attention=True,
9 attention_width=3,
10 history_only=True,
11 name='Attention')
12 self.check_mask_shape(attention)
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

65def _history(self):
66 pass
141def load_history(self, history_file):
142 """
143 Load benchmark history from file
144
145 Args:
146 history_file: path to history file
147
148 Returns:
149
150 """
151 logging.info("Loading benchmark history data from {}".format(history_file))
152 with open(os.path.join(os.getcwd(), history_file), "rb") as fp:
153 self.history_data = pickle.load(fp)
161def restore_history(self, history):
162 return self._restore_history(history, _called_directly=False)
16def _save_history(historyPath = _history):
17 readline.write_history_file(_history)
6def history(args):
7 with open(HISTORY_PATH, 'r') as history_file:
8 lines = history_file.readlines()
9
10 # default limit is whole file
11 limit = len(lines)
12
13 if len(args) > 0:
14 limit = int(args[0])
15
16 # start history line to print out
17 start = len(lines) - limit
18
19 for line_num, line in enumerate(lines):
20 if line_num >= start:
21 sys.stdout.write('%d %s' % (line_num + 1, line))
22 sys.stdout.flush()
23
24 return SHELL_STATUS_RUN
264def do_history(self, line):
265 """ Show the history. """
266 self.print_history()
31def plot_history(history):
32 # summarize history for accuracy
33 plt.plot(history.history['acc'])
34 plt.plot(history.history['val_acc'])
35 plt.title('model accuracy')
36 plt.ylabel('accuracy')
37 plt.xlabel('epoch')
38 plt.legend(['train', 'validation'], loc='upper left')
39 plt.show()
40 # summarize history for loss
41 plt.plot(history.history['loss'])
42 plt.plot(history.history['val_loss'])
43 plt.title('model loss')
44 plt.ylabel('loss')
45 plt.xlabel('epoch')
46 plt.legend(['train', 'validation'], loc='upper left')
47 plt.show()
48 # summarize history for error
49 plt.plot(history.history['mean_absolute_error'])
50 plt.plot(history.history['val_mean_absolute_error'])
51 plt.title('model mean_absolute_error')
52 plt.ylabel('mean_absolute_error')
53 plt.xlabel('epoch')
54 plt.legend(['train', 'validation'], loc='upper left')
55 plt.show()
43def save_history(history, result_dir, name):
44 loss=history.history['loss']
45 acc=history.history['acc']
46 val_loss=history.history['val_loss']
47 val_acc=history.history['val_acc']
48 nb_epoch=len(acc)
49
50 with open(os.path.join(result_dir, 'result_{}.txt'.format(name)), 'w') as fp:
51 fp.write('epoch\tloss\tacc\tval_loss\tval_acc\n')
52 for i in range(nb_epoch):
53 fp.write('{}\t{}\t{}\t{}\t{}\n'.format(
54 i, loss[i], acc[i], val_loss[i], val_acc[i]))
223def _set_history(self, h):
224 self._history = h
225 self._history_was_set = True

Related snippets