{-# 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.TrialComponentMetricSummary
-- 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.TrialComponentMetricSummary 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

-- | A summary of the metrics of a trial component.
--
-- /See:/ 'newTrialComponentMetricSummary' smart constructor.
data TrialComponentMetricSummary = TrialComponentMetricSummary'
  { -- | The average value of the metric.
    TrialComponentMetricSummary -> Maybe Double
avg :: Prelude.Maybe Prelude.Double,
    -- | The number of samples used to generate the metric.
    TrialComponentMetricSummary -> Maybe Int
count :: Prelude.Maybe Prelude.Int,
    -- | The most recent value of the metric.
    TrialComponentMetricSummary -> Maybe Double
last :: Prelude.Maybe Prelude.Double,
    -- | The maximum value of the metric.
    TrialComponentMetricSummary -> Maybe Double
max :: Prelude.Maybe Prelude.Double,
    -- | The name of the metric.
    TrialComponentMetricSummary -> Maybe Text
metricName :: Prelude.Maybe Prelude.Text,
    -- | The minimum value of the metric.
    TrialComponentMetricSummary -> Maybe Double
min :: Prelude.Maybe Prelude.Double,
    -- | The Amazon Resource Name (ARN) of the source.
    TrialComponentMetricSummary -> Maybe Text
sourceArn :: Prelude.Maybe Prelude.Text,
    -- | The standard deviation of the metric.
    TrialComponentMetricSummary -> Maybe Double
stdDev :: Prelude.Maybe Prelude.Double,
    -- | When the metric was last updated.
    TrialComponentMetricSummary -> Maybe POSIX
timeStamp :: Prelude.Maybe Data.POSIX
  }
  deriving (TrialComponentMetricSummary -> TrialComponentMetricSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TrialComponentMetricSummary -> TrialComponentMetricSummary -> Bool
$c/= :: TrialComponentMetricSummary -> TrialComponentMetricSummary -> Bool
== :: TrialComponentMetricSummary -> TrialComponentMetricSummary -> Bool
$c== :: TrialComponentMetricSummary -> TrialComponentMetricSummary -> Bool
Prelude.Eq, ReadPrec [TrialComponentMetricSummary]
ReadPrec TrialComponentMetricSummary
Int -> ReadS TrialComponentMetricSummary
ReadS [TrialComponentMetricSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TrialComponentMetricSummary]
$creadListPrec :: ReadPrec [TrialComponentMetricSummary]
readPrec :: ReadPrec TrialComponentMetricSummary
$creadPrec :: ReadPrec TrialComponentMetricSummary
readList :: ReadS [TrialComponentMetricSummary]
$creadList :: ReadS [TrialComponentMetricSummary]
readsPrec :: Int -> ReadS TrialComponentMetricSummary
$creadsPrec :: Int -> ReadS TrialComponentMetricSummary
Prelude.Read, Int -> TrialComponentMetricSummary -> ShowS
[TrialComponentMetricSummary] -> ShowS
TrialComponentMetricSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TrialComponentMetricSummary] -> ShowS
$cshowList :: [TrialComponentMetricSummary] -> ShowS
show :: TrialComponentMetricSummary -> String
$cshow :: TrialComponentMetricSummary -> String
showsPrec :: Int -> TrialComponentMetricSummary -> ShowS
$cshowsPrec :: Int -> TrialComponentMetricSummary -> ShowS
Prelude.Show, forall x.
Rep TrialComponentMetricSummary x -> TrialComponentMetricSummary
forall x.
TrialComponentMetricSummary -> Rep TrialComponentMetricSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TrialComponentMetricSummary x -> TrialComponentMetricSummary
$cfrom :: forall x.
TrialComponentMetricSummary -> Rep TrialComponentMetricSummary x
Prelude.Generic)

-- |
-- Create a value of 'TrialComponentMetricSummary' 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:
--
-- 'avg', 'trialComponentMetricSummary_avg' - The average value of the metric.
--
-- 'count', 'trialComponentMetricSummary_count' - The number of samples used to generate the metric.
--
-- 'last', 'trialComponentMetricSummary_last' - The most recent value of the metric.
--
-- 'max', 'trialComponentMetricSummary_max' - The maximum value of the metric.
--
-- 'metricName', 'trialComponentMetricSummary_metricName' - The name of the metric.
--
-- 'min', 'trialComponentMetricSummary_min' - The minimum value of the metric.
--
-- 'sourceArn', 'trialComponentMetricSummary_sourceArn' - The Amazon Resource Name (ARN) of the source.
--
-- 'stdDev', 'trialComponentMetricSummary_stdDev' - The standard deviation of the metric.
--
-- 'timeStamp', 'trialComponentMetricSummary_timeStamp' - When the metric was last updated.
newTrialComponentMetricSummary ::
  TrialComponentMetricSummary
newTrialComponentMetricSummary :: TrialComponentMetricSummary
newTrialComponentMetricSummary =
  TrialComponentMetricSummary'
    { $sel:avg:TrialComponentMetricSummary' :: Maybe Double
avg = forall a. Maybe a
Prelude.Nothing,
      $sel:count:TrialComponentMetricSummary' :: Maybe Int
count = forall a. Maybe a
Prelude.Nothing,
      $sel:last:TrialComponentMetricSummary' :: Maybe Double
last = forall a. Maybe a
Prelude.Nothing,
      $sel:max:TrialComponentMetricSummary' :: Maybe Double
max = forall a. Maybe a
Prelude.Nothing,
      $sel:metricName:TrialComponentMetricSummary' :: Maybe Text
metricName = forall a. Maybe a
Prelude.Nothing,
      $sel:min:TrialComponentMetricSummary' :: Maybe Double
min = forall a. Maybe a
Prelude.Nothing,
      $sel:sourceArn:TrialComponentMetricSummary' :: Maybe Text
sourceArn = forall a. Maybe a
Prelude.Nothing,
      $sel:stdDev:TrialComponentMetricSummary' :: Maybe Double
stdDev = forall a. Maybe a
Prelude.Nothing,
      $sel:timeStamp:TrialComponentMetricSummary' :: Maybe POSIX
timeStamp = forall a. Maybe a
Prelude.Nothing
    }

-- | The average value of the metric.
trialComponentMetricSummary_avg :: Lens.Lens' TrialComponentMetricSummary (Prelude.Maybe Prelude.Double)
trialComponentMetricSummary_avg :: Lens' TrialComponentMetricSummary (Maybe Double)
trialComponentMetricSummary_avg = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrialComponentMetricSummary' {Maybe Double
avg :: Maybe Double
$sel:avg:TrialComponentMetricSummary' :: TrialComponentMetricSummary -> Maybe Double
avg} -> Maybe Double
avg) (\s :: TrialComponentMetricSummary
s@TrialComponentMetricSummary' {} Maybe Double
a -> TrialComponentMetricSummary
s {$sel:avg:TrialComponentMetricSummary' :: Maybe Double
avg = Maybe Double
a} :: TrialComponentMetricSummary)

-- | The number of samples used to generate the metric.
trialComponentMetricSummary_count :: Lens.Lens' TrialComponentMetricSummary (Prelude.Maybe Prelude.Int)
trialComponentMetricSummary_count :: Lens' TrialComponentMetricSummary (Maybe Int)
trialComponentMetricSummary_count = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrialComponentMetricSummary' {Maybe Int
count :: Maybe Int
$sel:count:TrialComponentMetricSummary' :: TrialComponentMetricSummary -> Maybe Int
count} -> Maybe Int
count) (\s :: TrialComponentMetricSummary
s@TrialComponentMetricSummary' {} Maybe Int
a -> TrialComponentMetricSummary
s {$sel:count:TrialComponentMetricSummary' :: Maybe Int
count = Maybe Int
a} :: TrialComponentMetricSummary)

-- | The most recent value of the metric.
trialComponentMetricSummary_last :: Lens.Lens' TrialComponentMetricSummary (Prelude.Maybe Prelude.Double)
trialComponentMetricSummary_last :: Lens' TrialComponentMetricSummary (Maybe Double)
trialComponentMetricSummary_last = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrialComponentMetricSummary' {Maybe Double
last :: Maybe Double
$sel:last:TrialComponentMetricSummary' :: TrialComponentMetricSummary -> Maybe Double
last} -> Maybe Double
last) (\s :: TrialComponentMetricSummary
s@TrialComponentMetricSummary' {} Maybe Double
a -> TrialComponentMetricSummary
s {$sel:last:TrialComponentMetricSummary' :: Maybe Double
last = Maybe Double
a} :: TrialComponentMetricSummary)

-- | The maximum value of the metric.
trialComponentMetricSummary_max :: Lens.Lens' TrialComponentMetricSummary (Prelude.Maybe Prelude.Double)
trialComponentMetricSummary_max :: Lens' TrialComponentMetricSummary (Maybe Double)
trialComponentMetricSummary_max = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrialComponentMetricSummary' {Maybe Double
max :: Maybe Double
$sel:max:TrialComponentMetricSummary' :: TrialComponentMetricSummary -> Maybe Double
max} -> Maybe Double
max) (\s :: TrialComponentMetricSummary
s@TrialComponentMetricSummary' {} Maybe Double
a -> TrialComponentMetricSummary
s {$sel:max:TrialComponentMetricSummary' :: Maybe Double
max = Maybe Double
a} :: TrialComponentMetricSummary)

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

-- | The minimum value of the metric.
trialComponentMetricSummary_min :: Lens.Lens' TrialComponentMetricSummary (Prelude.Maybe Prelude.Double)
trialComponentMetricSummary_min :: Lens' TrialComponentMetricSummary (Maybe Double)
trialComponentMetricSummary_min = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrialComponentMetricSummary' {Maybe Double
min :: Maybe Double
$sel:min:TrialComponentMetricSummary' :: TrialComponentMetricSummary -> Maybe Double
min} -> Maybe Double
min) (\s :: TrialComponentMetricSummary
s@TrialComponentMetricSummary' {} Maybe Double
a -> TrialComponentMetricSummary
s {$sel:min:TrialComponentMetricSummary' :: Maybe Double
min = Maybe Double
a} :: TrialComponentMetricSummary)

-- | The Amazon Resource Name (ARN) of the source.
trialComponentMetricSummary_sourceArn :: Lens.Lens' TrialComponentMetricSummary (Prelude.Maybe Prelude.Text)
trialComponentMetricSummary_sourceArn :: Lens' TrialComponentMetricSummary (Maybe Text)
trialComponentMetricSummary_sourceArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrialComponentMetricSummary' {Maybe Text
sourceArn :: Maybe Text
$sel:sourceArn:TrialComponentMetricSummary' :: TrialComponentMetricSummary -> Maybe Text
sourceArn} -> Maybe Text
sourceArn) (\s :: TrialComponentMetricSummary
s@TrialComponentMetricSummary' {} Maybe Text
a -> TrialComponentMetricSummary
s {$sel:sourceArn:TrialComponentMetricSummary' :: Maybe Text
sourceArn = Maybe Text
a} :: TrialComponentMetricSummary)

-- | The standard deviation of the metric.
trialComponentMetricSummary_stdDev :: Lens.Lens' TrialComponentMetricSummary (Prelude.Maybe Prelude.Double)
trialComponentMetricSummary_stdDev :: Lens' TrialComponentMetricSummary (Maybe Double)
trialComponentMetricSummary_stdDev = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrialComponentMetricSummary' {Maybe Double
stdDev :: Maybe Double
$sel:stdDev:TrialComponentMetricSummary' :: TrialComponentMetricSummary -> Maybe Double
stdDev} -> Maybe Double
stdDev) (\s :: TrialComponentMetricSummary
s@TrialComponentMetricSummary' {} Maybe Double
a -> TrialComponentMetricSummary
s {$sel:stdDev:TrialComponentMetricSummary' :: Maybe Double
stdDev = Maybe Double
a} :: TrialComponentMetricSummary)

-- | When the metric was last updated.
trialComponentMetricSummary_timeStamp :: Lens.Lens' TrialComponentMetricSummary (Prelude.Maybe Prelude.UTCTime)
trialComponentMetricSummary_timeStamp :: Lens' TrialComponentMetricSummary (Maybe UTCTime)
trialComponentMetricSummary_timeStamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrialComponentMetricSummary' {Maybe POSIX
timeStamp :: Maybe POSIX
$sel:timeStamp:TrialComponentMetricSummary' :: TrialComponentMetricSummary -> Maybe POSIX
timeStamp} -> Maybe POSIX
timeStamp) (\s :: TrialComponentMetricSummary
s@TrialComponentMetricSummary' {} Maybe POSIX
a -> TrialComponentMetricSummary
s {$sel:timeStamp:TrialComponentMetricSummary' :: Maybe POSIX
timeStamp = Maybe POSIX
a} :: TrialComponentMetricSummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance Data.FromJSON TrialComponentMetricSummary where
  parseJSON :: Value -> Parser TrialComponentMetricSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TrialComponentMetricSummary"
      ( \Object
x ->
          Maybe Double
-> Maybe Int
-> Maybe Double
-> Maybe Double
-> Maybe Text
-> Maybe Double
-> Maybe Text
-> Maybe Double
-> Maybe POSIX
-> TrialComponentMetricSummary
TrialComponentMetricSummary'
            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
"Avg")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Count")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Last")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Max")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe 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 (Maybe a)
Data..:? Key
"Min")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"SourceArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"StdDev")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"TimeStamp")
      )

instance Prelude.Hashable TrialComponentMetricSummary where
  hashWithSalt :: Int -> TrialComponentMetricSummary -> Int
hashWithSalt Int
_salt TrialComponentMetricSummary' {Maybe Double
Maybe Int
Maybe Text
Maybe POSIX
timeStamp :: Maybe POSIX
stdDev :: Maybe Double
sourceArn :: Maybe Text
min :: Maybe Double
metricName :: Maybe Text
max :: Maybe Double
last :: Maybe Double
count :: Maybe Int
avg :: Maybe Double
$sel:timeStamp:TrialComponentMetricSummary' :: TrialComponentMetricSummary -> Maybe POSIX
$sel:stdDev:TrialComponentMetricSummary' :: TrialComponentMetricSummary -> Maybe Double
$sel:sourceArn:TrialComponentMetricSummary' :: TrialComponentMetricSummary -> Maybe Text
$sel:min:TrialComponentMetricSummary' :: TrialComponentMetricSummary -> Maybe Double
$sel:metricName:TrialComponentMetricSummary' :: TrialComponentMetricSummary -> Maybe Text
$sel:max:TrialComponentMetricSummary' :: TrialComponentMetricSummary -> Maybe Double
$sel:last:TrialComponentMetricSummary' :: TrialComponentMetricSummary -> Maybe Double
$sel:count:TrialComponentMetricSummary' :: TrialComponentMetricSummary -> Maybe Int
$sel:avg:TrialComponentMetricSummary' :: TrialComponentMetricSummary -> Maybe Double
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
avg
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
count
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
last
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
max
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
metricName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
min
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sourceArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
stdDev
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
timeStamp

instance Prelude.NFData TrialComponentMetricSummary where
  rnf :: TrialComponentMetricSummary -> ()
rnf TrialComponentMetricSummary' {Maybe Double
Maybe Int
Maybe Text
Maybe POSIX
timeStamp :: Maybe POSIX
stdDev :: Maybe Double
sourceArn :: Maybe Text
min :: Maybe Double
metricName :: Maybe Text
max :: Maybe Double
last :: Maybe Double
count :: Maybe Int
avg :: Maybe Double
$sel:timeStamp:TrialComponentMetricSummary' :: TrialComponentMetricSummary -> Maybe POSIX
$sel:stdDev:TrialComponentMetricSummary' :: TrialComponentMetricSummary -> Maybe Double
$sel:sourceArn:TrialComponentMetricSummary' :: TrialComponentMetricSummary -> Maybe Text
$sel:min:TrialComponentMetricSummary' :: TrialComponentMetricSummary -> Maybe Double
$sel:metricName:TrialComponentMetricSummary' :: TrialComponentMetricSummary -> Maybe Text
$sel:max:TrialComponentMetricSummary' :: TrialComponentMetricSummary -> Maybe Double
$sel:last:TrialComponentMetricSummary' :: TrialComponentMetricSummary -> Maybe Double
$sel:count:TrialComponentMetricSummary' :: TrialComponentMetricSummary -> Maybe Int
$sel:avg:TrialComponentMetricSummary' :: TrialComponentMetricSummary -> Maybe Double
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
avg
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
count
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
last
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
max
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
metricName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
min
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sourceArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
stdDev
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
timeStamp