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

commonMain.aws.sdk.kotlin.services.comprehend.transform.ClassifierEvaluationMetricsDocumentDeserializer.kt Maven / Gradle / Ivy

// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.comprehend.transform

import aws.sdk.kotlin.services.comprehend.model.ClassifierEvaluationMetrics
import aws.smithy.kotlin.runtime.serde.Deserializer
import aws.smithy.kotlin.runtime.serde.SdkFieldDescriptor
import aws.smithy.kotlin.runtime.serde.SdkObjectDescriptor
import aws.smithy.kotlin.runtime.serde.SerialKind
import aws.smithy.kotlin.runtime.serde.asSdkSerializable
import aws.smithy.kotlin.runtime.serde.deserializeList
import aws.smithy.kotlin.runtime.serde.deserializeMap
import aws.smithy.kotlin.runtime.serde.deserializeStruct
import aws.smithy.kotlin.runtime.serde.field
import aws.smithy.kotlin.runtime.serde.json.JsonDeserializer
import aws.smithy.kotlin.runtime.serde.json.JsonSerialName
import aws.smithy.kotlin.runtime.serde.serializeList
import aws.smithy.kotlin.runtime.serde.serializeMap
import aws.smithy.kotlin.runtime.serde.serializeStruct

internal fun deserializeClassifierEvaluationMetricsDocument(deserializer: Deserializer): ClassifierEvaluationMetrics {
    val builder = ClassifierEvaluationMetrics.Builder()
    val ACCURACY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Double, JsonSerialName("Accuracy"))
    val F1SCORE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Double, JsonSerialName("F1Score"))
    val HAMMINGLOSS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Double, JsonSerialName("HammingLoss"))
    val MICROF1SCORE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Double, JsonSerialName("MicroF1Score"))
    val MICROPRECISION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Double, JsonSerialName("MicroPrecision"))
    val MICRORECALL_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Double, JsonSerialName("MicroRecall"))
    val PRECISION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Double, JsonSerialName("Precision"))
    val RECALL_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Double, JsonSerialName("Recall"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ACCURACY_DESCRIPTOR)
        field(F1SCORE_DESCRIPTOR)
        field(HAMMINGLOSS_DESCRIPTOR)
        field(MICROF1SCORE_DESCRIPTOR)
        field(MICROPRECISION_DESCRIPTOR)
        field(MICRORECALL_DESCRIPTOR)
        field(PRECISION_DESCRIPTOR)
        field(RECALL_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                ACCURACY_DESCRIPTOR.index -> builder.accuracy = deserializeDouble()
                F1SCORE_DESCRIPTOR.index -> builder.f1Score = deserializeDouble()
                HAMMINGLOSS_DESCRIPTOR.index -> builder.hammingLoss = deserializeDouble()
                MICROF1SCORE_DESCRIPTOR.index -> builder.microF1Score = deserializeDouble()
                MICROPRECISION_DESCRIPTOR.index -> builder.microPrecision = deserializeDouble()
                MICRORECALL_DESCRIPTOR.index -> builder.microRecall = deserializeDouble()
                PRECISION_DESCRIPTOR.index -> builder.precision = deserializeDouble()
                RECALL_DESCRIPTOR.index -> builder.recall = deserializeDouble()
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy