giuseppec / giuseppec/iml

Accumulated local effects, second order removal of first order effects

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

Description

Hi,

When removing first order effects from the uncentered second order ALE, the paper published by Zhu & Apley subtracts the first order effects of each dependent variable from the uncentered second order ALE. In the script FeatureEffect-ale.R, lines 161-165, why is the average between cells vertically (or horizontally) calculated? Why not just take the weighted sum of the cell differences and average by the total number of data points in the interval?

```r
# Then take the prediction at the mid point of each interval, which is the mean of the prediction at the end points
# and take calculate the mean, weighted by the number of data instances per cell
ale2 <- ale2[, list(.ale2 = sum(.count[2:nrow(.SD)] * (.yhat.diff[1:(nrow(.SD) - 1)] +
.yhat.diff[2:(nrow(.SD))]) / 2) / sum(.count[2:nrow(.SD)])), by = c(".class", ".interval2")]
ale2 <- ale2[, list(.ale2 = c(0, cumsum_na(.ale2)), .interval2 = c(0, .interval2)), by = ".class"]
```

Something similar is done for the first order effect. Why is the average between intervals used when calculating the average first order effect?

Thanks, hope you can help.

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.