set.seed(0)
stream <- DSD_Gaussians(k=3, noise=0.05)
# tNN with reachability (increase noise parameter to reduce the micro-clusters
# at the fringes of the Gaussians)
tnn <- DSC_tNN(r=.1, noise=0.1)
update(tnn, stream, 500)
tnn
# check micro-clusters
nclusters(tnn)
head(get_centers(tnn))
plot(tnn, stream)
# plot macro-clusters
plot(tnn, stream, type="both")
# plot micro-clusters with assignment area
plot(tnn, stream, type="micro", assignment=TRUE)
# tNN with shared density
tnn <- DSC_tNN(r=.1, noise=0.1, shared_density=TRUE)
update(tnn, stream, 500)
tnn
plot(tnn, stream, type="both")
# plot the shared density graph
plot(tnn, stream, type="micro", shared_density=TRUE)
plot(tnn, stream, type="micro", shared_density=TRUE, assignment=TRUE)
plot(tnn, stream, type="none", shared_density=TRUE, assignment=TRUE)
# see how micro and macro-clusters relate
# each microcluster has an entry with the macro-cluster id
# Note: unassigned micro-clusters (noise) have an NA
microToMacro(tnn)
# evaluate first using macro and then using micro-clusters
evaluate(tnn, stream, measure="purity")
evaluate(tnn, stream, measure="cRand", type="macro")
Run the code above in your browser using DataLab