Skip to main content

K-Means algorithm distance methods

  • June 19, 2017
  • 4 replies
  • 17 views

dcanadillas
Forum|alt.badge.img+1

Hi guys,

I just realized that the K-Means algorithm can support more distance methods of the algorithm than the default (euclidean), but the documentation doesn't say which ones support. I am not an algorithm expert, but I know that in other implementations you can use Manhattan and Cosine implementations (and I think there are more).

Which distance method options of the algorithm can be used in Vertica??

Thank you!

Regards,
David.

4 replies

Jim_Knicely
Forum|alt.badge.img+2
  • Participating Frequently
  • June 19, 2017

Hi,

I think only euclidean is supported now ...

dbadmin=> select version();
              version
------------------------------------
 Vertica Analytic Database v8.1.0-4
(1 row)

dbadmin=> SELECT KMEANS('myKmeansModel', 'iris1', '*', 5 USING PARAMETERS max_iterations=20, output_view='myKmeansView', key_columns='id', distance_method='jim', exclude_columns='Species');
ERROR 7506:  Problem in kmeans.
Detail: Only 'euclidean' is supported for distance_method

dcanadillas
Forum|alt.badge.img+1
  • Author
  • Participating Frequently
  • June 19, 2017
Thanks Jim,

I suppose then that the parameter is defined for more capabilities in future releases.

Regards,
David.

Forum|alt.badge.img+2
  • Participating Frequently
  • June 19, 2017

Thanks David for pointing this out. You'll see in the latest doc that there is no reference to the distance method for this exact reason: http://docdev.verticacorp.com/doc/trunk/HTML/index.htm#Authoring/SQLReferenceManual/Functions/MachineLearning/KMEANS.htm?TocPath=SQL%20Reference%20Manual|SQL%20Functions|Machine%20Learning%20Functions|_____9


dcanadillas
Forum|alt.badge.img+1
  • Author
  • Participating Frequently
  • June 19, 2017

Oh, now I see. It is good to remove it from doc to not get confused. Thanks for the info!!
Anyway, I got some feedback from some Data Scientists that it would be good to have the option to change the distance method.