Different clustering for different methods
using GeometricClusterAnalysis
using LinearAlgebra
using Plots
using Random
nb_clusters = 14
k = 10
c = 50
iter_max = 100
nstart = 1
nb_means_removed = 10
n = 490
nsignal = n
nnoise = 200
ntimes = 100
dim = 2
sigma = 0.02 .* Matrix(I, dim, dim)
dataset = noisy_fourteen_segments(n, nnoise, sigma, dim)
Data{Float64}(690, 2, [-0.19543588066823978 -0.6515317738456587 … -1.7633062472286607 -0.12821822988155063; -0.09523294935317533 -0.28736300652432134 … 1.526674439091753 1.217512037776566], [4, 4, 13, 2, 12, 13, 6, 8, 1, 3 … 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
True colors
plot(dataset, aspect_ratio=true, palette = :default, framestyle = :none)
points = dataset.points
2×690 Matrix{Float64}:
-0.195436 -0.651532 0.843582 … 1.50484 -1.76331 -0.128218
-0.0952329 -0.287363 -0.291214 0.130086 1.52667 1.21751
k-PLM
col_kplm = clustering_kplm( dataset.points, nb_clusters, k, c, nsignal, iter_max, nstart; nb_means_removed = 0)
l = @layout [a b]
p1 = pointset(dataset.points, dataset.colors)
p2 = pointset(dataset.points, col_kplm)
plot(p1, p2, layout = l, legend = false)
mutualinfo(dataset.colors, col_kplm)
0.5479086876058133
k-PDTM
col_kpdtm = clustering_kpdtm(dataset.points, nb_clusters, k, c, nsignal, iter_max, nstart)
l = @layout [a b]
p1 = plot(dataset, aspect_ratio = true, framestyle = :none, markersize = 2)
p2 = pointset(dataset.points, col_kpdtm, legend = false)
plot(p1, p2, layout = l)
mutualinfo(dataset.colors, col_kpdtm)
0.5479086876058133
q-witnessed distance
witnessed_colors = clustering_witnessed(dataset.points, nb_clusters, k, c,
nsignal, iter_max, nstart)
l = @layout [a b]
p1 = plot(dataset, aspect_ratio = true, framestyle = :none, markersize = 2)
p2 = pointset(points, witnessed_colors, legend = :outertopright)
plot(p1, p2, layout = l)
mutualinfo(dataset.colors, witnessed_colors)
0.6078182148052865
Power function
buchet_colors = clustering_power_function(dataset.points, nb_clusters, k, c,
nsignal, iter_max, nstart)
l = @layout [a b]
p1 = plot(dataset, aspect_ratio = true, framestyle = :none, markersize = 2)
p2 = pointset(points, buchet_colors)
plot(p1, p2, layout = l, legend = :none)
mutualinfo(dataset.colors, buchet_colors)
0.6468848084487008
DTM filtration
dtm_colors = clustering_dtm_filtration(points, nb_clusters, k, c, nsignal, iter_max, nstart)
l = @layout [a b]
p1 = plot(dataset, aspect_ratio = true, framestyle = :none, markersize = 2)
p2 = pointset(points, dtm_colors)
plot(p1, p2, layout = l, legend = :none)
mutualinfo(dataset.colors, dtm_colors)
0.6338436314552373
ToMaTo
radius = 0.12
tomato_colors = clustering_tomato(points, nb_clusters, k, c, nsignal, radius, iter_max, nstart)
println(mutualinfo(dataset.colors, tomato_colors))
l = @layout [a b]
p1 = plot(dataset, aspect_ratio = true, framestyle = :none, markersize = 2)
p2 = pointset(points, tomato_colors)
plot(p1, p2, layout = l, legend = :none)