[英]Scala Breeze Beta distribution parameter estimation
我正在尝试将我的数据(CTR(双)值列表)拟合到 beta 分布并估计 alpha 和 beta 形状参数。 我发现我可以使用 breeza 库的 mle 方法这样做,但我不明白调用 mle 方法所需的 arguments:-
object Beta extends ExponentialFamily[Beta,Double] with ContinuousDistributionUFuncProvider[Double,Beta] {
type Parameter = (Double,Double)
case class SufficientStatistic(n: Double, meanLog: Double, meanLog1M: Double) extends distributions.SufficientStatistic[SufficientStatistic] {
def *(weight: Double) = SufficientStatistic(n*weight,meanLog, meanLog1M)
def +(t: SufficientStatistic) = {
val delta = t.meanLog - meanLog
val newMeanLog = meanLog + delta * (t.n /(t.n + n))
val logDelta = t.meanLog1M - meanLog1M
val newMeanLog1M = meanLog1M + logDelta * (t.n /(t.n + n))
SufficientStatistic(n+t.n, newMeanLog, newMeanLog1M)
}
}
什么是n
、 meanLog
和meanLog1
?
这些是足够的统计数据。 在指数族中,最大似然估计仅通过充分统计的经验平均值依赖于数据。 对于 beta 系列,足够的统计数据是log(x)
和log(1-x)
。 meanLog
和meanLog1
是log(x)
和log(1-x)
的样本平均值。 n
为样本量,不直接进入 MLE 估计。 在package中使用它来组合两组足够的统计量。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.