{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.SageMaker.Types.FinalAutoMLJobObjectiveMetric where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(FinalAutoMLJobObjectiveMetric
 -> FinalAutoMLJobObjectiveMetric -> Bool)
-> (FinalAutoMLJobObjectiveMetric
    -> FinalAutoMLJobObjectiveMetric -> Bool)
-> Eq FinalAutoMLJobObjectiveMetric
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]
(Int -> ReadS FinalAutoMLJobObjectiveMetric)
-> ReadS [FinalAutoMLJobObjectiveMetric]
-> ReadPrec FinalAutoMLJobObjectiveMetric
-> ReadPrec [FinalAutoMLJobObjectiveMetric]
-> Read 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
(Int -> FinalAutoMLJobObjectiveMetric -> ShowS)
-> (FinalAutoMLJobObjectiveMetric -> String)
-> ([FinalAutoMLJobObjectiveMetric] -> ShowS)
-> Show FinalAutoMLJobObjectiveMetric
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.
 FinalAutoMLJobObjectiveMetric
 -> Rep FinalAutoMLJobObjectiveMetric x)
-> (forall x.
    Rep FinalAutoMLJobObjectiveMetric x
    -> FinalAutoMLJobObjectiveMetric)
-> Generic FinalAutoMLJobObjectiveMetric
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' :: Maybe AutoMLJobObjectiveType
-> AutoMLMetricEnum -> Double -> FinalAutoMLJobObjectiveMetric
FinalAutoMLJobObjectiveMetric'
    { $sel:type':FinalAutoMLJobObjectiveMetric' :: Maybe AutoMLJobObjectiveType
type' =
        Maybe AutoMLJobObjectiveType
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 :: (Maybe AutoMLJobObjectiveType -> f (Maybe AutoMLJobObjectiveType))
-> FinalAutoMLJobObjectiveMetric -> f FinalAutoMLJobObjectiveMetric
finalAutoMLJobObjectiveMetric_type = (FinalAutoMLJobObjectiveMetric -> Maybe AutoMLJobObjectiveType)
-> (FinalAutoMLJobObjectiveMetric
    -> Maybe AutoMLJobObjectiveType -> FinalAutoMLJobObjectiveMetric)
-> Lens
     FinalAutoMLJobObjectiveMetric
     FinalAutoMLJobObjectiveMetric
     (Maybe AutoMLJobObjectiveType)
     (Maybe AutoMLJobObjectiveType)
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 :: (AutoMLMetricEnum -> f AutoMLMetricEnum)
-> FinalAutoMLJobObjectiveMetric -> f FinalAutoMLJobObjectiveMetric
finalAutoMLJobObjectiveMetric_metricName = (FinalAutoMLJobObjectiveMetric -> AutoMLMetricEnum)
-> (FinalAutoMLJobObjectiveMetric
    -> AutoMLMetricEnum -> FinalAutoMLJobObjectiveMetric)
-> Lens
     FinalAutoMLJobObjectiveMetric
     FinalAutoMLJobObjectiveMetric
     AutoMLMetricEnum
     AutoMLMetricEnum
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 :: (Double -> f Double)
-> FinalAutoMLJobObjectiveMetric -> f FinalAutoMLJobObjectiveMetric
finalAutoMLJobObjectiveMetric_value = (FinalAutoMLJobObjectiveMetric -> Double)
-> (FinalAutoMLJobObjectiveMetric
    -> Double -> FinalAutoMLJobObjectiveMetric)
-> Lens
     FinalAutoMLJobObjectiveMetric
     FinalAutoMLJobObjectiveMetric
     Double
     Double
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 Core.FromJSON FinalAutoMLJobObjectiveMetric where
  parseJSON :: Value -> Parser FinalAutoMLJobObjectiveMetric
parseJSON =
    String
-> (Object -> Parser FinalAutoMLJobObjectiveMetric)
-> Value
-> Parser FinalAutoMLJobObjectiveMetric
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"FinalAutoMLJobObjectiveMetric"
      ( \Object
x ->
          Maybe AutoMLJobObjectiveType
-> AutoMLMetricEnum -> Double -> FinalAutoMLJobObjectiveMetric
FinalAutoMLJobObjectiveMetric'
            (Maybe AutoMLJobObjectiveType
 -> AutoMLMetricEnum -> Double -> FinalAutoMLJobObjectiveMetric)
-> Parser (Maybe AutoMLJobObjectiveType)
-> Parser
     (AutoMLMetricEnum -> Double -> FinalAutoMLJobObjectiveMetric)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe AutoMLJobObjectiveType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Type")
            Parser
  (AutoMLMetricEnum -> Double -> FinalAutoMLJobObjectiveMetric)
-> Parser AutoMLMetricEnum
-> Parser (Double -> FinalAutoMLJobObjectiveMetric)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser AutoMLMetricEnum
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"MetricName")
            Parser (Double -> FinalAutoMLJobObjectiveMetric)
-> Parser Double -> Parser FinalAutoMLJobObjectiveMetric
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Double
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Value")
      )

instance
  Prelude.Hashable
    FinalAutoMLJobObjectiveMetric

instance Prelude.NFData FinalAutoMLJobObjectiveMetric