predict.fastglm_stream: Stream predictions or diagnostics to a callback

View source: R/stream-methods.R

predict.fastglm_streamR Documentation

Stream predictions or diagnostics to a callback

Description

Prediction for a large dataset can create a vector too large to retain in memory. A sink is a user-supplied function that receives one block of results at a time, for example to write predictions to a file or accumulate a summary. Without a sink, the result blocks are collected into a single R object, whose memory requirement grows with the number of observations.

Usage

## S3 method for class 'fastglm_stream'
predict(
  object,
  newdata = NULL,
  type = c("link", "response"),
  se.fit = FALSE,
  dispersion = NULL,
  sink = NULL,
  ...
)

Arguments

object

a streaming GLM fit.

newdata

optional prediction data; otherwise rereads the fitted source.

type, dispersion, se.fit

prediction arguments as in [predict.fastglm()].

sink

optional function of '(value, chunk_index)' that processes or writes each result block. Its return value is ignored.

...

additional prediction arguments.

Value

Predictions (a 'fastglm_prediction' list when 'se.fit=TRUE'), or invisibly the number of chunks delivered to a sink. Each prediction block supplied to a sink uses the same structure. See fastglm-prediction-methods.


fastglm documentation built on Nov. 11, 2026, 5:07 p.m.