Skip to content

[change] Move console printing to StatsWriter class #3616

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 12, 2020

Conversation

ervteng
Copy link
Contributor

@ervteng ervteng commented Mar 12, 2020

Proposed change(s)

Console printing was still handled in the Trainer class. This PR makes a new class (ConsoleWriter) that writes to the console; the Trainer uses this class through the StatsReporter interface as with everything else.

TODO: Move ELO writing from the GhostTrainer into the ConsoleWriter as well.

Output is slightly different than before.

Before:

2020-03-11 17:26:58 INFO [trainer.py:213] test: 3DBall: Step: 14400. Time Elapsed: 20.636 s Mean Reward: 2.200. Std of Reward: 0.000. Training.
2020-03-11 17:26:58 INFO [trainer.py:213] test: 3DBall: Step: 14436. Time Elapsed: 20.645 s Mean Reward: 1.200. Std of Reward: 0.000. Training.

After:

2020-03-11 16:51:58 INFO [stats.py:90] test_3DBall: Step: 6996. Time Elapsed: 13.717 s Mean Reward: 1.400. Std of Reward: 0.000. Training.
2020-03-11 16:51:58 INFO [stats.py:90] test_3DBall: Step: 7020. Time Elapsed: 13.744 s Mean Reward: 1.400. Std of Reward: 0.000. Training.

Types of change(s)

  • Bug fix
  • New feature
  • Code refactor
  • Breaking change
  • Documentation update
  • Other (please describe)

Checklist

  • Added tests that prove my fix is effective or that my feature works
  • Updated the changelog (if applicable)
  • Updated the documentation (if applicable)
  • Updated the migration guide (if applicable)

Other comments

"Mean "
"Reward: {:0.3f}"
". Std of Reward: {:0.3f}. {}".format(
category,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so it looks like category is replacing run_id. is the run_id available somewhere in the logs? can you also explain the motivation behind replacing run_id by category?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

run_id isn't part of the StatsWriter abstraction (but can be added if there's enough demand). By default the trainer's category is the run_id + brain_name, so the same info is available to the user. Also, the category matches what's written to TensorBoard and the filename of the CSV, so it's consistent.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link

@anupam-142857 anupam-142857 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

"Mean "
"Reward: {:0.3f}"
". Std of Reward: {:0.3f}. {}".format(
category,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@ervteng ervteng merged commit 114a780 into master Mar 12, 2020
@delete-merged-branch delete-merged-branch bot deleted the develop-refactorprint branch March 12, 2020 22:01
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 15, 2021
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