File Exchange

image thumbnail

Fast K-means clustering

version 1.6 (1.46 MB) by

Fast mex K-means clustering algorithm with possibility of K-mean++ initialization.

8 Downloads

Updated

View License

Fast mex K-means clustering algorithm with possibility of K-mean++ initialization
(mex-interface modified from the original yael package https://gforge.inria.fr/projects/yael)

- Accept single/double precision input
- Support of BLAS/OpenMP for multi-core computation

Please run mexme_yael_kmeans.m to compile mex-files (be sure that mex -setup have been done at least one)

Run demo "test_yael_kmeans.m"

Comments and Ratings (14)

Kathrin

Dear Sebastien,
I had compiled the mex-files successfully.The "sample_mvgm" and " ndellipse" were executed successfully while there were something wrong with "yael_kmeans".It was reported that "matlab has matlab has encountered an internal problem and needs to close ".
Please give me a hand.
Compiler: Microsoft Software Development Kit (SDK) 7.1
MatlabRelease: matlab 7.14.0.739 (R2012a)

Kota Hara

Kota Hara (view profile)

Kota Hara

Kota Hara (view profile)

Thank you for checking. The reason is that there are cases where the cardinality of the data is unknown before applying clustering. Well, I can first check the cardinality of the data and then use k <= cardinality but I just thought it would be great if your code could handle that situation.

Sebastien PARIS

Kota,

I confirmed the bahaviour. In another way, why ask more clusters than the cardinality of your data ?

Sebastien PARIS

Kota,

Thank you for reporting.... I will check this

Kota Hara

Kota Hara (view profile)

My input data X is a set of one dimensional scalar and the values are taken from a finite discrete set S, e.g., S = {1,2,3,4,5}. When I run yael_kmeans with K>|S|, it looks like yael_kmeans goes into an infinite loop. Do you have any idea on how to fix it?

Sebastien PARIS

Sepehr,
Can you indicate what is your OS, CPU and compiler used ? Did you recompile mex-files also ?

Matlab crashes w/ segmentation fault. I guess you have a loose pointer somewhere. "Segmentation violation detected"

Sebastien PARIS

Leila ...

It supports of course 3d vectors or more ...

leila

leila (view profile)

Does the code support 3d data?

Sebastien PARIS

Thank you for reporting ...
The update with correction will be published soon.

Bonolo

Bonolo (view profile)

on the mac, need to change lib= '-lmwblas'; to libblas= '-lmwblas';

otherwise compiles fine.

Sebastien PARIS

Vladimir,

Did you compile mex-files first ?

Please run mexme_yael_kmeans.m to compile mex-files (be sure that mex -setup have been done at least one)

Vladimir

Using MSVC++ 2010 compiler, sample_mvgm throws an error when called in test_yael_kmeans:
"mu must be (d x 1 x M x n1 x ... x nl)"
where
mu = cat(3 , [-2.5 ; -3] , [0 ; 0] ,[ 5 ; 5]); %(d x 1 x M)

Updates

1.6

- Fix compilation issue in mexme_yael_kmeans
- Include both mexw32 & mexw64 files in two separate files (unzip them in local dir in case of problem)

1.5

- Fix a bug in ndellipse introduced in the last update

1.4

-Correct a bug in mexme_yael_kmeans.m for Linux/Mac Os

1.3

-Correct a bug in randperm

1.2

- Minor changes
- Add spiral clustering example in the test file

1.1

- Add online help, minor changes

MATLAB Release
MATLAB 7.9 (R2009b)
Acknowledgements

Inspired: Ziheng_GMM.zip, Sparsified K-Means

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video