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

scala.googleapis.bigquery.ClusteringMetrics.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 ClusteringMetrics(
    /** Information for all clusters.
      */
    clusters: Option[List[Cluster]] = None,
    /** Davies-Bouldin index.
      */
    daviesBouldinIndex: Option[Double] = None,
    /** Mean of squared distances between each sample to its cluster centroid.
      */
    meanSquaredDistance: Option[Double] = None,
)
object ClusteringMetrics {
  implicit val encoder: Encoder[ClusteringMetrics] = Encoder.instance { x =>
    Json.obj(
      "clusters" := x.clusters,
      "daviesBouldinIndex" := x.daviesBouldinIndex,
      "meanSquaredDistance" := x.meanSquaredDistance,
    )
  }
  implicit val decoder: Decoder[ClusteringMetrics] = Decoder.instance { c =>
    for {
      v0 <- c.get[Option[List[Cluster]]]("clusters")
      v1 <- c.get[Option[Double]]("daviesBouldinIndex")
      v2 <- c.get[Option[Double]]("meanSquaredDistance")
    } yield ClusteringMetrics(v0, v1, v2)

  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy