DSRegressor_MOA {streamMOA}R Documentation

DSRegressor_MOA – MOA-based Stream Regressors

Description

Interface for MOA-based stream regression methods based on package RMOA.

Usage

DSRegressor_MOA(formula, RMOA_regressor)

## S3 method for class 'DSRegressor_MOA'
update(object, dsd, n = 1, verbose = FALSE, block = 1000L, ...)

## S3 method for class 'DSRegressor_MOA'
predict(object, newdata, type = "response", ...)

Arguments

formula

a formula for the regression problem.

RMOA_regressor

a RMOA_regressors object.

object

a DSC object.

dsd

a data stream object.

n

number of data points taken from the stream.

verbose

logical; show progress?

block

process blocks of data to improve speed.

...

further arguments.

newdata

dataframe with the new data.

type

prediction type (see RMOA::predict.MOA_trainedmodel()).

Details

DSRegressor_MOA provides an interface to MOA-based stream regressors using package RMOA. Available regressors can be found at RMOA::MOA_regressors.

Subsequent calls to update() update the current model.

Value

An object of class DSRegressor_MOA

Author(s)

Michael Hahsler

References

Wijffels, J. (2014) Connect R with MOA to perform streaming classifications. https://github.com/jwijffels/RMOA

Bifet A, Holmes G, Pfahringer B, Kranen P, Kremer H, Jansen T, Seidl T (2010). MOA: Massive Online Analysis, a Framework for Stream Classification and Clustering. Journal of Machine Learning Research (JMLR).

Examples

## Not run: 
library(streamMOA)
library(RMOA)

# create a data stream for the iris dataset
data <- iris[sample(nrow(iris)), ]
stream <- DSD_Memory(data)
stream

# define a stream regression model.
cl <- DSRegressor_MOA(
  Sepal.Length ~ Species + Sepal.Width + Petal.Length,
  RMOA::Perceptron()
  )

cl

# update the model with 100 points from the stream
update(cl, stream, 100)

# look at the RMOA model object
cl$RMOAObj

# make predictions for the next 50 points
newdata <- get_points(stream, n = 50)
pr <- predict(cl, newdata)
pr

plot(pr, newdata$Sepal.Length, xlim = c(0,10), ylim = c(0,10))
abline(a = 0, b = 1, col = "red")

## End(Not run)

[Package streamMOA version 1.3-1 Index]