DSClassifier_MOA {streamMOA} | R 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 |
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 |
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:
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. MOAmodelOptions can be passed on as a control parameter
# to the call RMOA::HoeffdingTree(). See ? RMOA::MOAoptions
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)
# look at the classifier RMOA object
cl$RMOAObj
# 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)