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

Assigning n_jobs #33

Open
fabiogeraci opened this issue Jun 21, 2022 · 1 comment
Open

Assigning n_jobs #33

fabiogeraci opened this issue Jun 21, 2022 · 1 comment

Comments

@fabiogeraci
Copy link

Hi,

below it is the definition of the selector class, n_jobs is by default set to 2, and two screen shot before and after running the code. It appears that n_jobs is running on all available cpus

class Selector:
    def __init__(self, estimator=None, n_jobs: int = 2):
        self.estimator = estimator
        self.n_jobs = n_jobs
        self.selector_model = None
        self.select_estimator()

    def select_estimator(self):

        self.selector_model = GeneticSelectionCV(
            self.estimator, cv=5, verbose=0,
            scoring="f1_weighted", max_features=25,
            n_population=50, crossover_proba=0.5,
            mutation_proba=0.2, n_generations=50,
            crossover_independent_proba=0.5,
            mutation_independent_proba=0.04,
            tournament_size=3, n_gen_no_change=10,
            caching=True, n_jobs=self.n_jobs)

image
image

@manuel-calzolari
Copy link
Owner

Hi Fabio,

using the example in the documentation https://sklearn-genetic.readthedocs.io/en/latest/examples.html (changing the value of the n_jobs parameter) I am not able to reproduce this issue.

Which estimator do you use? If you configure the n_jobs parameter of the estimator (e.g. of a Random Forest) to use multiple jobs, then additional CPUs can be used by the estimator itself. Basically, the total parallelism would be given by the n_jobs of the genetic selector multiplied by the n_jobs of the estimator.

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