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

option to not reset eval metric with Speedometer#5827

Merged
piiswrong merged 11 commits intoapache:masterfrom
geoalgo:resetMetric
Apr 24, 2017
Merged

option to not reset eval metric with Speedometer#5827
piiswrong merged 11 commits intoapache:masterfrom
geoalgo:resetMetric

Conversation

@geoalgo
Copy link
Copy Markdown
Contributor

@geoalgo geoalgo commented Apr 13, 2017

Speedometer reset metrics which invalidates callbacks coming after them.

For instance

mod.fit(
train_data=train_iter,
eval_data=test_iter,
eval_metric=[mx.metric.CrossEntropy(), 'acc'],
batch_end_callback=[mx.callback.Speedometer(batch_size, 1), mx.callback.log_train_metric(1)]
)

gives the following log

INFO:root:Epoch[0] Batch [1] Speed: 311.33 samples/sec Train-cross-entropy=5.322994
INFO:root:Epoch[0] Batch [1] Speed: 311.33 samples/sec Train-accuracy=0.015625
INFO:root:Iter[0] Batch[1] Train-cross-entropy=nan
INFO:root:Iter[0] Batch[1] Train-accuracy=nan

I have set the default reset option of Speedometer to False to have the same default behavior as the other callback log_train_metric (also because it is unexpected for the user to have a default that has a side effect on the metric).

@geoalgo geoalgo mentioned this pull request Apr 14, 2017
@geoalgo
Copy link
Copy Markdown
Contributor Author

geoalgo commented Apr 18, 2017

Could someone have a look to this pull request? It is addressing issue #5767

@piiswrong
Copy link
Copy Markdown
Contributor

The problem with this is printed training acc will lag behind current acc because it's averaging over the low accs in the beginning of the epoch. You also will see jumps in acc in the beginning of every epoch, which can be confusing

@geoalgo
Copy link
Copy Markdown
Contributor Author

geoalgo commented Apr 21, 2017

True but dont you think printing NAN is more confusing? Maybe we could let this option but set it to false by default?

@piiswrong
Copy link
Copy Markdown
Contributor

we can try to figure out a better way later. For now could you change default to auto_reset=True so that default behavior is not changed.

@piiswrong
Copy link
Copy Markdown
Contributor

one way is to remove the reset from speedometer and put it in module.fit

@geoalgo
Copy link
Copy Markdown
Contributor Author

geoalgo commented Apr 24, 2017

I have set auto_reset=True as you suggested.

@piiswrong piiswrong merged commit 37f4c8c into apache:master Apr 24, 2017
Guneet-Dhillon pushed a commit to Guneet-Dhillon/mxnet that referenced this pull request Sep 13, 2017
* option to not reset eval metric with Speedometer

* update contributors

* cancel change to mshadow

* reset metric by default
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants