leezu commented on a change in pull request #16922: Update LoggingHandler to 
support logging per interval
URL: https://github.com/apache/incubator-mxnet/pull/16922#discussion_r354128099
 
 

 ##########
 File path: python/mxnet/gluon/contrib/estimator/event_handler.py
 ##########
 @@ -241,17 +241,16 @@ class LoggingHandler(TrainBegin, TrainEnd, EpochBegin, 
EpochEnd, BatchBegin, Bat
     """
 
     LOG_PER_EPOCH = 1
-    LOG_PER_BATCH = 2
-    LOG_PER_INTERVAL = 3
+    LOG_PER_INTERVAL = 2
 
     def __init__(self, verbose=LOG_PER_EPOCH,
                  train_metrics=None,
                  val_metrics=None,
                  log_interval=1):
 
 Review comment:
   My concern is that having constants
   ``` python 
   LOG_PER_EPOCH = 1
   LOG_PER_INTERVAL = 2
   ```
   is not very pythonic. For example users will need to specify
   
   ``` python 
   est = Estimator(Estimator.LOG_PER_INTERVAL, log_interval=20, train_metrics=X)
   ```
   
   users may easily by mistake specify
   
   ``` python 
   est = Estimator(log_interval=20, train_metrics=X)
   ```
   
   and wonder about why things don't work.
   
   Instead, it's much simpler to 
   
   ``` python 
   est = Estimator(log_interval='epoch', train_metrics=X)
   est = Estimator(log_interval=20, train_metrics=X)
   ```
   
   or
   
    ``` python 
   est = Estimator('epoch', train_metrics=X)
   est = Estimator(20, train_metrics=X)
   ```
   
   Having variable type arguments is fine in Python / in this case IMO.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to