CombinePreds: Combine predictions from multiple models: for example combine...

Description Usage Arguments Value Examples

Description

Combine predictions from multiple models: for example combine GreenSTEP zero dvmt glm model and dvmt lm model As an example (a clumsy way to square mpg):

Usage

1
CombinePreds(preds_ls, func = `*`, init = 1, ...)

Arguments

preds_ls

A list of prediction vectors for each modeling steps

func

function used to combine results from modeling steps

init

initial value, pass to the '.init' of 'reduce()'

...

additional argument passed to 'reduce'

Value

a list with the combined predictions

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
 library(dplyr)
 library(purrr)
 library(tidyr)
 mtcars %>%
   nest(-cyl) %>%
   crossing(tibble(x=c(1, 2))) %>%
   mutate(mpg=map(data, "mpg")) %>%
   group_by(cyl) %>%
   summarise(mpg1 = list(mpg[[1]]),
             mpg2 = CombinePreds(mpg)) %>%
   mutate(test=map2_lgl(mpg1, mpg2, ~all(.y==.x^2)))

cities-lab/VETravelDemandMM documentation built on Aug. 1, 2019, 4:43 p.m.