{-# 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.FinalHyperParameterTuningJobObjectiveMetric
-- 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.FinalHyperParameterTuningJobObjectiveMetric where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMaker.Types.HyperParameterTuningJobObjectiveType

-- | Shows the final value for the objective metric for a training job that
-- was launched by a hyperparameter tuning job. You define the objective
-- metric in the @HyperParameterTuningJobObjective@ parameter of
-- HyperParameterTuningJobConfig.
--
-- /See:/ 'newFinalHyperParameterTuningJobObjectiveMetric' smart constructor.
data FinalHyperParameterTuningJobObjectiveMetric = FinalHyperParameterTuningJobObjectiveMetric'
  { -- | Whether to minimize or maximize the objective metric. Valid values are
    -- Minimize and Maximize.
    FinalHyperParameterTuningJobObjectiveMetric
-> Maybe HyperParameterTuningJobObjectiveType
type' :: Prelude.Maybe HyperParameterTuningJobObjectiveType,
    -- | The name of the objective metric.
    FinalHyperParameterTuningJobObjectiveMetric -> Text
metricName :: Prelude.Text,
    -- | The value of the objective metric.
    FinalHyperParameterTuningJobObjectiveMetric -> Double
value :: Prelude.Double
  }
  deriving (FinalHyperParameterTuningJobObjectiveMetric
-> FinalHyperParameterTuningJobObjectiveMetric -> Bool
(FinalHyperParameterTuningJobObjectiveMetric
 -> FinalHyperParameterTuningJobObjectiveMetric -> Bool)
-> (FinalHyperParameterTuningJobObjectiveMetric
    -> FinalHyperParameterTuningJobObjectiveMetric -> Bool)
-> Eq FinalHyperParameterTuningJobObjectiveMetric
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FinalHyperParameterTuningJobObjectiveMetric
-> FinalHyperParameterTuningJobObjectiveMetric -> Bool
$c/= :: FinalHyperParameterTuningJobObjectiveMetric
-> FinalHyperParameterTuningJobObjectiveMetric -> Bool
== :: FinalHyperParameterTuningJobObjectiveMetric
-> FinalHyperParameterTuningJobObjectiveMetric -> Bool
$c== :: FinalHyperParameterTuningJobObjectiveMetric
-> FinalHyperParameterTuningJobObjectiveMetric -> Bool
Prelude.Eq, ReadPrec [FinalHyperParameterTuningJobObjectiveMetric]
ReadPrec FinalHyperParameterTuningJobObjectiveMetric
Int -> ReadS FinalHyperParameterTuningJobObjectiveMetric
ReadS [FinalHyperParameterTuningJobObjectiveMetric]
(Int -> ReadS FinalHyperParameterTuningJobObjectiveMetric)
-> ReadS [FinalHyperParameterTuningJobObjectiveMetric]
-> ReadPrec FinalHyperParameterTuningJobObjectiveMetric
-> ReadPrec [FinalHyperParameterTuningJobObjectiveMetric]
-> Read FinalHyperParameterTuningJobObjectiveMetric
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FinalHyperParameterTuningJobObjectiveMetric]
$creadListPrec :: ReadPrec [FinalHyperParameterTuningJobObjectiveMetric]
readPrec :: ReadPrec FinalHyperParameterTuningJobObjectiveMetric
$creadPrec :: ReadPrec FinalHyperParameterTuningJobObjectiveMetric
readList :: ReadS [FinalHyperParameterTuningJobObjectiveMetric]
$creadList :: ReadS [FinalHyperParameterTuningJobObjectiveMetric]
readsPrec :: Int -> ReadS FinalHyperParameterTuningJobObjectiveMetric
$creadsPrec :: Int -> ReadS FinalHyperParameterTuningJobObjectiveMetric
Prelude.Read, Int -> FinalHyperParameterTuningJobObjectiveMetric -> ShowS
[FinalHyperParameterTuningJobObjectiveMetric] -> ShowS
FinalHyperParameterTuningJobObjectiveMetric -> String
(Int -> FinalHyperParameterTuningJobObjectiveMetric -> ShowS)
-> (FinalHyperParameterTuningJobObjectiveMetric -> String)
-> ([FinalHyperParameterTuningJobObjectiveMetric] -> ShowS)
-> Show FinalHyperParameterTuningJobObjectiveMetric
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FinalHyperParameterTuningJobObjectiveMetric] -> ShowS
$cshowList :: [FinalHyperParameterTuningJobObjectiveMetric] -> ShowS
show :: FinalHyperParameterTuningJobObjectiveMetric -> String
$cshow :: FinalHyperParameterTuningJobObjectiveMetric -> String
showsPrec :: Int -> FinalHyperParameterTuningJobObjectiveMetric -> ShowS
$cshowsPrec :: Int -> FinalHyperParameterTuningJobObjectiveMetric -> ShowS
Prelude.Show, (forall x.
 FinalHyperParameterTuningJobObjectiveMetric
 -> Rep FinalHyperParameterTuningJobObjectiveMetric x)
-> (forall x.
    Rep FinalHyperParameterTuningJobObjectiveMetric x
    -> FinalHyperParameterTuningJobObjectiveMetric)
-> Generic FinalHyperParameterTuningJobObjectiveMetric
forall x.
Rep FinalHyperParameterTuningJobObjectiveMetric x
-> FinalHyperParameterTuningJobObjectiveMetric
forall x.
FinalHyperParameterTuningJobObjectiveMetric
-> Rep FinalHyperParameterTuningJobObjectiveMetric x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep FinalHyperParameterTuningJobObjectiveMetric x
-> FinalHyperParameterTuningJobObjectiveMetric
$cfrom :: forall x.
FinalHyperParameterTuningJobObjectiveMetric
-> Rep FinalHyperParameterTuningJobObjectiveMetric x
Prelude.Generic)

-- |
-- Create a value of 'FinalHyperParameterTuningJobObjectiveMetric' 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'', 'finalHyperParameterTuningJobObjectiveMetric_type' - Whether to minimize or maximize the objective metric. Valid values are
-- Minimize and Maximize.
--
-- 'metricName', 'finalHyperParameterTuningJobObjectiveMetric_metricName' - The name of the objective metric.
--
-- 'value', 'finalHyperParameterTuningJobObjectiveMetric_value' - The value of the objective metric.
newFinalHyperParameterTuningJobObjectiveMetric ::
  -- | 'metricName'
  Prelude.Text ->
  -- | 'value'
  Prelude.Double ->
  FinalHyperParameterTuningJobObjectiveMetric
newFinalHyperParameterTuningJobObjectiveMetric :: Text -> Double -> FinalHyperParameterTuningJobObjectiveMetric
newFinalHyperParameterTuningJobObjectiveMetric
  Text
pMetricName_
  Double
pValue_ =
    FinalHyperParameterTuningJobObjectiveMetric' :: Maybe HyperParameterTuningJobObjectiveType
-> Text -> Double -> FinalHyperParameterTuningJobObjectiveMetric
FinalHyperParameterTuningJobObjectiveMetric'
      { $sel:type':FinalHyperParameterTuningJobObjectiveMetric' :: Maybe HyperParameterTuningJobObjectiveType
type' =
          Maybe HyperParameterTuningJobObjectiveType
forall a. Maybe a
Prelude.Nothing,
        $sel:metricName:FinalHyperParameterTuningJobObjectiveMetric' :: Text
metricName = Text
pMetricName_,
        $sel:value:FinalHyperParameterTuningJobObjectiveMetric' :: Double
value = Double
pValue_
      }

-- | Whether to minimize or maximize the objective metric. Valid values are
-- Minimize and Maximize.
finalHyperParameterTuningJobObjectiveMetric_type :: Lens.Lens' FinalHyperParameterTuningJobObjectiveMetric (Prelude.Maybe HyperParameterTuningJobObjectiveType)
finalHyperParameterTuningJobObjectiveMetric_type :: (Maybe HyperParameterTuningJobObjectiveType
 -> f (Maybe HyperParameterTuningJobObjectiveType))
-> FinalHyperParameterTuningJobObjectiveMetric
-> f FinalHyperParameterTuningJobObjectiveMetric
finalHyperParameterTuningJobObjectiveMetric_type = (FinalHyperParameterTuningJobObjectiveMetric
 -> Maybe HyperParameterTuningJobObjectiveType)
-> (FinalHyperParameterTuningJobObjectiveMetric
    -> Maybe HyperParameterTuningJobObjectiveType
    -> FinalHyperParameterTuningJobObjectiveMetric)
-> Lens
     FinalHyperParameterTuningJobObjectiveMetric
     FinalHyperParameterTuningJobObjectiveMetric
     (Maybe HyperParameterTuningJobObjectiveType)
     (Maybe HyperParameterTuningJobObjectiveType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FinalHyperParameterTuningJobObjectiveMetric' {Maybe HyperParameterTuningJobObjectiveType
type' :: Maybe HyperParameterTuningJobObjectiveType
$sel:type':FinalHyperParameterTuningJobObjectiveMetric' :: FinalHyperParameterTuningJobObjectiveMetric
-> Maybe HyperParameterTuningJobObjectiveType
type'} -> Maybe HyperParameterTuningJobObjectiveType
type') (\s :: FinalHyperParameterTuningJobObjectiveMetric
s@FinalHyperParameterTuningJobObjectiveMetric' {} Maybe HyperParameterTuningJobObjectiveType
a -> FinalHyperParameterTuningJobObjectiveMetric
s {$sel:type':FinalHyperParameterTuningJobObjectiveMetric' :: Maybe HyperParameterTuningJobObjectiveType
type' = Maybe HyperParameterTuningJobObjectiveType
a} :: FinalHyperParameterTuningJobObjectiveMetric)

-- | The name of the objective metric.
finalHyperParameterTuningJobObjectiveMetric_metricName :: Lens.Lens' FinalHyperParameterTuningJobObjectiveMetric Prelude.Text
finalHyperParameterTuningJobObjectiveMetric_metricName :: (Text -> f Text)
-> FinalHyperParameterTuningJobObjectiveMetric
-> f FinalHyperParameterTuningJobObjectiveMetric
finalHyperParameterTuningJobObjectiveMetric_metricName = (FinalHyperParameterTuningJobObjectiveMetric -> Text)
-> (FinalHyperParameterTuningJobObjectiveMetric
    -> Text -> FinalHyperParameterTuningJobObjectiveMetric)
-> Lens
     FinalHyperParameterTuningJobObjectiveMetric
     FinalHyperParameterTuningJobObjectiveMetric
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FinalHyperParameterTuningJobObjectiveMetric' {Text
metricName :: Text
$sel:metricName:FinalHyperParameterTuningJobObjectiveMetric' :: FinalHyperParameterTuningJobObjectiveMetric -> Text
metricName} -> Text
metricName) (\s :: FinalHyperParameterTuningJobObjectiveMetric
s@FinalHyperParameterTuningJobObjectiveMetric' {} Text
a -> FinalHyperParameterTuningJobObjectiveMetric
s {$sel:metricName:FinalHyperParameterTuningJobObjectiveMetric' :: Text
metricName = Text
a} :: FinalHyperParameterTuningJobObjectiveMetric)

-- | The value of the objective metric.
finalHyperParameterTuningJobObjectiveMetric_value :: Lens.Lens' FinalHyperParameterTuningJobObjectiveMetric Prelude.Double
finalHyperParameterTuningJobObjectiveMetric_value :: (Double -> f Double)
-> FinalHyperParameterTuningJobObjectiveMetric
-> f FinalHyperParameterTuningJobObjectiveMetric
finalHyperParameterTuningJobObjectiveMetric_value = (FinalHyperParameterTuningJobObjectiveMetric -> Double)
-> (FinalHyperParameterTuningJobObjectiveMetric
    -> Double -> FinalHyperParameterTuningJobObjectiveMetric)
-> Lens
     FinalHyperParameterTuningJobObjectiveMetric
     FinalHyperParameterTuningJobObjectiveMetric
     Double
     Double
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FinalHyperParameterTuningJobObjectiveMetric' {Double
value :: Double
$sel:value:FinalHyperParameterTuningJobObjectiveMetric' :: FinalHyperParameterTuningJobObjectiveMetric -> Double
value} -> Double
value) (\s :: FinalHyperParameterTuningJobObjectiveMetric
s@FinalHyperParameterTuningJobObjectiveMetric' {} Double
a -> FinalHyperParameterTuningJobObjectiveMetric
s {$sel:value:FinalHyperParameterTuningJobObjectiveMetric' :: Double
value = Double
a} :: FinalHyperParameterTuningJobObjectiveMetric)

instance
  Core.FromJSON
    FinalHyperParameterTuningJobObjectiveMetric
  where
  parseJSON :: Value -> Parser FinalHyperParameterTuningJobObjectiveMetric
parseJSON =
    String
-> (Object -> Parser FinalHyperParameterTuningJobObjectiveMetric)
-> Value
-> Parser FinalHyperParameterTuningJobObjectiveMetric
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"FinalHyperParameterTuningJobObjectiveMetric"
      ( \Object
x ->
          Maybe HyperParameterTuningJobObjectiveType
-> Text -> Double -> FinalHyperParameterTuningJobObjectiveMetric
FinalHyperParameterTuningJobObjectiveMetric'
            (Maybe HyperParameterTuningJobObjectiveType
 -> Text -> Double -> FinalHyperParameterTuningJobObjectiveMetric)
-> Parser (Maybe HyperParameterTuningJobObjectiveType)
-> Parser
     (Text -> Double -> FinalHyperParameterTuningJobObjectiveMetric)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text -> Parser (Maybe HyperParameterTuningJobObjectiveType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Type")
              Parser
  (Text -> Double -> FinalHyperParameterTuningJobObjectiveMetric)
-> Parser Text
-> Parser (Double -> FinalHyperParameterTuningJobObjectiveMetric)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"MetricName")
              Parser (Double -> FinalHyperParameterTuningJobObjectiveMetric)
-> Parser Double
-> Parser FinalHyperParameterTuningJobObjectiveMetric
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
    FinalHyperParameterTuningJobObjectiveMetric

instance
  Prelude.NFData
    FinalHyperParameterTuningJobObjectiveMetric