I decided to combine the models using ranger and glmnet.
From several models, only two had coefficients.
> collect_parameters(stack=fit_stack,
+ candidates="ranger_model")
# A tibble: 10 x 3
member min_n coef
<chr> <int> <dbl>
1 ranger_model_1_01 34 0
2 ranger_model_1_02 19 0
3 ranger_model_1_03 24 0
4 ranger_model_1_04 4 0.798
5 ranger_model_1_05 27 0
6 ranger_model_1_06 16 0
7 ranger_model_1_07 39 0
8 ranger_model_1_08 9 0
9 ranger_model_1_09 30 0
10 ranger_model_1_10 11 0
> collect_parameters(stack=fit_stack,
+ candidates="glmnet_model")
# A tibble: 1 x 2
member coef
<chr> <dbl>
1 glmnet_model_1_1 0.285
I used coefficient to see if it matched .pred, and it did not.
predict(fit_stack, test, members = TRUE) %>%
mutate(makepred =(glmnet_model_1_1*0.285) + (ranger_model_1_04*0.798))
# A tibble: 733 x 5
.pred glmnet_model_1_1 ranger_model_1_04 makepred `.pred - makepred`
<dbl> <dbl> <dbl> <dbl> <dbl>
1 5.13 5.03 5.18 5.57 -0.434
2 5.29 5.29 5.29 5.73 -0.434
3 5.29 5.29 5.28 5.72 -0.434
How do I calculate it to match?
Where do I check the coefficients of the bias term?