{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.SageMaker.Types.FinalAutoMLJobObjectiveMetric
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.SageMaker.Types.FinalAutoMLJobObjectiveMetric where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMaker.Types.AutoMLJobObjectiveType
import Amazonka.SageMaker.Types.AutoMLMetricEnum

-- | The best candidate result from an AutoML training job.
--
-- /See:/ 'newFinalAutoMLJobObjectiveMetric' smart constructor.
data FinalAutoMLJobObjectiveMetric = FinalAutoMLJobObjectiveMetric'
  { -- | The type of metric with the best result.
    FinalAutoMLJobObjectiveMetric -> Maybe AutoMLJobObjectiveType
type' :: Prelude.Maybe AutoMLJobObjectiveType,
    -- | The name of the metric with the best result. For a description of the
    -- possible objective metrics, see AutoMLJobObjective$MetricName.
    FinalAutoMLJobObjectiveMetric -> AutoMLMetricEnum
metricName :: AutoMLMetricEnum,
    -- | The value of the metric with the best result.
    FinalAutoMLJobObjectiveMetric -> Double
value :: Prelude.Double
  }
  deriving (FinalAutoMLJobObjectiveMetric
-> FinalAutoMLJobObjectiveMetric -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FinalAutoMLJobObjectiveMetric
-> FinalAutoMLJobObjectiveMetric -> Bool
$c/= :: FinalAutoMLJobObjectiveMetric
-> FinalAutoMLJobObjectiveMetric -> Bool
== :: FinalAutoMLJobObjectiveMetric
-> FinalAutoMLJobObjectiveMetric -> Bool
$c== :: FinalAutoMLJobObjectiveMetric
-> FinalAutoMLJobObjectiveMetric -> Bool
Prelude.Eq, ReadPrec [FinalAutoMLJobObjectiveMetric]
ReadPrec FinalAutoMLJobObjectiveMetric
Int -> ReadS FinalAutoMLJobObjectiveMetric
ReadS [FinalAutoMLJobObjectiveMetric]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FinalAutoMLJobObjectiveMetric]
$creadListPrec :: ReadPrec [FinalAutoMLJobObjectiveMetric]
readPrec :: ReadPrec FinalAutoMLJobObjectiveMetric
$creadPrec :: ReadPrec FinalAutoMLJobObjectiveMetric
readList :: ReadS [FinalAutoMLJobObjectiveMetric]
$creadList :: ReadS [FinalAutoMLJobObjectiveMetric]
readsPrec :: Int -> ReadS FinalAutoMLJobObjectiveMetric
$creadsPrec :: Int -> ReadS FinalAutoMLJobObjectiveMetric
Prelude.Read, Int -> FinalAutoMLJobObjectiveMetric -> ShowS
[FinalAutoMLJobObjectiveMetric] -> ShowS
FinalAutoMLJobObjectiveMetric -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FinalAutoMLJobObjectiveMetric] -> ShowS
$cshowList :: [FinalAutoMLJobObjectiveMetric] -> ShowS
show :: FinalAutoMLJobObjectiveMetric -> String
$cshow :: FinalAutoMLJobObjectiveMetric -> String
showsPrec :: Int -> FinalAutoMLJobObjectiveMetric -> ShowS
$cshowsPrec :: Int -> FinalAutoMLJobObjectiveMetric -> ShowS
Prelude.Show, forall x.
Rep FinalAutoMLJobObjectiveMetric x
-> FinalAutoMLJobObjectiveMetric
forall x.
FinalAutoMLJobObjectiveMetric
-> Rep FinalAutoMLJobObjectiveMetric x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep FinalAutoMLJobObjectiveMetric x
-> FinalAutoMLJobObjectiveMetric
$cfrom :: forall x.
FinalAutoMLJobObjectiveMetric
-> Rep FinalAutoMLJobObjectiveMetric x
Prelude.Generic)

-- |
-- Create a value of 'FinalAutoMLJobObjectiveMetric' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'type'', 'finalAutoMLJobObjectiveMetric_type' - The type of metric with the best result.
--
-- 'metricName', 'finalAutoMLJobObjectiveMetric_metricName' - The name of the metric with the best result. For a description of the
-- possible objective metrics, see AutoMLJobObjective$MetricName.
--
-- 'value', 'finalAutoMLJobObjectiveMetric_value' - The value of the metric with the best result.
newFinalAutoMLJobObjectiveMetric ::
  -- | 'metricName'
  AutoMLMetricEnum ->
  -- | 'value'
  Prelude.Double ->
  FinalAutoMLJobObjectiveMetric
newFinalAutoMLJobObjectiveMetric :: AutoMLMetricEnum -> Double -> FinalAutoMLJobObjectiveMetric
newFinalAutoMLJobObjectiveMetric AutoMLMetricEnum
pMetricName_ Double
pValue_ =
  FinalAutoMLJobObjectiveMetric'
    { $sel:type':FinalAutoMLJobObjectiveMetric' :: Maybe AutoMLJobObjectiveType
type' =
        forall a. Maybe a
Prelude.Nothing,
      $sel:metricName:FinalAutoMLJobObjectiveMetric' :: AutoMLMetricEnum
metricName = AutoMLMetricEnum
pMetricName_,
      $sel:value:FinalAutoMLJobObjectiveMetric' :: Double
value = Double
pValue_
    }

-- | The type of metric with the best result.
finalAutoMLJobObjectiveMetric_type :: Lens.Lens' FinalAutoMLJobObjectiveMetric (Prelude.Maybe AutoMLJobObjectiveType)
finalAutoMLJobObjectiveMetric_type :: Lens' FinalAutoMLJobObjectiveMetric (Maybe AutoMLJobObjectiveType)
finalAutoMLJobObjectiveMetric_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FinalAutoMLJobObjectiveMetric' {Maybe AutoMLJobObjectiveType
type' :: Maybe AutoMLJobObjectiveType
$sel:type':FinalAutoMLJobObjectiveMetric' :: FinalAutoMLJobObjectiveMetric -> Maybe AutoMLJobObjectiveType
type'} -> Maybe AutoMLJobObjectiveType
type') (\s :: FinalAutoMLJobObjectiveMetric
s@FinalAutoMLJobObjectiveMetric' {} Maybe AutoMLJobObjectiveType
a -> FinalAutoMLJobObjectiveMetric
s {$sel:type':FinalAutoMLJobObjectiveMetric' :: Maybe AutoMLJobObjectiveType
type' = Maybe AutoMLJobObjectiveType
a} :: FinalAutoMLJobObjectiveMetric)

-- | The name of the metric with the best result. For a description of the
-- possible objective metrics, see AutoMLJobObjective$MetricName.
finalAutoMLJobObjectiveMetric_metricName :: Lens.Lens' FinalAutoMLJobObjectiveMetric AutoMLMetricEnum
finalAutoMLJobObjectiveMetric_metricName :: Lens' FinalAutoMLJobObjectiveMetric AutoMLMetricEnum
finalAutoMLJobObjectiveMetric_metricName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FinalAutoMLJobObjectiveMetric' {AutoMLMetricEnum
metricName :: AutoMLMetricEnum
$sel:metricName:FinalAutoMLJobObjectiveMetric' :: FinalAutoMLJobObjectiveMetric -> AutoMLMetricEnum
metricName} -> AutoMLMetricEnum
metricName) (\s :: FinalAutoMLJobObjectiveMetric
s@FinalAutoMLJobObjectiveMetric' {} AutoMLMetricEnum
a -> FinalAutoMLJobObjectiveMetric
s {$sel:metricName:FinalAutoMLJobObjectiveMetric' :: AutoMLMetricEnum
metricName = AutoMLMetricEnum
a} :: FinalAutoMLJobObjectiveMetric)

-- | The value of the metric with the best result.
finalAutoMLJobObjectiveMetric_value :: Lens.Lens' FinalAutoMLJobObjectiveMetric Prelude.Double
finalAutoMLJobObjectiveMetric_value :: Lens' FinalAutoMLJobObjectiveMetric Double
finalAutoMLJobObjectiveMetric_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FinalAutoMLJobObjectiveMetric' {Double
value :: Double
$sel:value:FinalAutoMLJobObjectiveMetric' :: FinalAutoMLJobObjectiveMetric -> Double
value} -> Double
value) (\s :: FinalAutoMLJobObjectiveMetric
s@FinalAutoMLJobObjectiveMetric' {} Double
a -> FinalAutoMLJobObjectiveMetric
s {$sel:value:FinalAutoMLJobObjectiveMetric' :: Double
value = Double
a} :: FinalAutoMLJobObjectiveMetric)

instance Data.FromJSON FinalAutoMLJobObjectiveMetric where
  parseJSON :: Value -> Parser FinalAutoMLJobObjectiveMetric
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"FinalAutoMLJobObjectiveMetric"
      ( \Object
x ->
          Maybe AutoMLJobObjectiveType
-> AutoMLMetricEnum -> Double -> FinalAutoMLJobObjectiveMetric
FinalAutoMLJobObjectiveMetric'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Type")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"MetricName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Value")
      )

instance
  Prelude.Hashable
    FinalAutoMLJobObjectiveMetric
  where
  hashWithSalt :: Int -> FinalAutoMLJobObjectiveMetric -> Int
hashWithSalt Int
_salt FinalAutoMLJobObjectiveMetric' {Double
Maybe AutoMLJobObjectiveType
AutoMLMetricEnum
value :: Double
metricName :: AutoMLMetricEnum
type' :: Maybe AutoMLJobObjectiveType
$sel:value:FinalAutoMLJobObjectiveMetric' :: FinalAutoMLJobObjectiveMetric -> Double
$sel:metricName:FinalAutoMLJobObjectiveMetric' :: FinalAutoMLJobObjectiveMetric -> AutoMLMetricEnum
$sel:type':FinalAutoMLJobObjectiveMetric' :: FinalAutoMLJobObjectiveMetric -> Maybe AutoMLJobObjectiveType
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AutoMLJobObjectiveType
type'
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` AutoMLMetricEnum
metricName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Double
value

instance Prelude.NFData FinalAutoMLJobObjectiveMetric where
  rnf :: FinalAutoMLJobObjectiveMetric -> ()
rnf FinalAutoMLJobObjectiveMetric' {Double
Maybe AutoMLJobObjectiveType
AutoMLMetricEnum
value :: Double
metricName :: AutoMLMetricEnum
type' :: Maybe AutoMLJobObjectiveType
$sel:value:FinalAutoMLJobObjectiveMetric' :: FinalAutoMLJobObjectiveMetric -> Double
$sel:metricName:FinalAutoMLJobObjectiveMetric' :: FinalAutoMLJobObjectiveMetric -> AutoMLMetricEnum
$sel:type':FinalAutoMLJobObjectiveMetric' :: FinalAutoMLJobObjectiveMetric -> Maybe AutoMLJobObjectiveType
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe AutoMLJobObjectiveType
type'
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf AutoMLMetricEnum
metricName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Double
value