Skip to content
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

Support for using random agents, improvements in CollectStats #1207

Merged
merged 13 commits into from
Aug 26, 2024

Conversation

MischaPanch
Copy link
Collaborator

@MischaPanch MischaPanch commented Aug 14, 2024

Random action agents can be useful for tests, but also as a baseline.

Also (independent change):

  • improved CollectStats for action_std
  • Batch: extension for changing shape to atleast_2d, including "casting" torch distributions to atleast_2d

One thing is a bit weird in this implementation: in high level interfaces the optim_factory is obligatory. For random actions it doesn't make sense, of course, but making it optional would require changes and additional type checks in several places. @opcode81 what do you think about this - should we make it optional?

@Trinkle23897 a quick glance should be enough, nothing controversial. @opcode81 is on vacation and won't have time to review

@codecov-commenter
Copy link

codecov-commenter commented Aug 14, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 92.17391% with 9 lines in your changes missing coverage. Please review.

Project coverage is 85.30%. Comparing base (002ffd9) to head (4e03191).

Files Patch % Lines
tianshou/utils/net/common.py 90.62% 3 Missing ⚠️
tianshou/data/batch.py 89.47% 2 Missing ⚠️
tianshou/policy/base.py 83.33% 2 Missing ⚠️
tianshou/highlevel/agent.py 75.00% 1 Missing ⚠️
tianshou/highlevel/experiment.py 80.00% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1207      +/-   ##
==========================================
+ Coverage   85.25%   85.30%   +0.05%     
==========================================
  Files         102      102              
  Lines        8982     9074      +92     
==========================================
+ Hits         7658     7741      +83     
- Misses       1324     1333       +9     
Flag Coverage Δ
unittests 85.30% <92.17%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@MischaPanch MischaPanch changed the title Support for using random agents in tianshou interfaces Support for using random agents, improvements in CollectStats Aug 24, 2024
@MischaPanch
Copy link
Collaborator Author

MischaPanch commented Aug 24, 2024

@maxhuettenrauch I improved the collect-stats for action dists in 6f8648a and b0ba423, also adding tests for stats collection. FYI

@MischaPanch
Copy link
Collaborator Author

Since it's mostly an extension (apart from a minor renaming of an existing class), I'm going to merge this. Feel free to comment post-merge if there's anything to be discussed

@MischaPanch MischaPanch merged commit 8eb2795 into master Aug 26, 2024
4 checks passed
@MischaPanch MischaPanch deleted the feature/random-agent branch August 26, 2024 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants