mattharrison / ml_pocket_reference

Resources for Machine Learning Pocket Reference
244 stars 137 forks source link

ch10.ipynb Cell #6 #5

Closed SSJUSA closed 4 years ago

SSJUSA commented 4 years ago

ch10.ipynb Cell #6 ----> 1 from yellowbrick.features.importances import ( 2 FeatureImportances, 3 ) 4 fig, ax = plt.subplots(figsize=(6, 4)) 5 fi_viz = FeatureImportances(lr)

ModuleNotFoundError: No module named 'yellowbrick.features.importances'

mattharrison commented 4 years ago

This is now in the model_selection module of yellowbrick

SSJUSA commented 4 years ago

I have Shap 0.35.0 and Chapter 16 cell 4 is giving following error:

Thanks, SSJ

UnicodeDecodeError Traceback (most recent call last) in 1 import shap 2 shap.initjs()----> 3 exp = shap.TreeExplainer(xgr) 4 vals = exp.shap_values(bos_X) C:\ProgramData\Anaconda3\lib\site-packages\shap\explainers\tree.py in init(self, model, data, model_output, feature_perturbation, **deprecated_options) 119 self.feature_perturbation = feature_perturbation 120 self.expected_value = None--> 121 self.model = TreeEnsemble(model, self.data, self.data_missing, model_output) 122 self.model_output = model_output 123

self.model_output = self.model.model_output # this allows the

TreeEnsemble to translate model outputs types by how it loads the model C:\ProgramData\Anaconda3\lib\site-packages\shap\explainers\tree.py in init(self, model, data, data_missing, model_output) 755 self.original_model = model.get_booster() 756 self.model_type = "xgboost"--> 757 xgb_loader = XGBTreeModelLoader(self.original_model) 758 self.trees = xgb_loader.get_trees(data=data, data_missing=data_missing) 759 self.base_offset = xgb_loader.base_score C:\ProgramData\Anaconda3\lib\site-packages\shap\explainers\tree.py in init(self, xgb_model) 1324 self.read_arr('i', 29) # reserved 1325 self.name_obj_len = self.read('Q')-> 1326 self.name_obj = self.read_str(self.name_obj_len) 1327 self.name_gbm_len = self.read('Q') 1328 self.name_gbm = self.read_str(self.name_gbm_len) C:\ProgramData\Anaconda3\lib\site-packages\shap\explainers\tree.py in read_str(self, size) 1454 1455 def read_str(self, size):-> 1456 val = self.buf[self.pos:self.pos+size].decode('utf-8') 1457 self.pos += size 1458 return val UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 342: invalid start byte

On Mon, Aug 24, 2020 at 4:44 PM matt harrison notifications@github.com wrote:

Closed #5 https://github.com/mattharrison/ml_pocket_reference/issues/5.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mattharrison/ml_pocket_reference/issues/5#event-3687159851, or unsubscribe https://github.com/notifications/unsubscribe-auth/APPYKBIORSUGARE2WXX5D3TSCLGMLANCNFSM4M3QUNYA .