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

-- | 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 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,
    -- | 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
  }
  deriving (ObjectiveStatusCounters -> ObjectiveStatusCounters -> Bool
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]
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
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. 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:
--
-- '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.
--
-- '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.
newObjectiveStatusCounters ::
  ObjectiveStatusCounters
newObjectiveStatusCounters :: ObjectiveStatusCounters
newObjectiveStatusCounters =
  ObjectiveStatusCounters'
    { $sel:failed:ObjectiveStatusCounters' :: Maybe Natural
failed = forall a. Maybe a
Prelude.Nothing,
      $sel:pending:ObjectiveStatusCounters' :: Maybe Natural
pending = forall a. Maybe a
Prelude.Nothing,
      $sel:succeeded:ObjectiveStatusCounters' :: Maybe Natural
succeeded = forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: Lens' ObjectiveStatusCounters (Maybe Natural)
objectiveStatusCounters_failed = 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)

-- | 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 :: Lens' ObjectiveStatusCounters (Maybe Natural)
objectiveStatusCounters_pending = 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 :: Lens' ObjectiveStatusCounters (Maybe Natural)
objectiveStatusCounters_succeeded = 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)

instance Data.FromJSON ObjectiveStatusCounters where
  parseJSON :: Value -> Parser ObjectiveStatusCounters
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ObjectiveStatusCounters"
      ( \Object
x ->
          Maybe Natural
-> Maybe Natural -> Maybe Natural -> ObjectiveStatusCounters
ObjectiveStatusCounters'
            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
"Failed")
            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
"Pending")
            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
"Succeeded")
      )

instance Prelude.Hashable ObjectiveStatusCounters where
  hashWithSalt :: Int -> ObjectiveStatusCounters -> Int
hashWithSalt Int
_salt ObjectiveStatusCounters' {Maybe Natural
succeeded :: Maybe Natural
pending :: Maybe Natural
failed :: Maybe Natural
$sel:succeeded:ObjectiveStatusCounters' :: ObjectiveStatusCounters -> Maybe Natural
$sel:pending:ObjectiveStatusCounters' :: ObjectiveStatusCounters -> Maybe Natural
$sel:failed:ObjectiveStatusCounters' :: ObjectiveStatusCounters -> Maybe Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
failed
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
pending
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
succeeded

instance Prelude.NFData ObjectiveStatusCounters where
  rnf :: ObjectiveStatusCounters -> ()
rnf ObjectiveStatusCounters' {Maybe Natural
succeeded :: Maybe Natural
pending :: Maybe Natural
failed :: Maybe Natural
$sel:succeeded:ObjectiveStatusCounters' :: ObjectiveStatusCounters -> Maybe Natural
$sel:pending:ObjectiveStatusCounters' :: ObjectiveStatusCounters -> Maybe Natural
$sel:failed:ObjectiveStatusCounters' :: ObjectiveStatusCounters -> Maybe Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
failed
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
pending
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
succeeded