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

Refactor Sweep class #15

Open
rm875 opened this issue May 26, 2023 · 0 comments
Open

Refactor Sweep class #15

rm875 opened this issue May 26, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request refactor Refactoring tasks

Comments

@rm875
Copy link
Contributor

rm875 commented May 26, 2023

Implement the following suggestion:

At a high level, I think the approach is good, but it's better to make things simpler instead of stuffing everything into one class/dict.

E.g. at the least I think instead of search_space this class should take the 4 kwargs of fixed=None, zipped=None, grid=None, and random=None. Or, preferable, have 4 classes that each takes different parameters. E.g. FixedSweep and then the users can specify a list of these sweep classes, each used for one or more different parameters to sweep. Because I don't think these different methods have to ever be combined, right!?

Then, it would be nice if we could specify the parameters in a call to a function to the class. E.g. you'd do something like this:

class GridSweep(BaseSweep):
    def __init__(self, num_combinations=None, ...):
        super().__init__(...)
        self.num_combinations = num_combinations
        self._search_space = {}

    def add(self, **kwargs)
        self._search_space.update(kwargs)

    def __call__(self):
        if not_computed_yet:
            compute_comb
        return combinations

So then, you can use it in a much nicer way instead of stuffing everything into one init call:

grid = GridSweep()
grid.add(a=[5, 7], b=[3, 9])
grid.add(c=[88, 12])
combinations = grid()

Originally posted by @matham in #1 (comment)

@rm875 rm875 added the refactor Refactoring tasks label Jun 8, 2023
@rm875 rm875 self-assigned this Dec 8, 2024
@rm875 rm875 added the enhancement New feature or request label Dec 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request refactor Refactoring tasks
Projects
None yet
Development

No branches or pull requests

2 participants