Skip to content
This repository was archived by the owner on Feb 28, 2024. It is now read-only.
This repository was archived by the owner on Feb 28, 2024. It is now read-only.

plot_evaluations() incompatible with BayesSearchCV #1056

@Abdelgha-4

Description

@Abdelgha-4

I ran multiple models with BayesSearchCV, and try to plot the optimization results, plot_histogram and plot_objective both work perfectly fine, however plot_evaluations is throwing this error every time:

AttributeError: 'Real' object has no attribute 'categories'

And shows the first few figures where there are categorical variables, and empty axes elsewhere.

The complete traceback:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-63-f0c2a2bf3c15> in <module>
      5     clf_params = list(filter(is_clf_param, model_res.best_params_.keys()))
      6     n_params = len(clf_params)
----> 7     plot_evaluations(model_res.optimizer_results_[0])
      8     fig, axs = plt.subplots(1, n_params, figsize=(5*n_params,4))
      9     for i,ax in enumerate(axs):

/opt/conda/lib/python3.7/site-packages/skopt/plots.py in plot_evaluations(result, bins, dimensions, plot_dims)
    829                 index, dim = plot_dims[i]
    830                 if iscat[j]:
--> 831                     bins_ = len(dim.categories)
    832                 elif dim.prior == 'log-uniform':
    833                     low, high = space.bounds[index]

AttributeError: 'Real' object has no attribute 'categories'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions