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

scala.googleapis.bigquery.RegressionMetrics.scala Maven / Gradle / Ivy

There is a newer version: 0.4.5-v2-20240905
Show newest version
package googleapis.bigquery

import io.circe._
import io.circe.syntax._

final case class RegressionMetrics(
    /** Mean squared error.
      */
    meanSquaredError: Option[Double] = None,
    /** R^2 score. This corresponds to r2_score in ML.EVALUATE.
      */
    rSquared: Option[Double] = None,
    /** Median absolute error.
      */
    medianAbsoluteError: Option[Double] = None,
    /** Mean absolute error.
      */
    meanAbsoluteError: Option[Double] = None,
    /** Mean squared log error.
      */
    meanSquaredLogError: Option[Double] = None,
)
object RegressionMetrics {
  implicit val encoder: Encoder[RegressionMetrics] = Encoder.instance { x =>
    Json.obj(
      "meanSquaredError" := x.meanSquaredError,
      "rSquared" := x.rSquared,
      "medianAbsoluteError" := x.medianAbsoluteError,
      "meanAbsoluteError" := x.meanAbsoluteError,
      "meanSquaredLogError" := x.meanSquaredLogError,
    )
  }
  implicit val decoder: Decoder[RegressionMetrics] = Decoder.instance { c =>
    for {
      v0 <- c.get[Option[Double]]("meanSquaredError")
      v1 <- c.get[Option[Double]]("rSquared")
      v2 <- c.get[Option[Double]]("medianAbsoluteError")
      v3 <- c.get[Option[Double]]("meanAbsoluteError")
      v4 <- c.get[Option[Double]]("meanSquaredLogError")
    } yield RegressionMetrics(v0, v1, v2, v3, v4)

  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy