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

[BUG]: plot_model(et, plot='tree') not displaying Tree #3931

Open
3 tasks done
aledeper opened this issue Feb 29, 2024 · 2 comments
Open
3 tasks done

[BUG]: plot_model(et, plot='tree') not displaying Tree #3931

aledeper opened this issue Feb 29, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@aledeper
Copy link

aledeper commented Feb 29, 2024

pycaret version checks

Issue Description

I can't plot the decision tree for a model based on trees like Extra Trees with the latest version of PyCaret

Reproducible Example

et = create_model('et')
plot_model(et, plot='tree')

Expected Behavior

The tree is shown.

Actual Results

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_25768\3791440483.py in <module>
----> 1 plot_model(et, plot='tree')

~\AppData\Roaming\Python\Python39\site-packages\pycaret\utils\generic.py in wrapper(*args, **kwargs)
    962                 if globals_d[name] is None:
    963                     raise ValueError(message)
--> 964             return func(*args, **kwargs)
    965 
    966         return wrapper

~\AppData\Roaming\Python\Python39\site-packages\pycaret\classification\functional.py in plot_model(estimator, plot, scale, save, fold, fit_kwargs, plot_kwargs, groups, verbose, display_format)
   1723     """
   1724 
-> 1725     return _CURRENT_EXPERIMENT.plot_model(
   1726         estimator=estimator,
   1727         plot=plot,

~\AppData\Roaming\Python\Python39\site-packages\pycaret\classification\oop.py in plot_model(self, estimator, plot, scale, save, fold, fit_kwargs, plot_kwargs, groups, verbose, display_format)
   2069         """
   2070 
-> 2071         return super().plot_model(
   2072             estimator=estimator,
   2073             plot=plot,

~\AppData\Roaming\Python\Python39\site-packages\pycaret\internal\pycaret_experiment\tabular_experiment.py in plot_model(self, estimator, plot, scale, save, fold, fit_kwargs, plot_kwargs, groups, feature_name, label, verbose, display_format)
   2043 
   2044         """
-> 2045         return self._plot_model(
   2046             estimator=estimator,
   2047             plot=plot,

~\AppData\Roaming\Python\Python39\site-packages\pycaret\internal\pycaret_experiment\tabular_experiment.py in _plot_model(self, estimator, plot, scale, save, fold, fit_kwargs, plot_kwargs, groups, feature_name, label, verbose, system, display, display_format)
   1911                 # execute the plot method
   1912                 with redirect_output(self.logger):
-> 1913                     ret = locals()[plot]()
   1914                 if ret:
   1915                     plot_filename = ret

~\AppData\Roaming\Python\Python39\site-packages\pycaret\internal\pycaret_experiment\tabular_experiment.py in tree()
   1522                             trees = [fitted_estimator]
   1523                     if self._ml_usecase == MLUsecase.CLASSIFICATION:
-> 1524                         class_names = list(class_names.values())
   1525                     for i, tree in enumerate(trees):
   1526                         self.logger.info(f"Plotting tree {i}")

AttributeError: 'NoneType' object has no attribute 'values'

Installed Versions

Pycaret 3.3.0 matplotlib 3.6.0 numpy 1.23.0
@aledeper aledeper added the bug Something isn't working label Feb 29, 2024
@celestinoxp
Copy link
Contributor

@aledeper what version of sktime? try with 0.26.0 and give me feedback, please

@aledeper
Copy link
Author

aledeper commented Mar 4, 2024

@celestinoxp 0.027.0, I have tried with version 0.26.0 and I get the same error

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