Skip to content

ch14.ipynb Cell #19 #8

Open
Open
@SSJUSA

Description

@SSJUSA

ch14.ipynb Cell #19

KeyError: 'weight'
2 fi_viz = FeatureImportances(xgr)
3 fi_viz.fit(bos_X_train, bos_y_train)
----> 4 fi_viz.poof()
5 #fig.savefig("images/mlpr_1406.png", dpi=300)

C:\ProgramData\Anaconda3\envs\tf_SSJ_gpu\lib\site-packages\yellowbrick\base.py in poof(self, *args, **kwargs)
259 "this method is deprecated, please use show() instead", DeprecationWarning
260 )
--> 261 return self.show(*args, **kwargs)
262
263 ## ////////////////////////////////////////////////////////////////////

C:\ProgramData\Anaconda3\envs\tf_SSJ_gpu\lib\site-packages\yellowbrick\base.py in show(self, outpath, clear_figure, **kwargs)
239
240 # Finalize the figure
--> 241 self.finalize()
242
243 if outpath is not None:

C:\ProgramData\Anaconda3\envs\tf_SSJ_gpu\lib\site-packages\yellowbrick\model_selection\importances.py in finalize(self, **kwargs)
283
284 # Set the xlabel
--> 285 self.ax.set_xlabel(self._get_xlabel())
286
287 # Remove the ygrid

C:\ProgramData\Anaconda3\envs\tf_SSJ_gpu\lib\site-packages\yellowbrick\model_selection\importances.py in get_xlabel(self)
332
333 # Label for coefficients
--> 334 if hasattr(self.estimator, "coef
"):
335 if self.relative:
336 return "relative coefficient magnitude"

C:\ProgramData\Anaconda3\envs\tf_SSJ_gpu\lib\site-packages\xgboost\sklearn.py in coef_(self)
714 .format(self.booster))
715 b = self.get_booster()
--> 716 coef = np.array(json.loads(b.get_dump(dump_format='json')[0])['weight'])
717 # Logic for multiclass classification
718 n_classes = getattr(self, 'n_classes_', None)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions