add a convenient generator method to Learner
This commit is contained in:
parent
2b5798332d
commit
69e6ec3fad
1 changed files with 5 additions and 1 deletions
|
@ -50,13 +50,17 @@ class Learner:
|
|||
return False
|
||||
return True
|
||||
|
||||
def batch(self, progress): # TODO: rename
|
||||
def batch(self, progress): # TODO: rename.
|
||||
# interpolates rates between epochs.
|
||||
# unlike epochs, we do not store batch number as a state.
|
||||
# i.e. calling next() will not respect progress.
|
||||
assert 0 <= progress <= 1
|
||||
self.rate = self.rate_at(self._epoch + progress)
|
||||
|
||||
def each_epoch(self): # TODO: rename?
|
||||
while self.next():
|
||||
yield self.epoch
|
||||
|
||||
@property
|
||||
def final_rate(self):
|
||||
return self.rate_at(self.epochs - 1e-8)
|
||||
|
|
Loading…
Reference in a new issue