treeshap
treeshap copied to clipboard
treeshap.model_unified fails with data.table input
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