Skip to content

Using lime() on xgboost object #1

@martinju

Description

@martinju

Hi, and thank you for an excellent package!

I am trying to apply the lime package to a model fitted with xgboost (using the original xgboost package), but the lime function does not seem to accept the input format even if the predict function works fine.

Example using both xgbDmatrix and a regular matrix

x = matrix(rnorm(100*10),ncol=10)
y = rnorm(100)

xgbDMatrix.obj<- xgb.DMatrix(data=x,
label = y)

mod = xgb.train(data = xgbDMatrix.obj,nrounds = 100) # Variant 1, using xgbDMatrix format of data input
#predict(mod,x,type="prob") # works fine
explain <- lime(x=x,model=mod) # Throws error

mod = xgboost(data = x,label = y,nrounds = 100) # Variant 2 using a regular matrix + vector as data input
#predict(mod,x,type="prob") # works fine
explain <- lime(x=x,model=mod) # Throws error

In the readme you mention manually building a predict function.
If that is the solution here, could you please provide some guidelines on how to do that?

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