Skip to content

Error create_shap_features (task: binary) #21

@whatsdog0001

Description

@whatsdog0001

task is binary but error on multiclass


TypeError Traceback (most recent call last)
in <cell line: 8>()
6 X_valid = X_valid.drop(columns=['race_id', 'rank'])
7
----> 8 selected_features_df, shap_features = shap_select(
9 model, X_valid, y_valid, task='binary', threshold=0.05, return_extended_data=True
10 )

in shap_select(tree_model, validation_df, target, feature_names, task, threshold, return_extended_data, alpha)
316 )
317 else:
--> 318 shap_features = create_shap_features(tree_model, validation_df[feature_names])
319
320 # Compute statistical significance of each feature, recursively ablating

in create_shap_features(tree_model, validation_df, classes)
37 elif len(shap_values.shape) == 3: # multiclass classification
38 out = {}
---> 39 for i, c in enumerate(classes):
40 out[i] = pd.DataFrame(
41 shap_values[:, :, i],

TypeError: 'NoneType' object is not iterable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions