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

Preprocessor refactoring #220

Open
younik opened this issue Nov 17, 2024 · 1 comment
Open

Preprocessor refactoring #220

younik opened this issue Nov 17, 2024 · 1 comment

Comments

@younik
Copy link
Collaborator

younik commented Nov 17, 2024

I believe preprocessors should not be part of the Env class, and they should kept separate.

  1. These lines in env examples don't scale well:

    if preprocessor_name == "Identity":
    preprocessor = IdentityPreprocessor(output_dim=ndim)
    elif preprocessor_name == "KHot":
    preprocessor = KHotPreprocessor(height=height, ndim=ndim)
    elif preprocessor_name == "OneHot":
    preprocessor = OneHotPreprocessor(
    n_states=self.n_states,
    get_states_indices=self.get_states_indices,
    )
    elif preprocessor_name == "Enum":
    preprocessor = EnumPreprocessor(
    get_states_indices=self.get_states_indices,
    )
    else:
    raise ValueError(f"Unknown preprocessor {preprocessor_name}")

  2. It seems they are not used inside the env class, but they are just passed to GFNModule, which is a better location.

env = Box()
module = BoxPFMLP(
hidden_dim=32, n_hidden_layers=2, n_components=1, n_components_s0=1
)
estimator = DiscretePolicyEstimator(
module, n_actions=2, preprocessor=env.preprocessor
)

I believe they should be instantiated by the user and eventually passed to GFNModule.

@josephdviviano
Copy link
Collaborator

josephdviviano commented Nov 17, 2024 via email

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

No branches or pull requests

2 participants