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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Specifies the number of training jobs that this hyperparameter tuning
-- job launched, categorized by the status of their objective metric. The
-- objective metric status shows whether the final objective metric for the
-- training job has been evaluated by the tuning job and used in the
-- hyperparameter tuning process.
--
-- /See:/ 'newObjectiveStatusCounters' smart constructor.
data ObjectiveStatusCounters = ObjectiveStatusCounters'
  { -- | The number of training jobs that are in progress and pending evaluation
    -- of their final objective metric.
    ObjectiveStatusCounters -> Maybe Natural
pending :: Prelude.Maybe Prelude.Natural,
    -- | The number of training jobs whose final objective metric was evaluated
    -- by the hyperparameter tuning job and used in the hyperparameter tuning
    -- process.
    ObjectiveStatusCounters -> Maybe Natural
succeeded :: Prelude.Maybe Prelude.Natural,
    -- | The number of training jobs whose final objective metric was not
    -- evaluated and used in the hyperparameter tuning process. This typically
    -- occurs when the training job failed or did not emit an objective metric.
    ObjectiveStatusCounters -> Maybe Natural
failed :: Prelude.Maybe Prelude.Natural
  }
  deriving (ObjectiveStatusCounters -> ObjectiveStatusCounters -> Bool
(ObjectiveStatusCounters -> ObjectiveStatusCounters -> Bool)
-> (ObjectiveStatusCounters -> ObjectiveStatusCounters -> Bool)
-> Eq ObjectiveStatusCounters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ObjectiveStatusCounters -> ObjectiveStatusCounters -> Bool
$c/= :: ObjectiveStatusCounters -> ObjectiveStatusCounters -> Bool
== :: ObjectiveStatusCounters -> ObjectiveStatusCounters -> Bool
$c== :: ObjectiveStatusCounters -> ObjectiveStatusCounters -> Bool
Prelude.Eq, ReadPrec [ObjectiveStatusCounters]
ReadPrec ObjectiveStatusCounters
Int -> ReadS ObjectiveStatusCounters
ReadS [ObjectiveStatusCounters]
(Int -> ReadS ObjectiveStatusCounters)
-> ReadS [ObjectiveStatusCounters]
-> ReadPrec ObjectiveStatusCounters
-> ReadPrec [ObjectiveStatusCounters]
-> Read ObjectiveStatusCounters
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ObjectiveStatusCounters]
$creadListPrec :: ReadPrec [ObjectiveStatusCounters]
readPrec :: ReadPrec ObjectiveStatusCounters
$creadPrec :: ReadPrec ObjectiveStatusCounters
readList :: ReadS [ObjectiveStatusCounters]
$creadList :: ReadS [ObjectiveStatusCounters]
readsPrec :: Int -> ReadS ObjectiveStatusCounters
$creadsPrec :: Int -> ReadS ObjectiveStatusCounters
Prelude.Read, Int -> ObjectiveStatusCounters -> ShowS
[ObjectiveStatusCounters] -> ShowS
ObjectiveStatusCounters -> String
(Int -> ObjectiveStatusCounters -> ShowS)
-> (ObjectiveStatusCounters -> String)
-> ([ObjectiveStatusCounters] -> ShowS)
-> Show ObjectiveStatusCounters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ObjectiveStatusCounters] -> ShowS
$cshowList :: [ObjectiveStatusCounters] -> ShowS
show :: ObjectiveStatusCounters -> String
$cshow :: ObjectiveStatusCounters -> String
showsPrec :: Int -> ObjectiveStatusCounters -> ShowS
$cshowsPrec :: Int -> ObjectiveStatusCounters -> ShowS
Prelude.Show, (forall x.
 ObjectiveStatusCounters -> Rep ObjectiveStatusCounters x)
-> (forall x.
    Rep ObjectiveStatusCounters x -> ObjectiveStatusCounters)
-> Generic ObjectiveStatusCounters
forall x. Rep ObjectiveStatusCounters x -> ObjectiveStatusCounters
forall x. ObjectiveStatusCounters -> Rep ObjectiveStatusCounters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ObjectiveStatusCounters x -> ObjectiveStatusCounters
$cfrom :: forall x. ObjectiveStatusCounters -> Rep ObjectiveStatusCounters x
Prelude.Generic)

-- |
-- Create a value of 'ObjectiveStatusCounters' 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:
--
-- 'pending', 'objectiveStatusCounters_pending' - The number of training jobs that are in progress and pending evaluation
-- of their final objective metric.
--
-- 'succeeded', 'objectiveStatusCounters_succeeded' - The number of training jobs whose final objective metric was evaluated
-- by the hyperparameter tuning job and used in the hyperparameter tuning
-- process.
--
-- 'failed', 'objectiveStatusCounters_failed' - The number of training jobs whose final objective metric was not
-- evaluated and used in the hyperparameter tuning process. This typically
-- occurs when the training job failed or did not emit an objective metric.
newObjectiveStatusCounters ::
  ObjectiveStatusCounters
newObjectiveStatusCounters :: ObjectiveStatusCounters
newObjectiveStatusCounters =
  ObjectiveStatusCounters' :: Maybe Natural
-> Maybe Natural -> Maybe Natural -> ObjectiveStatusCounters
ObjectiveStatusCounters'
    { $sel:pending:ObjectiveStatusCounters' :: Maybe Natural
pending = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:succeeded:ObjectiveStatusCounters' :: Maybe Natural
succeeded = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:failed:ObjectiveStatusCounters' :: Maybe Natural
failed = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The number of training jobs that are in progress and pending evaluation
-- of their final objective metric.
objectiveStatusCounters_pending :: Lens.Lens' ObjectiveStatusCounters (Prelude.Maybe Prelude.Natural)
objectiveStatusCounters_pending :: (Maybe Natural -> f (Maybe Natural))
-> ObjectiveStatusCounters -> f ObjectiveStatusCounters
objectiveStatusCounters_pending = (ObjectiveStatusCounters -> Maybe Natural)
-> (ObjectiveStatusCounters
    -> Maybe Natural -> ObjectiveStatusCounters)
-> Lens
     ObjectiveStatusCounters
     ObjectiveStatusCounters
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ObjectiveStatusCounters' {Maybe Natural
pending :: Maybe Natural
$sel:pending:ObjectiveStatusCounters' :: ObjectiveStatusCounters -> Maybe Natural
pending} -> Maybe Natural
pending) (\s :: ObjectiveStatusCounters
s@ObjectiveStatusCounters' {} Maybe Natural
a -> ObjectiveStatusCounters
s {$sel:pending:ObjectiveStatusCounters' :: Maybe Natural
pending = Maybe Natural
a} :: ObjectiveStatusCounters)

-- | The number of training jobs whose final objective metric was evaluated
-- by the hyperparameter tuning job and used in the hyperparameter tuning
-- process.
objectiveStatusCounters_succeeded :: Lens.Lens' ObjectiveStatusCounters (Prelude.Maybe Prelude.Natural)
objectiveStatusCounters_succeeded :: (Maybe Natural -> f (Maybe Natural))
-> ObjectiveStatusCounters -> f ObjectiveStatusCounters
objectiveStatusCounters_succeeded = (ObjectiveStatusCounters -> Maybe Natural)
-> (ObjectiveStatusCounters
    -> Maybe Natural -> ObjectiveStatusCounters)
-> Lens
     ObjectiveStatusCounters
     ObjectiveStatusCounters
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ObjectiveStatusCounters' {Maybe Natural
succeeded :: Maybe Natural
$sel:succeeded:ObjectiveStatusCounters' :: ObjectiveStatusCounters -> Maybe Natural
succeeded} -> Maybe Natural
succeeded) (\s :: ObjectiveStatusCounters
s@ObjectiveStatusCounters' {} Maybe Natural
a -> ObjectiveStatusCounters
s {$sel:succeeded:ObjectiveStatusCounters' :: Maybe Natural
succeeded = Maybe Natural
a} :: ObjectiveStatusCounters)

-- | The number of training jobs whose final objective metric was not
-- evaluated and used in the hyperparameter tuning process. This typically
-- occurs when the training job failed or did not emit an objective metric.
objectiveStatusCounters_failed :: Lens.Lens' ObjectiveStatusCounters (Prelude.Maybe Prelude.Natural)
objectiveStatusCounters_failed :: (Maybe Natural -> f (Maybe Natural))
-> ObjectiveStatusCounters -> f ObjectiveStatusCounters
objectiveStatusCounters_failed = (ObjectiveStatusCounters -> Maybe Natural)
-> (ObjectiveStatusCounters
    -> Maybe Natural -> ObjectiveStatusCounters)
-> Lens
     ObjectiveStatusCounters
     ObjectiveStatusCounters
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ObjectiveStatusCounters' {Maybe Natural
failed :: Maybe Natural
$sel:failed:ObjectiveStatusCounters' :: ObjectiveStatusCounters -> Maybe Natural
failed} -> Maybe Natural
failed) (\s :: ObjectiveStatusCounters
s@ObjectiveStatusCounters' {} Maybe Natural
a -> ObjectiveStatusCounters
s {$sel:failed:ObjectiveStatusCounters' :: Maybe Natural
failed = Maybe Natural
a} :: ObjectiveStatusCounters)

instance Core.FromJSON ObjectiveStatusCounters where
  parseJSON :: Value -> Parser ObjectiveStatusCounters
parseJSON =
    String
-> (Object -> Parser ObjectiveStatusCounters)
-> Value
-> Parser ObjectiveStatusCounters
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ObjectiveStatusCounters"
      ( \Object
x ->
          Maybe Natural
-> Maybe Natural -> Maybe Natural -> ObjectiveStatusCounters
ObjectiveStatusCounters'
            (Maybe Natural
 -> Maybe Natural -> Maybe Natural -> ObjectiveStatusCounters)
-> Parser (Maybe Natural)
-> Parser
     (Maybe Natural -> Maybe Natural -> ObjectiveStatusCounters)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Pending")
            Parser (Maybe Natural -> Maybe Natural -> ObjectiveStatusCounters)
-> Parser (Maybe Natural)
-> Parser (Maybe Natural -> ObjectiveStatusCounters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Succeeded")
            Parser (Maybe Natural -> ObjectiveStatusCounters)
-> Parser (Maybe Natural) -> Parser ObjectiveStatusCounters
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Failed")
      )

instance Prelude.Hashable ObjectiveStatusCounters

instance Prelude.NFData ObjectiveStatusCounters