DSClassifier_MOA: DSClassifier_MOA - MOA-based Stream Classifiers

View source: R/DSClassifier_MOA.R

DSClassifier_MOAR Documentation

DSClassifier_MOA – MOA-based Stream Classifiers

Description

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

Usage

DSClassifier_MOA(formula, RMOA_classifier)

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

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

Arguments

formula

a formula for the classification problem.

RMOA_classifier

a RMOA_classifier 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

DSClassifier_MOA provides an interface to MOA-based stream classifiers using package RMOA. RMOA provides access to MOAs stream classifiers in the following groups:

  • RMOA::MOA_classification_trees

  • RMOA::MOA_classification_bayes

  • RMOA::MOA_classification_ensemblelearning

Subsequent calls to update() update the current model.

Value

An object of class DSClassifier_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 the stream classifier
cl <- DSClassifier_MOA(
  Species ~ Sepal.Length + Sepal.Width + Petal.Length,
  RMOA::HoeffdingTree()
  )

cl

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

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

table(pr, newdata$Species)

## End(Not run)

streamMOA documentation built on Sept. 4, 2022, 1:05 a.m.