Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
3pia
CMS Analyses
Tools
Commits
5fb52ecd
Commit
5fb52ecd
authored
4 years ago
by
Dennis Noll
Browse files
Options
Downloads
Patches
Plain Diff
[keras] EarlyStopping: now includes stoptime
parent
70000518
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
keras.py
+6
-2
6 additions, 2 deletions
keras.py
with
6 additions
and
2 deletions
keras.py
+
6
−
2
View file @
5fb52ecd
...
...
@@ -3,6 +3,7 @@ import gc
from
collections
import
OrderedDict
,
defaultdict
import
fnmatch
import
math
import
datetime
import
numpy
as
np
import
tensorflow
as
tf
...
...
@@ -836,7 +837,8 @@ class ReduceLROnPlateau(ScaleOnPlateau):
class
EarlyStopping
(
PatientTracker
):
def
__init__
(
self
,
restore_best_weights
=
False
,
verbose
=
0
,
do_stop
=
None
,
**
kwargs
):
def
__init__
(
self
,
runtime
=
None
,
restore_best_weights
=
False
,
verbose
=
0
,
do_stop
=
None
,
**
kwargs
):
stop_time
=
datetime
.
datetime
.
now
()
+
datetime
.
timedelta
(
**
runtime
)
if
runtime
else
None
pin
(
locals
(),
kwargs
)
super
(
EarlyStopping
,
self
).
__init__
(
**
kwargs
)
...
...
@@ -854,7 +856,9 @@ class EarlyStopping(PatientTracker):
if
self
.
restore_best_weights
:
self
.
best_weights
=
self
.
model
.
get_weights
()
self
.
best_epoch
=
epoch
elif
action
==
"
good
"
:
elif
action
==
"
good
"
or
(
(
self
.
stop_time
is
not
None
)
and
(
datetime
.
datetime
.
now
()
>
self
.
stop_time
)
):
self
.
stopped_epoch
=
epoch
self
.
model
.
stop_training
=
True
if
self
.
restore_best_weights
and
self
.
best_weights
is
not
None
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment