Function K-Means Clustering

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

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

¹: _X and _Y size must match.

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

从常用脚本中删除 添加到常用脚本


Excellent Work @RicardoSantos !
+1 回复
@RicardoSantos Olá Ricardo! Esta implementação de clustering por K-Means está funcional? Obrigado!
ruimnetob ruimnetob
@ruimnetob, gostaria de agrupar uns valores, e obter os seus centros
Hello, @RicardoSantos is there any chance that you could show an example of using k-means clustering in Pine Script? Perhaps something along the lines of this would be very useful! https://medium.com/@judopro/using-machine-learning-to-programmatically-determine-stock-support-and-resistance-levels-9bb70777cf8e

My intent is to use k-means clustering in Pine Script the same way as the above article does, however, I am only familiar with python and sklearn and feel like I would need to see a working pine script example first. If you do decide to make the above before me then I applaud you!
RicardoSantos DEAD_HUNTER
@DEAD_HUNTER, we are still quite a bit off to be able to do any meaningful AI in pine :P, the kmeans function is a bit expensive computationally so your very limited, maybe later it will be possible to apply it correctly, i dont have any plans of using it in a more complex way any time soon
DEAD_HUNTER RicardoSantos
@RicardoSantos, Thats such a shame, I really think that the above mentioned python implementation is pretty neat, however I don't really use it due to the fact that I have to run it on my own pc and fetch data from yahoo finance and in the end I get a chart that isn't linked with Tradingview. Its just a bit of a hassle to read and trade really :/
@DEAD_HUNTER, I personally trade using TradingView and love the charting so I wanted to have the k-means function in tradingview like you said.
But wasn't possible, so built quickly using python. @ricardoSantos from what I see, you already have a code generating centers tho, so why can't he use that to draw the centers?
首页 股票筛选器 外汇筛选器 加密货币筛选器 财经日历 如何运作 图表功能 价格 推荐朋友 网站规则 帮助中心 网站 & 经纪商解决方案 插件 图表解决方案 轻量图表库 博客 & 新闻 Twitter
概览 个人资料设置 账户和账单 推荐朋友 代币 我的客服工单 帮助中心 已发表观点 粉丝 正在关注 私人消息 在线聊天 退出