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

Improve docstring and code documentation #355

Closed
wants to merge 35 commits into from

Conversation

JulienT01
Copy link
Collaborator

@JulienT01 JulienT01 commented Jul 24, 2023

#342

Description

  • Improve docstring and code documentation
  • Improve evaluation docstring readability #325

Checklist

  • I have made corresponding changes to the documentation,
  • New and existing unit tests pass locally with my changes,
  • If updated the changelog if necessary,
  • I have set the label "ready for review" and the checks are all green.

@JulienT01 JulienT01 added documentation Improvements or additions to documentation Marathon To do during Marathon labels Jul 24, 2023
rlberry/agents/agent.py Outdated Show resolved Hide resolved
@@ -209,6 +204,7 @@ def fit(self, budget: int, **kwargs):
@abstractmethod
def eval(self, **kwargs):
"""
Abstract method to be overwriten by the 'inherited agent' developer.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Abstract method for what ?

rlberry/agents/agent.py Outdated Show resolved Hide resolved
@@ -485,32 +490,74 @@ class AgentWithSimplePolicy(Agent):

@abstractmethod
def policy(self, observation):
"""Returns an action, given an observation."""
"""
Abstract method to be overwriten by the 'inherited agent' developer.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I can smell ChatGPT, can this be simplified (I think there is a lot of repetition)?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Indeed, some parts were generated automatically, should be cleaner now

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If you talk about the "Abstract method to be overwriten by the 'inherited agent' developer." it's not ChatGPT, but me.
It's because the decorator because the decorator didn't appear in the documentation. (and the function do nothing)

If you talk about the rest of the text I don't know.

rlberry/agents/agent.py Outdated Show resolved Hide resolved
@@ -584,11 +636,8 @@ class AgentTorch(Agent):
"""

def save(self, filename):
# Overwrite the 'save' method to manage CPU and GPU with torch agent
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why this is not in the docstring?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I move it outside the docstring, because it's not really useful for the user, only for the developer. But I can put it in back if we think that was better before.

@TimotheeMathieu
Copy link
Collaborator

In this PR, you could also search & replace all the :class:gym.Env in the docstring which should be gymnasium env now I guess. See for instance here in agent.py.

@JulienT01
Copy link
Collaborator Author

In this PR, you could also search & replace all the :class:gym.Env in the docstring which should be gymnasium env now I guess. See for instance here in agent.py.

c'est fait, bien vu!

Copy link

Hello,
The build of the doc succeeded. The documentation preview is available here:
https://rlberry-py.github.io/rlberry/preview_pr

Copy link

Hello,
The build of the doc succeeded. The documentation preview is available here:
https://rlberry-py.github.io/rlberry/preview_pr

Copy link

Hello,
The build of the doc succeeded. The documentation preview is available here:
https://rlberry-py.github.io/rlberry/preview_pr

@JulienT01
Copy link
Collaborator Author

updated here :
#426

@JulienT01 JulienT01 closed this Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation Marathon To do during Marathon ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants