You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hi @xnmp ! Can you please give the original traceback you get? I tried to reproduce the issue, but didn't get an error - probably you are doing something differently:
import pandas as pd
from sklearn.ensemble import GradientBoostingClassifier
from sklearn.datasets import load_iris
data = load_iris()
data.keys()
X = pd.DataFrame(data['data'], columns=data['feature_names'])
gbm = GradientBoostingClassifier()
gbm.fit(X, data['target'])
eli5.show_weights(gbm)
eli5.show_prediction(gbm, X.iloc[1])
I had the same problem and above did not solve it for me. What worked for me was using X.iloc[[1]] instead of X.iloc[1]. The latter form automatically converts a row to a series, which converts the datatypes in the row to "object" type if they differ.
So I have a model called
gbm
.gbm.predict_proba(X)
works, andexplain_weights(gbm)
works. But when I try to writeI get
ValueError: DataFrame.dtypes for data must be int, float or bool. Did not expect that data types in fields (every field)
.If I instead write
I get an answer, but all the features are label
x1
,x2
,x3
, etc.Any idea what's going on?
The text was updated successfully, but these errors were encountered: