Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

Graph not displayed in jupyter notebook (ml) and 'TreeEnsemble' object has no attribute 'values' , there is no such error in vscode

$
0
0

Graph not displayed in jupyter notebook and there is an issue:

'TreeEnsemble' object has no attribute 'values'

there is no such error in vs code

Code:

import shapimport pandas as pdfrom sklearn.model_selection import train_test_splitfrom catboost import CatBoostClassifierdata = pd.read_csv('D:/train_for_an.csv')X = data.drop('Survived', axis=1)y = data['Survived']X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)model = CatBoostClassifier(iterations=7, learning_rate=0.1, depth=3)model.fit(X_train, y_train)score = model.score(X_test, y_test)shap.initjs()explainer = shap.TreeExplainer(model, data = X)shap_values = explainer.shap_values(X_train)

enter image description here

I was expecting to see a graph, but in Visual Studio Code the error

'TreeEnsemble' object has no attribute 'values'

is not present


Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>