8000 [BUG]: compare_models with fit_kwargs bug - still not working · Issue #4094 · pycaret/pycaret · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[BUG]: compare_models with fit_kwargs bug - still not working #4094

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

Open
4 tasks done
tiefenthaler opened this issue Nov 12, 2024 · 1 comment
Open
4 tasks done

[BUG]: compare_models with fit_kwargs bug - still not working #4094

tiefenthaler opened this issue Nov 12, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@tiefenthaler
Copy link
tiefenthaler commented Nov 12, 2024

Issue Description

Installed Version:

import pycaret
pycaret.__version__
3.4.0

As already described here: [BUG]: compare_models with fit_kwargs bug] #2537 it is not possible to properly pass fit_kwards to compare_models. See more details in #2537

Reproducible Example

from pycaret.datasets import get_data
data = get_data('hepatitis')

from pycaret.classification import *
s = setup(data, target = 'Class', session_id = 123)

compare_models(fit_kwargs = {'sample_weight' : {0 : 1, 1 : 2}}, errors = 'raise')

Expected Behavior

It should work seamlessly.

Actual Results

TypeError: _fit_one() got an unexpected keyword argument 'class_weight'

During handling of the above exception, another exception occurred:

RuntimeError                              Traceback (most recent call last)
[/usr/local/lib/python3.10/dist-packages/pycaret/internal/pycaret_experiment/supervised_experiment.py](https://localhost:8080/#) in compare_models(self, include, exclude, fold, round, cross_validation, sort, n_select, budget_time, turbo, errors, fit_kwargs, groups, experiment_custom_tags, probability_threshold, verbose, parallel, caller_params)
    811             except Exception as ex:
    812                 if errors == "raise":
--> 813                     raise RuntimeError(
    814                         f"create_model() failed for model {model}. {type(ex).__name__}: {ex}"
    815                     )

RuntimeError: create_model() failed for model lr. TypeError: _fit_one() got an unexpected keyword argument 'class_weight'

Installed Versions

import pycaret
pycaret.__version__
3.4.0
@tiefenthaler tiefenthaler added the bug Something isn't working label Nov 12, 2024
@momartini
Copy link
momartini commented Jan 22, 2025

Having the same issue here. A temporary fix is to create the models manually:

from catboost import CatBoostClassifier
model = pc.create_model(CatBoostClassifier(class_weights=class_weight))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants
0