View source: R/DSClassifier_MOA.R
DSClassifier_MOA | R Documentation |
Interface for MOA-based stream classification methods based on package RMOA.
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", ...)
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 |
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.
An object of class DSClassifier_MOA
Michael Hahsler
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).
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.