JuliaStats / Clustering.jl

A Julia package for data clustering
Other
355 stars 118 forks source link

Add spectral clustering #19

Open andrioni opened 10 years ago

andrioni commented 10 years ago

Would it be in the scope of the package to add spectral clustering?

johnmyleswhite commented 10 years ago

I'd like to offer that functionality.

jpfairbanks commented 9 years ago

Spectral clustering is used to describe many variants, do you have any specific variants in mind?

I suppose the easiest to implement, given the existing infrastructure, is computing the top q eigenvectors of the kernel matrix with eigs and then calling one of the spatial methods like k-means on the output. Would it be ok to expose both parameters q,k?

Although for some data sets recursive partitioning with just the second eigenvector works better. We should support multiple types probably.

johnmyleswhite commented 9 years ago

All of those seem like reasonable options to me. I don't see the harm in exposing both q and k as parameters.

jpfairbanks commented 9 years ago

What do you think about the return type for spectral clustering? It needs to have the result and convergence information from the eigensolver as well as the result and convergence method for the partitioning method.

If we are using a embed into q dimensions and then run k-means approach, then the return type could be something like

type SpectralClusteringResult{T<:Real, C<:ClusteringResult} <: ClusteringResult
    eigensolution::EigsResult{T}
    clusters::C
end

Then you have the spectral embedding information in the eigensolution field for making an visualization or diagnosing the results, and the final clustering information is all embedded in the clusters field. The alternative I thought of is to repeat most of the fields from the clustering into the SpectralClusteringResult type.

lucianolorenti commented 6 years ago

In case anyone is still interested, I attach the link to my library of Spectral Clustering

zsteve commented 1 year ago

@lucianolorenti's package is now archived, and from what I can tell there isn't really another actively maintained and easily useable spectral clustering functionality. In my view it would make sense to make some of that package part of Clustering.jl. Thoughts?

alyst commented 1 year ago

@zsteve If it is about adding 1-2 source files and little to none new deps (all from JuliaXXX organisations), and there are no licensing issues of reusing that code, I think we may add spectral clustering to Clustering.jl.

zsteve commented 1 year ago

@zsteve If it is about adding 1-2 source files and little to none new deps (all from JuliaXXX organisations), and there are no licensing issues of reusing that code, I think we may add spectral clustering to Clustering.jl.

Yes, I'd be happy to look into that when I have some spare time. Although the SpectralClustering.jl package seems to have quite a few advanced functionality that might not be necessary. For context, my use case is that I want to do vanilla spectral clustering using kNN or precomputed affinity matrices similar to that in the sklearn package in Python.