Problems with single-predictor models
- 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
Assessment
This issue has not been assessed yet.