PyImpetus icon indicating copy to clipboard operation
PyImpetus copied to clipboard

Custom cross validator

Open jmrichardson opened this issue 2 years ago • 1 comments

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))

jmrichardson avatar Apr 04 '23 20:04 jmrichardson