dsd <- DSD_Gaussians(k=3, d=2, noise=.05)
dsc <- DSC_tNN(r=.1, noise=.05)
cluster(dsc, dsd, n=100)
# find the assignment for the next 100 points to
# micro-clusters in dsc. This uses the model's assignemnt function
points <- get_points(dsd, n=100)
a <- get_assignment(dsc, points)
a
# show the assigned points as blue circles and the unassigned points
# as blue dots
plot(dsc, dsd)
points(points[!is.na(a),], col="blue")
points(points[is.na(a),], col="blue", pch=20)
# use nearest neighbor assignment instead
get_assignment(dsc, points, method="nn")
Run the code above in your browser using DataLab