All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.iheart.thomas.analysis.bayesian.models.LogNormalModel.scala Maven / Gradle / Ivy

The newest version!
package com.iheart.thomas.analysis.bayesian.models

import cats.data.ValidatedNel
import cats.implicits._
import com.stripe.rainier.compute.Real

case class LogNormalModel(inner: NormalModel) {
  lazy val mean: Real = (inner.mean + (inner.variance / 2d)).exp
}
object LogNormalModel {
  def apply(
      miu0: Double,
      n0: Double,
      alpha: Double,
      beta: Double
    ): LogNormalModel = LogNormalModel(NormalModel(miu0, n0, alpha, beta))

  def validate(model: LogNormalModel): ValidatedNel[String, LogNormalModel] =
    NormalModel.validate(model.inner).as(model)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy