if (FALSE) {
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)
}
Run the code above in your browser using DataLab