【发布时间】:2015-11-10 16:17:04
【问题描述】:
我正在尝试使用 Scala 的微风库估计数据集的参数(狄利克雷分布)。我已经有一个工作 python (pandas/dataframes) 和它的 R 代码,但我很好奇如何在 Scala 中做到这一点。我也是 Scala 的新手。
我似乎无法让它工作。我想在语法上我没有正确的东西。
根据上面的代码:ExpFam[T,I]接受两个参数T和I,我不知道T和I是什么。 T 可以是密集矩阵吗?
我正在做的是:
# Creating a matrix. The values are counts in my case.
val mat = DenseMatrix((1.0, 2.0, 3.0),(4.0, 5.0, 6.0))
# Then try to get sufficient stats and then MLE. I think this where I doing something wrong.
val diri = new ExpFam[DenseMatrix[Double],Int](mat)
println(diri.sufficientStatisticFor(mat))
另外,如果有一个像这样的数据矩阵 DenseMatrix((1.0, 2.0, 3.0),(4.0, 5.0, 6.0)) 如何在 Scala 中估计参数(Dirichlet)。
【问题讨论】:
标签: scala scala-breeze mle dirichlet