[Python] Is there any alternative to Eli5?

Discussão em 'Python' iniciado por Stack, Abril 28, 2025.

  1. Stack

    Stack Membro Participativo

    I was trying to calculate the Permutation Importance by using Eli5, however the command eli5.show_weights does not fetch any image or anything. (I tried in Python 2.7 and 3.7.)

    Code snippet:

    feature_names = [c for c in train_df.columns if train_df[c].dtype in [np.int64]]

    X = train_df[feature_names]
    X = X.drop('state', axis=1)
    y = train_df['state']

    X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=1)

    my_model = RandomForestClassifier(n_estimators=100, random_state=1).fit(X_train, y_train)
    perm = PermutationImportance(my_model, random_state=1).fit(X_test, y_test)

    eli5.show_weights(perm, show_feature_values = X_test.columns.tolist())


    The last line prints nothing.

    Continue reading...

Compartilhe esta Página