我开始使用 spark,特别是 mllib 库。其中一些函数的范围和私有语句受到限制。如何在我的代码中使用这些函数?示例:KMeans.scala
private[mllib] def pointCost(
centers: TraversableOnce[BreezeVectorWithNorm],
point: BreezeVectorWithNorm): Double =
findClosest(centers, point)._2
如果我创建一个扩展 kmeans 的类并尝试使用此函数,我将无法访问它。显示以下错误:
error: method MethodInClassKMeans in class KMeans cannot be accessed in myClass
谁能给我一些如何解决这个问题的例子?谢谢并恭祝安康