Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/scala/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Scala Spark LDA-一致主题分布_Scala_Apache Spark_Apache Spark Mllib_Lda - Fatal编程技术网

Scala Spark LDA-一致主题分布

Scala Spark LDA-一致主题分布,scala,apache-spark,apache-spark-mllib,lda,Scala,Apache Spark,Apache Spark Mllib,Lda,我正在使用Spark的LDA实现,如示例代码所示。我想为我的培训数据获得一致的主题/主题分布。我在两台机器上训练,希望输出相同 我知道LDA使用随机组件进行训练/推理,本文对此进行了解释。在python gensim中,似乎可以通过手动设置种子值来获得一致的结果。我曾在Spark中尝试过,但在我输出的主题分布中仍然有轻微的差异 ldaParams: LDA = new LDA().setK(10).setMaxIterations(60).setSeed(10L) val distributed

我正在使用Spark的LDA实现,如示例代码所示。我想为我的培训数据获得一致的主题/主题分布。我在两台机器上训练,希望输出相同

我知道LDA使用随机组件进行训练/推理,本文对此进行了解释。在python gensim中,似乎可以通过手动设置种子值来获得一致的结果。我曾在Spark中尝试过,但在我输出的主题分布中仍然有轻微的差异

ldaParams: LDA = new LDA().setK(10).setMaxIterations(60).setSeed(10L)
val distributedLDAModel: DistributedLDAModel = ldaParams.run(corpusInfo.docTermVectors).asInstanceOf[DistributedLDAModel]
val topicDistributions: Map[Long,Vector] = distributedLDAModel.topicDistributions.collect.toMap //produces different results on each run

有什么方法可以让我的培训数据集中的主题分布保持一致吗?

你说的“轻微”是什么意思?你能给出估计的数量级吗?我可以试着得到一个估计,但这有什么关系?我在寻找一致的结果。这是可能的吗?好吧,这很重要,因为我们使用的是一个丑陋的叫做FP算术的东西,我们期望的关联和交换的运算是不可能的。由于Spark中的每一次洗牌都引入了非确定性的来源,因此,即使RNG序列是确定性的,也不能保证每次运行都会得到完全相同的结果。