stream <- DSD_Gaussians(k = 3, d = 2, noise = .05)
dbstream <- DSC_DBSTREAM(r = .1)
update(dbstream, stream, n = 100)
# find the assignment for the next 100 points to
# micro-clusters in dsc. This uses the model's assignment function
points <- get_points(stream, n = 100)
a <- predict(dbstream, points)
head(a)
# show the MC assignment areas. Assigned points as blue circles and
# the unassigned points as red dots
plot(dbstream, stream, assignment = TRUE, type = "none")
points(points[!is.na(a[, ".class"]),], col = "blue")
points(points[is.na(a[, ".class"]),], col = "red", pch = 20)
# use nearest neighbor assignment instead
a <- predict(dbstream, points, method = "nn")
head(a)
Run the code above in your browser using DataLab