Java MOA Clustream WithKmeans: 微观和宏观聚类中心均为null,且(半径, 权重 = 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();    }}
  • 调试器的信息:

enter image description here

enter image description here

我已经多次阅读了源代码,对我来说,我似乎是以正确的顺序使用了正确的函数…我不知道我错过了什么…欢迎任何反馈!


回答:

确保你为算法提供了足够的数据,它会以批次处理数据。

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

使用诸如getCenter()这样的getter方法,它会从运行总和中计算当前中心。

Related Posts

使用LSTM在Python中预测未来值

这段代码可以预测指定股票的当前日期之前的值,但不能预测…

如何在gensim的word2vec模型中查找双词组的相似性

我有一个word2vec模型,假设我使用的是googl…

dask_xgboost.predict 可以工作但无法显示 – 数据必须是一维的

我试图使用 XGBoost 创建模型。 看起来我成功地…

ML Tuning – Cross Validation in Spark

我在https://spark.apache.org/…

如何在React JS中使用fetch从REST API获取预测

我正在开发一个应用程序,其中Flask REST AP…

如何分析ML.NET中多类分类预测得分数组?

我在ML.NET中创建了一个多类分类项目。该项目可以对…

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注