【问题标题】:How to find Kmeans total number of iterations?如何找到 Kmeans 总迭代次数?
【发布时间】:2016-02-15 23:17:38
【问题描述】:

我正在研究 k-means 算法。我已经使用统计工具箱的内置功能应用了 k-means 算法。我已经将它应用于大数据。我想知道函数将数据划分为最终集群所花费的总迭代次数!我不是 MATLAB 的普通用户。请帮我找出迭代次数。

【问题讨论】:

  • 请更新您的问题以包含您的代码,请参阅minimal reproducible example。我猜你正在使用kmeans 函数,请阅读文档;它能够显示迭代次数。

标签: matlab k-means


【解决方案1】:

您需要使用Name, Value 输入到kmeans

idx = kmeans(X,k,Name,Value)

具体来说,'Display','final''Display','iter' 如图所示here

你可以看到this example的输出示例:

opts = statset('Display','final');
[idx,C] = kmeans(X,2,'Distance','cityblock',...
    'Replicates',5,'Options',opts);

Replicate 1, 4 iterations, total sum of distances = 201.533.
Replicate 2, 6 iterations, total sum of distances = 201.533.
Replicate 3, 4 iterations, total sum of distances = 201.533.
Replicate 4, 4 iterations, total sum of distances = 201.533.
Replicate 5, 3 iterations, total sum of distances = 201.533.
Best total sum of distances = 201.533

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-08-08
    • 2020-02-23
    • 1970-01-01
    • 2012-10-04
    • 2019-01-12
    • 1970-01-01
    • 2021-04-03
    相关资源
    最近更新 更多