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

Custom cross validator #12

Open
jmrichardson opened this issue Apr 4, 2023 · 1 comment
Open

Custom cross validator #12

jmrichardson opened this issue Apr 4, 2023 · 1 comment

Comments

@jmrichardson
Copy link

jmrichardson commented Apr 4, 2023

Hi, I am trying to send a custom sklearn compatible CV splitter and it appears that the code in PyImpetus is just defaulting to KFold:

# for a value of 0, no CV is applied
        if self.cv!= 0:
 ...
            else:
                kfold = KFold(n_splits=self.cv, random_state=self.random_state, shuffle=True)
                if self.verbose > 0:
                    with tqdm_joblib(tqdm(desc="Progress bar", total=self.cv)) as progress_bar:
                        tmp = parallel(delayed(self._find_MB)(data.iloc[train].copy(), Y[train]) for train, test in kfold.split(data))
                else:
                    tmp = parallel(delayed(self._find_MB)(data.iloc[train].copy(), Y[train]) for train, test in kfold.split(data))

Instead, I was expecting PyImpetus should just use the cv splitter from cv argument:

# for a value of 0, no CV is applied
        if self.cv!= 0:
 ...
            else:
                if self.verbose > 0:
                    with tqdm_joblib(tqdm(desc="Progress bar", total=self.cv)) as progress_bar:
                        tmp = parallel(delayed(self._find_MB)(data.iloc[train].copy(), Y[train]) for train, test in self.cv.split(data))
                else:
                    tmp = parallel(delayed(self._find_MB)(data.iloc[train].copy(), Y[train]) for train, test in self.cv.split(data))

@atif-hassan
Copy link
Owner

Hi!

The code defaults to KFold if the custom CV is neither an sklearn KFold nor is it an sklearn StratifiedKFold.

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