giuseppec / giuseppec/iml

Problems with single-predictor models

Open
#81 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
R
Stars
503
Forks
87
PR merge metrics
No merged PRs in 30d

Description

I'm running some toy examples like the one below:

```
set.seed(17)
x <- runif(1000, -10, 10)
y <- 0.05*x^2
quadratic <- data.frame(x = x,
y = y)
true_model <- function(model, newdata) 0.05*(newdata$x)^2

library(iml)
mp = Predictor$new(list(), data = quadratic[, "x", drop = FALSE],
predict.fun = true_model)
shapley = Shapley$new(mp, x.interest = data.frame(x = -6))

lime_expl_iml <- LocalModel$new(mp, x.interest = data.frame(x = -6), k = 1)
```

and both calls (Shapley$new and LocalModel$new) results in an error when there is just a single predictor.
The errors are:
```
Assertion on 'prediction' failed: Must have exactly 1 rows, but has 0 rows.

Error in self$predictor$data$match_cols(data.frame(newdata)) :
Missing columns: V1
```

I'm aware that it's an unusual setting, but playing with such simple models is very instructive.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.