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

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

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

import JsonInstances._
import io.circe._
import io.circe.syntax._
import scala.concurrent.duration.FiniteDuration

final case class IterationResult(
    /** Loss computed on the training data at the end of iteration.
      */
    trainingLoss: Option[Double] = None,
    /** Arima result.
      */
    arimaResult: Option[ArimaResult] = None,
    /** Information about top clusters for clustering models.
      */
    clusterInfos: Option[List[ClusterInfo]] = None,
    /** Learn rate used for this iteration.
      */
    learnRate: Option[Double] = None,
    /** Time taken to run the iteration in milliseconds.
      */
    durationMs: Option[FiniteDuration] = None,
    /** Index of the iteration, 0 based.
      */
    index: Option[Int] = None,
    /** The information of the principal components.
      */
    principalComponentInfos: Option[List[PrincipalComponentInfo]] = None,
    /** Loss computed on the eval data at the end of iteration.
      */
    evalLoss: Option[Double] = None,
)
object IterationResult {
  implicit val encoder: Encoder[IterationResult] = Encoder.instance { x =>
    Json.obj(
      "trainingLoss" := x.trainingLoss,
      "arimaResult" := x.arimaResult,
      "clusterInfos" := x.clusterInfos,
      "learnRate" := x.learnRate,
      "durationMs"
        := x.durationMs,
      "index" := x.index,
      "principalComponentInfos" := x.principalComponentInfos,
      "evalLoss" := x.evalLoss,
    )
  }
  implicit val decoder: Decoder[IterationResult] = Decoder.instance { c =>
    for {
      v0 <- c.get[Option[Double]]("trainingLoss")
      v1 <- c.get[Option[ArimaResult]]("arimaResult")
      v2 <- c.get[Option[List[ClusterInfo]]]("clusterInfos")
      v3 <- c.get[Option[Double]]("learnRate")
      v4 <- c.get[Option[FiniteDuration]]("durationMs")
      v5 <- c.get[Option[Int]]("index")
      v6 <- c.get[Option[List[PrincipalComponentInfo]]]("principalComponentInfos")
      v7 <- c.get[Option[Double]]("evalLoss")
    } yield IterationResult(v0, v1, v2, v3, v4, v5, v6, v7)
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy