How to predict multiple statistical models generated in R in Power BI?
I trained several models in R, like these:
iris2 <- data.frame(zzz= sample(c(0, 1),size = length(iris$Sepal.Length), replace = TRUE), iris)
for (i in unique(iris$Species)) {
saveRDS(glm(zzz ~ Sepal.Length+Sepal.Width+Petal.Length+Petal.Width, data = iris2[iris2$Species == i,]),
file = paste0("model_", i))
}
Now I need to put these RDS In Power BI to perform predict()
in a script inside the PB, however the PB does not accept lists.
I had no success with the solution: https://towardsdatascience.com/how-to-predict-values-from-a-custom-r-model-in-power-bi-3364f83b0015
1
Author: Márcio Mocellin, 2019-09-24