class DNN::Callbacks::CheckPoint
A callback that save the model at the after of the epoch. @param [String] base_file_name Base file name for saving. @param [Boolean] include_model When set a true, save data included model structure. @param [Integer] interval Save interval.
Public Class Methods
new(base_file_name, include_model: true, interval: 1)
click to toggle source
# File lib/dnn/core/callbacks.rb, line 44 def initialize(base_file_name, include_model: true, interval: 1) @base_file_name = base_file_name @include_model = include_model @interval = interval end
Public Instance Methods
after_epoch()
click to toggle source
# File lib/dnn/core/callbacks.rb, line 50 def after_epoch saver = Savers::MarshalSaver.new(@model, include_model: @include_model) if @model.last_log[:epoch] % @interval == 0 saver.save(@base_file_name + "_epoch#{model.last_log[:epoch]}.marshal") end end