Learn R Programming

disk.frame (version 0.7.1)

make_glm_streaming_fn: A streaming function for speedglm

Description

Define a function that can be used to feed data into speedglm and biglm

Usage

make_glm_streaming_fn(data, verbose = FALSE)

Arguments

data

a disk.frame

verbose

Whether to print the status of data loading. Default to FALSE

Value

return a function, fn, that can be used as the data argument in biglm::bigglm or speedglm::shglm

See Also

Other Machine Learning (ML): dfglm()

Examples

Run this code
# NOT RUN {
cars.df = as.disk.frame(cars)
streamacq = make_glm_streaming_fn(cars.df, verbose = FALSE)

majorv = as.integer(version$major)
minorv = as.integer(strsplit(version$minor, ".", fixed=TRUE)[[1]][1])
if(((majorv == 3) & (minorv >= 6)) | (majorv > 3)) {
  m = biglm::bigglm(dist ~ speed, data = streamacq)
  summary(m)
  predict(m, get_chunk(cars.df, 1))
  predict(m, collect(cars.df, 1))
} else {
  m = speedglm::shglm(dist ~ speed, data = streamacq)
}
# }

Run the code above in your browser using DataLab