Java MOA Clustream WithKmeans:微型集群和宏集群的中心和空值(半径,权重= 0)

首先:我在Java项目中使用moa-release-2019.05.0-bin/moa-release-2019.05.0/lib/moa.jar

现在,让我们谈谈重点:我正在尝试使用 moa.clusterers.clustream.WithKmeans流聚类算法,我不知道为什么会这样...

我刚开始使用moa,并且在尝试解码必须如何使用聚类算法方面遇到了困难。该文档缺少用于通用用法的示例代码,并且该实现也没有得到很好的解释……也未找到任何教程。

  • 我的代码:
import com.yahoo.labs.samoa.instances.DenseInstance;
import moa.cluster.Clustering;
import moa.clusterers.clustream.WithKmeans;

public class TestingClustream {
    static DenseInstance randomInstance(int size) {
        DenseInstance instance = new DenseInstance(size);
        for (int idx = 0; idx < size; idx++) {
            instance.setvalue(idx,Math.random());
        }
        return instance;
    }

    public static void main(String[] args) {
        WithKmeans wkm = new WithKmeans();
        wkm.kOption.setvalue(5);
        wkm.maxNumKernelsOption.setvalue(300);
        wkm.resetLearningImpl();
        for (int i = 0; i < 10000; i++) {
            wkm.trainOnInstanceImpl(randomInstance(2));
        }
        Clustering clusteringResult = wkm.getclusteringResult();
        Clustering microClusteringResult = wkm.getmicroClusteringResult();
    }
}

  • 来自调试器的信息:

Java MOA Clustream WithKmeans:微型集群和宏集群的中心和空值(半径,权重= 0)

Java MOA Clustream WithKmeans:微型集群和宏集群的中心和空值(半径,权重= 0)

我已经多次阅读source code,在我看来,我在以正确的顺序使用正确的功能...我不知道自己缺少什么...欢迎任何反馈!

luxiaofeng_374 回答:Java MOA Clustream WithKmeans:微型集群和宏集群的中心和空值(半径,权重= 0)

确保已为算法提供了足够的数据,它将分批处理数据。

这些字段未使用,可能来自某些用途不同的父类。

使用诸如getCenter()之类的吸气剂方法,它们将从运行总和中计算当前中心。

本文链接:https://www.f2er.com/3085294.html

大家都在问