pycaret / pycaret

An open-source, low-code machine learning library in Python
https://www.pycaret.org
MIT License
8.84k stars 1.76k forks source link

compare_models fold parameter not used when calling create_model #736

Closed driesbuyck closed 3 years ago

driesbuyck commented 3 years ago

When you call compare_models with the fold parameter, it's not used when you eventually call create_model

best_model = compare_models(fold=n_folds,include=['lr','nb','knn','rf'])

~\AppData\Local\conda\conda\envs\pycaret\lib\site-packages\sklearn\model_selection\_split.py in _make_test_folds(self, X, y)
    666             raise ValueError("n_splits=%d cannot be greater than the"
    667                              " number of members in each class."
--> 668                              % (self.n_splits))
    669         if self.n_splits > min_groups:
    670             warnings.warn(("The least populated class in y has only %d"

ValueError: n_splits=10 cannot be greater than the number of members in each class.

I could fix it by adding fold=fold: classification.py m = create_model(estimator=k, verbose = False, system=False, cross_validation=True, fold=fold)

Yard1 commented 3 years ago

Already fixed for future release.

pycaret commented 3 years ago

@driesbuyck

This issue has been fixed in the pycaret-nightly release. Please install pycaret-nightly using pip install pycaret-nightly. Feel free to open a new issue, in case the problem persists.