Skip to content

Implemented light Elkan version of clustering #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 16, 2020

Conversation

Arkoniak
Copy link
Collaborator

@Arkoniak Arkoniak commented Mar 16, 2020

Usage

using PyCall
using Clustering
using ParallelKMeans
using Plots

data = pyimport("sklearn.datasets")
X, y = data.make_blobs(n_samples=1_000_000, n_features=30, centers=3, cluster_std=0.9, random_state=80)
X = permutedims(X)
@time a = [Clustering.kmeans(X, i, tol=1e-4, maxiter=300).totalcost for i = 2:10]
@time b = [ParallelKMeans.kmeans(X, i, ParallelKMeans.SingleThread(), tol=1e-6, max_iters=300, verbose=false).totalcost for i = 2:10]
@time c = [ParallelKMeans.kmeans(X, i, ParallelKMeans.MultiThread(), tol=1e-6, max_iters=300, verbose=false).totalcost for i = 2:10]
@time d = [ParallelKMeans.kmeans(ParallelKMeans.LightElkan(), X, i, ParallelKMeans.MultiThread(), tol=1e-6, max_iters=300, verbose=false).totalcost for i = 2:10]

plot(a, label="Clustering")
plot!(b, label="SingleThread")
plot!(c, label="MultiThread")
plot!(d, label="LightElkan")

Warning: requires heavy refactoring, now it's ugly copy paste.

@PyDataBlog
Copy link
Owner

Merging for further testing and re-factoring

@PyDataBlog PyDataBlog merged commit f5599fd into PyDataBlog:experimental Mar 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants