Skip to content

treeshap.model_unified fails with data.table input #36

@Balaika

Description

@Balaika

In treeshap.model_unified function, this line does not behave as expected if x is a data.table :

x <- x[,colnames(x) %in% unified_model$feature_names]

x=data.table(a=1:3,b=2:4)
x[,colnames(x)%in%colnames(x)]
[1] TRUE TRUE
x%>%as.data.frame%>%.[,colnames(x)%in%colnames(x)]
  a b
1 1 2
2 2 3
3 3 4

I suggest to convert x to a data.frame when x is a data.table

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