We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If argument feature_names in function eli5.show_weights() is pandas.core.indexes.base.Index raises an TypeError: Unexpected feature_names type.
feature_names
eli5.show_weights()
pandas.core.indexes.base.Index
TypeError: Unexpected feature_names type
import eli5 from eli5.sklearn import PermutationImportance from sklearn.ensemble import RandomForestRegressor from sklearn.model_selection import train_test_split from sklearn.datasets import load_boston data = load_boston() X, y, feats = data['data'], data['target'], data['feature_names'] X = pd.DataFrame(X, columns=feats) # Split in train-test X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=0) # Fit model reg = RandomForestRegressor() reg.fit(X_train, y_train) # Run permutation importance perm = PermutationImportance(reg, random_state=1).fit(X_test, y_test) # Show weights with pandas.Index eli5.show_weights(perm, top=None, feature_names=X_test.columns) >>> TypeError: Unexpected feature_names type
Reading the functionality of the FeatureNames class, noticed that some functionalities that feature_names param should satisfy are
cols = X_test.columns # size len(cols) # indexing t[5] # iterable enumerate(cols)
so my question if it is possible to add support for pandas.core.indexes.base.Index as argument in show_weights function.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
If argument
feature_names
in functioneli5.show_weights()
ispandas.core.indexes.base.Index
raises anTypeError: Unexpected feature_names type
.To reproduce
Discussion
Reading the functionality of the FeatureNames class, noticed that some functionalities that
feature_names
param should satisfy areso my question if it is possible to add support for
pandas.core.indexes.base.Index
as argument in show_weights function.The text was updated successfully, but these errors were encountered: