Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
leezu committed Nov 14, 2019
1 parent 2bcdedc commit 8354b1b
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions python/mxnet/gluon/contrib/estimator/event_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
# pylint: disable=wildcard-import, unused-argument, too-many-ancestors
"""Gluon EventHandlers for Estimators"""

import logging
import os
import sys
import time
import warnings

Expand Down Expand Up @@ -412,12 +410,14 @@ def __init__(self,
if 'acc' or 'f1' in self.monitor.get()[0].lower():
warnings.warn("`greater` operator will be used to determine if %s has improved. "
"Please specify `mode='min'` to use the `less` operator. "
"Specify `mode='max' to disable this warning.`", self.monitor.get()[0])
"Specify `mode='max' to disable this warning.`"
.format(self.monitor.get()[0]))
self.monitor_op = np.greater
else:
warnings.warn("`less` operator will be used to determine if %s has improved. "
"Please specify `mode='max'` to use the `greater` operator. "
"Specify `mode='min' to disable this warning.`", self.monitor.get()[0])
"Specify `mode='min' to disable this warning.`"
.format(self.monitor.get()[0]))
self.monitor_op = np.less

def train_begin(self, estimator, *args, **kwargs):
Expand Down Expand Up @@ -658,12 +658,14 @@ def __init__(self,
if 'acc' or 'f1' in self.monitor.get()[0].lower():
warnings.warn("`greater` operator will be used to determine if %s has improved. "
"Please specify `mode='min'` to use the `less` operator. "
"Specify `mode='max' to disable this warning.`", self.monitor.get()[0])
"Specify `mode='max' to disable this warning.`"
.format(self.monitor.get()[0]))
self.monitor_op = np.greater
else:
warnings.warn("`less` operator will be used to determine if %s has improved. "
"Please specify `mode='max'` to use the `greater` operator. "
"Specify `mode='min' to disable this warning.`", self.monitor.get()[0])
"Specify `mode='min' to disable this warning.`"
.format(self.monitor.get()[0]))
self.monitor_op = np.less

if self.monitor_op == np.greater: # pylint: disable=comparison-with-callable
Expand Down

0 comments on commit 8354b1b

Please sign in to comment.