Skip to content

Runs into issues when a feature column already named "tree" #31

Description

@areeves87

Building the explainer relies on creating several new columns with names such as "tree" and "leaf". If those column names are already used in the training dataset, one can run into issues, specifically #23. In my case, I ran into this issue when using the explainer on a Natural Language Processing xgb model. My model was counting the instances of the word "tree" in the document within a column also named "tree".

The error is triggered when trying to row bind the tree_list_breakdown and tree_breakdown lists within the call to buildExplainerFromTreeList. A warning when the dataset already uses column names that include key terms such as "tree", "leaf", and "intercept" would be helpful. Perhaps written into the first few lines of the function.

Similarly, the explainPredictions function uses variable names that can cause issues. In my case, I had a column named "x" in my dataset that caused problems with the "x" used as the iterator in the for loop for going through all the trees.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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