library(stream)
# create a data stream for the iris dataset
data <- iris[sample(nrow(iris)), ]
stream <- DSD_Memory(data)
# define the stream Regressor.
cl <- DSRegressor_SlidingWindow(
Sepal.Length ~ Petal.Length + Petal.Length,
window = 50,
rebuild = 10
)
cl
# update the regressor 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
plot(pr, newdata$Sepal.Length)
abline(0, 1, col = "red")
# get the tree model
get_model(cl)
Run the code above in your browser using DataLab