TradingView
RicardoSantos
2020年9月7日午前10時50分

Function K-Means Clustering 

US Nas 100OANDA

詳細

Description:
A Function that returns cluster centers for given data (X,Y) vector points.

Inputs:
_X: Array containing x data points.¹
_Y: Array containing y data points.¹
_number_of_clusters: number of clusters.

Note:
¹: _X and _Y size must match.

Outputs:
_centers_x: Array containing x data points.
_centers_y: Array containing y data points.

Resources:
rosettacode.org/wiki/K-means++_clustering
en.wikipedia.org/wiki/K-means_clustering

リリースノート

Update to V5 and fixed a a few errors in the code. -_-*
コメント
jon2snow
It is sadly not working, Message bar 0 in remove.array function, Index -1 is out of bounds, array size is 1.
RicardoSantos
@jon2snow, fixed, thanks for reporting :)
luminaryfi
Excellent Work @RicardoSantos !
joaoseguradocomercial
nao roda
kakola
Instead of vectors, can k-means clustering be used on simple linear sets of data?
RicardoSantos
@kakola, you can use the same set for X, Y arrays to do 1d means, but there would be better methods to achieve that..
RicardoSantos
@kakola, follow up: take a look at the comments in this OS discussion:
kakola
@RicardoSantos, I will try to find a clustering algorithm where N-clusters does not have to be initially provided.
RicardoSantos
ruimnetob
@RicardoSantos Olá Ricardo! Esta implementação de clustering por K-Means está funcional? Obrigado!
詳細