christophM / interpretable-ml-book

Book about interpretable machine learning
https://christophm.github.io/interpretable-ml-book/
Other
4.77k stars 1.06k forks source link

Coffee drinking dataset used in section 4.3 on GLM #226

Closed amir1m closed 3 years ago

amir1m commented 3 years ago

Hello, Where can I find the Coffee drinking dataset used in section 4.3 on GLM?

Thanks, -Amir

christophM commented 3 years ago

Here: https://github.com/christophM/interpretable-ml-book/blob/master/manuscript/04.4-interpretable-lm-extensions.Rmd

n = 200
df = data.frame(stress  = runif(n = n, min = 1, max = 10), 
  sleep = runif(n = n, min = 1, max = 10), 
  work = sample(c("YES", "NO"), size = n, replace = TRUE))
lambda = exp(1* df$stress/10 - 2 * (df$sleep - 5)/10  - 1 * (df$work == "NO"))
df$y = rpois(lambda = lambda, n = n)