我正在 Spark 中训练 NaiveBayesModel,但是当我使用它来预测新实例时,我需要获取每个类的概率。我查看了 NaiveBayesModel 中 predict 函数的代码,得出以下代码:
val thetaMatrix = new DenseMatrix (model.labels.length,model.theta(0).length,model.theta.flatten,true)
val piVector = new DenseVector(model.pi)
//val prob = thetaMatrix.multiply(test.features)
val x = test.map {p =>
val prob = thetaMatrix.multiply(p.features)
BLAS.axpy(1.0, piVector, prob)
prob
}
这工作正常吗?该行BLAS.axpy(1.0, piVector, prob)
不断给我一个错误,即找不到值'axpy'。