1

我的目标是使用https://spark.apache.org/docs/2.0.2/api/java/org/apache/spark/mllib/stat/test/StudentTTest上记录的方法在 Spark Scala 中执行 t 检验.html。假设我的数据在数据框中给出:

val df = Seq((1, 3), (-2, 5), (0, 4), (3, -1), (2, -1)).toDF("group1", "group2")

现在,我试过了

import org.apache.spark.mllib.stat.test
val ttestResult = test.StudentTTest(df)

但这给了我一个错误:<console>:29: error: object StudentTTest in package test cannot be accessed in package org.apache.spark.mllib.stat.test

我究竟做错了什么?

4

1 回答 1

0

这是因为您可能正在使用已弃用该方法的 Spark 2.2 或 Spark 2.3。请参阅 org.apache.spark.ml.stat 和 org.apache.spark.mllib.stat.test https://spark.apache.org/docs/2.2.0/api/scala/index.html#org.apache。火花包

于 2018-08-01T17:02:53.343 回答