How to fix this:
using Clustering
using VectorizedStatistics
function MyKmeans(Train::Vector{Float64}, k::Int64)
the_mat = Train'
model = kmeans(the_mat, k)
return vmean(silhouettes(assignments(model), counts(model), the_mat))
end
julia> MyKmeans(rand(440), 2)
ERROR: DimensionMismatch: The size of a distance matrix ((1, 440)) doesn't match the length of assignment vector
(440).
Stacktrace:
[1] silhouettes(assignments::Vector{Int64}, counts::Vector{Int64}, dists::Adjoint{Float64, Vector{Float64}})
@ Clustering C:\Users\Julia\.julia\packages\Clustering\eBCMN\src\silhouette.jl:55
[2] MyKmeans(Train::Vector{Float64}, k::Int64, kind::Silhouette)
@ Main e:\newapproach.jl:155
[3] top-level scope
@ REPL[33]:1