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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMaker.Types.HyperParameterTuningJobObjective
import Amazonka.SageMaker.Types.HyperParameterTuningJobStrategyType
import Amazonka.SageMaker.Types.ParameterRanges
import Amazonka.SageMaker.Types.ResourceLimits
import Amazonka.SageMaker.Types.TrainingJobEarlyStoppingType
import Amazonka.SageMaker.Types.TuningJobCompletionCriteria

-- | Configures a hyperparameter tuning job.
--
-- /See:/ 'newHyperParameterTuningJobConfig' smart constructor.
data HyperParameterTuningJobConfig = HyperParameterTuningJobConfig'
  { -- | The tuning job\'s completion criteria.
    HyperParameterTuningJobConfig -> Maybe TuningJobCompletionCriteria
tuningJobCompletionCriteria :: Prelude.Maybe TuningJobCompletionCriteria,
    -- | The ParameterRanges object that specifies the ranges of hyperparameters
    -- that this tuning job searches.
    HyperParameterTuningJobConfig -> Maybe ParameterRanges
parameterRanges :: Prelude.Maybe ParameterRanges,
    -- | The HyperParameterTuningJobObjective object that specifies the objective
    -- metric for this tuning job.
    HyperParameterTuningJobConfig
-> Maybe HyperParameterTuningJobObjective
hyperParameterTuningJobObjective :: Prelude.Maybe HyperParameterTuningJobObjective,
    -- | Specifies whether to use early stopping for training jobs launched by
    -- the hyperparameter tuning job. This can be one of the following values
    -- (the default value is @OFF@):
    --
    -- [OFF]
    --     Training jobs launched by the hyperparameter tuning job do not use
    --     early stopping.
    --
    -- [AUTO]
    --     Amazon SageMaker stops training jobs launched by the hyperparameter
    --     tuning job when they are unlikely to perform better than previously
    --     completed training jobs. For more information, see
    --     <https://docs.aws.amazon.com/sagemaker/latest/dg/automatic-model-tuning-early-stopping.html Stop Training Jobs Early>.
    HyperParameterTuningJobConfig -> Maybe TrainingJobEarlyStoppingType
trainingJobEarlyStoppingType :: Prelude.Maybe TrainingJobEarlyStoppingType,
    -- | Specifies how hyperparameter tuning chooses the combinations of
    -- hyperparameter values to use for the training job it launches. To use
    -- the Bayesian search strategy, set this to @Bayesian@. To randomly
    -- search, set it to @Random@. For information about search strategies, see
    -- <https://docs.aws.amazon.com/sagemaker/latest/dg/automatic-model-tuning-how-it-works.html How Hyperparameter Tuning Works>.
    HyperParameterTuningJobConfig
-> HyperParameterTuningJobStrategyType
strategy :: HyperParameterTuningJobStrategyType,
    -- | The ResourceLimits object that specifies the maximum number of training
    -- jobs and parallel training jobs for this tuning job.
    HyperParameterTuningJobConfig -> ResourceLimits
resourceLimits :: ResourceLimits
  }
  deriving (HyperParameterTuningJobConfig
-> HyperParameterTuningJobConfig -> Bool
(HyperParameterTuningJobConfig
 -> HyperParameterTuningJobConfig -> Bool)
-> (HyperParameterTuningJobConfig
    -> HyperParameterTuningJobConfig -> Bool)
-> Eq HyperParameterTuningJobConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HyperParameterTuningJobConfig
-> HyperParameterTuningJobConfig -> Bool
$c/= :: HyperParameterTuningJobConfig
-> HyperParameterTuningJobConfig -> Bool
== :: HyperParameterTuningJobConfig
-> HyperParameterTuningJobConfig -> Bool
$c== :: HyperParameterTuningJobConfig
-> HyperParameterTuningJobConfig -> Bool
Prelude.Eq, ReadPrec [HyperParameterTuningJobConfig]
ReadPrec HyperParameterTuningJobConfig
Int -> ReadS HyperParameterTuningJobConfig
ReadS [HyperParameterTuningJobConfig]
(Int -> ReadS HyperParameterTuningJobConfig)
-> ReadS [HyperParameterTuningJobConfig]
-> ReadPrec HyperParameterTuningJobConfig
-> ReadPrec [HyperParameterTuningJobConfig]
-> Read HyperParameterTuningJobConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HyperParameterTuningJobConfig]
$creadListPrec :: ReadPrec [HyperParameterTuningJobConfig]
readPrec :: ReadPrec HyperParameterTuningJobConfig
$creadPrec :: ReadPrec HyperParameterTuningJobConfig
readList :: ReadS [HyperParameterTuningJobConfig]
$creadList :: ReadS [HyperParameterTuningJobConfig]
readsPrec :: Int -> ReadS HyperParameterTuningJobConfig
$creadsPrec :: Int -> ReadS HyperParameterTuningJobConfig
Prelude.Read, Int -> HyperParameterTuningJobConfig -> ShowS
[HyperParameterTuningJobConfig] -> ShowS
HyperParameterTuningJobConfig -> String
(Int -> HyperParameterTuningJobConfig -> ShowS)
-> (HyperParameterTuningJobConfig -> String)
-> ([HyperParameterTuningJobConfig] -> ShowS)
-> Show HyperParameterTuningJobConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HyperParameterTuningJobConfig] -> ShowS
$cshowList :: [HyperParameterTuningJobConfig] -> ShowS
show :: HyperParameterTuningJobConfig -> String
$cshow :: HyperParameterTuningJobConfig -> String
showsPrec :: Int -> HyperParameterTuningJobConfig -> ShowS
$cshowsPrec :: Int -> HyperParameterTuningJobConfig -> ShowS
Prelude.Show, (forall x.
 HyperParameterTuningJobConfig
 -> Rep HyperParameterTuningJobConfig x)
-> (forall x.
    Rep HyperParameterTuningJobConfig x
    -> HyperParameterTuningJobConfig)
-> Generic HyperParameterTuningJobConfig
forall x.
Rep HyperParameterTuningJobConfig x
-> HyperParameterTuningJobConfig
forall x.
HyperParameterTuningJobConfig
-> Rep HyperParameterTuningJobConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep HyperParameterTuningJobConfig x
-> HyperParameterTuningJobConfig
$cfrom :: forall x.
HyperParameterTuningJobConfig
-> Rep HyperParameterTuningJobConfig x
Prelude.Generic)

-- |
-- Create a value of 'HyperParameterTuningJobConfig' 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:
--
-- 'tuningJobCompletionCriteria', 'hyperParameterTuningJobConfig_tuningJobCompletionCriteria' - The tuning job\'s completion criteria.
--
-- 'parameterRanges', 'hyperParameterTuningJobConfig_parameterRanges' - The ParameterRanges object that specifies the ranges of hyperparameters
-- that this tuning job searches.
--
-- 'hyperParameterTuningJobObjective', 'hyperParameterTuningJobConfig_hyperParameterTuningJobObjective' - The HyperParameterTuningJobObjective object that specifies the objective
-- metric for this tuning job.
--
-- 'trainingJobEarlyStoppingType', 'hyperParameterTuningJobConfig_trainingJobEarlyStoppingType' - Specifies whether to use early stopping for training jobs launched by
-- the hyperparameter tuning job. This can be one of the following values
-- (the default value is @OFF@):
--
-- [OFF]
--     Training jobs launched by the hyperparameter tuning job do not use
--     early stopping.
--
-- [AUTO]
--     Amazon SageMaker stops training jobs launched by the hyperparameter
--     tuning job when they are unlikely to perform better than previously
--     completed training jobs. For more information, see
--     <https://docs.aws.amazon.com/sagemaker/latest/dg/automatic-model-tuning-early-stopping.html Stop Training Jobs Early>.
--
-- 'strategy', 'hyperParameterTuningJobConfig_strategy' - Specifies how hyperparameter tuning chooses the combinations of
-- hyperparameter values to use for the training job it launches. To use
-- the Bayesian search strategy, set this to @Bayesian@. To randomly
-- search, set it to @Random@. For information about search strategies, see
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/automatic-model-tuning-how-it-works.html How Hyperparameter Tuning Works>.
--
-- 'resourceLimits', 'hyperParameterTuningJobConfig_resourceLimits' - The ResourceLimits object that specifies the maximum number of training
-- jobs and parallel training jobs for this tuning job.
newHyperParameterTuningJobConfig ::
  -- | 'strategy'
  HyperParameterTuningJobStrategyType ->
  -- | 'resourceLimits'
  ResourceLimits ->
  HyperParameterTuningJobConfig
newHyperParameterTuningJobConfig :: HyperParameterTuningJobStrategyType
-> ResourceLimits -> HyperParameterTuningJobConfig
newHyperParameterTuningJobConfig
  HyperParameterTuningJobStrategyType
pStrategy_
  ResourceLimits
pResourceLimits_ =
    HyperParameterTuningJobConfig' :: Maybe TuningJobCompletionCriteria
-> Maybe ParameterRanges
-> Maybe HyperParameterTuningJobObjective
-> Maybe TrainingJobEarlyStoppingType
-> HyperParameterTuningJobStrategyType
-> ResourceLimits
-> HyperParameterTuningJobConfig
HyperParameterTuningJobConfig'
      { $sel:tuningJobCompletionCriteria:HyperParameterTuningJobConfig' :: Maybe TuningJobCompletionCriteria
tuningJobCompletionCriteria =
          Maybe TuningJobCompletionCriteria
forall a. Maybe a
Prelude.Nothing,
        $sel:parameterRanges:HyperParameterTuningJobConfig' :: Maybe ParameterRanges
parameterRanges = Maybe ParameterRanges
forall a. Maybe a
Prelude.Nothing,
        $sel:hyperParameterTuningJobObjective:HyperParameterTuningJobConfig' :: Maybe HyperParameterTuningJobObjective
hyperParameterTuningJobObjective =
          Maybe HyperParameterTuningJobObjective
forall a. Maybe a
Prelude.Nothing,
        $sel:trainingJobEarlyStoppingType:HyperParameterTuningJobConfig' :: Maybe TrainingJobEarlyStoppingType
trainingJobEarlyStoppingType =
          Maybe TrainingJobEarlyStoppingType
forall a. Maybe a
Prelude.Nothing,
        $sel:strategy:HyperParameterTuningJobConfig' :: HyperParameterTuningJobStrategyType
strategy = HyperParameterTuningJobStrategyType
pStrategy_,
        $sel:resourceLimits:HyperParameterTuningJobConfig' :: ResourceLimits
resourceLimits = ResourceLimits
pResourceLimits_
      }

-- | The tuning job\'s completion criteria.
hyperParameterTuningJobConfig_tuningJobCompletionCriteria :: Lens.Lens' HyperParameterTuningJobConfig (Prelude.Maybe TuningJobCompletionCriteria)
hyperParameterTuningJobConfig_tuningJobCompletionCriteria :: (Maybe TuningJobCompletionCriteria
 -> f (Maybe TuningJobCompletionCriteria))
-> HyperParameterTuningJobConfig -> f HyperParameterTuningJobConfig
hyperParameterTuningJobConfig_tuningJobCompletionCriteria = (HyperParameterTuningJobConfig
 -> Maybe TuningJobCompletionCriteria)
-> (HyperParameterTuningJobConfig
    -> Maybe TuningJobCompletionCriteria
    -> HyperParameterTuningJobConfig)
-> Lens
     HyperParameterTuningJobConfig
     HyperParameterTuningJobConfig
     (Maybe TuningJobCompletionCriteria)
     (Maybe TuningJobCompletionCriteria)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HyperParameterTuningJobConfig' {Maybe TuningJobCompletionCriteria
tuningJobCompletionCriteria :: Maybe TuningJobCompletionCriteria
$sel:tuningJobCompletionCriteria:HyperParameterTuningJobConfig' :: HyperParameterTuningJobConfig -> Maybe TuningJobCompletionCriteria
tuningJobCompletionCriteria} -> Maybe TuningJobCompletionCriteria
tuningJobCompletionCriteria) (\s :: HyperParameterTuningJobConfig
s@HyperParameterTuningJobConfig' {} Maybe TuningJobCompletionCriteria
a -> HyperParameterTuningJobConfig
s {$sel:tuningJobCompletionCriteria:HyperParameterTuningJobConfig' :: Maybe TuningJobCompletionCriteria
tuningJobCompletionCriteria = Maybe TuningJobCompletionCriteria
a} :: HyperParameterTuningJobConfig)

-- | The ParameterRanges object that specifies the ranges of hyperparameters
-- that this tuning job searches.
hyperParameterTuningJobConfig_parameterRanges :: Lens.Lens' HyperParameterTuningJobConfig (Prelude.Maybe ParameterRanges)
hyperParameterTuningJobConfig_parameterRanges :: (Maybe ParameterRanges -> f (Maybe ParameterRanges))
-> HyperParameterTuningJobConfig -> f HyperParameterTuningJobConfig
hyperParameterTuningJobConfig_parameterRanges = (HyperParameterTuningJobConfig -> Maybe ParameterRanges)
-> (HyperParameterTuningJobConfig
    -> Maybe ParameterRanges -> HyperParameterTuningJobConfig)
-> Lens
     HyperParameterTuningJobConfig
     HyperParameterTuningJobConfig
     (Maybe ParameterRanges)
     (Maybe ParameterRanges)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HyperParameterTuningJobConfig' {Maybe ParameterRanges
parameterRanges :: Maybe ParameterRanges
$sel:parameterRanges:HyperParameterTuningJobConfig' :: HyperParameterTuningJobConfig -> Maybe ParameterRanges
parameterRanges} -> Maybe ParameterRanges
parameterRanges) (\s :: HyperParameterTuningJobConfig
s@HyperParameterTuningJobConfig' {} Maybe ParameterRanges
a -> HyperParameterTuningJobConfig
s {$sel:parameterRanges:HyperParameterTuningJobConfig' :: Maybe ParameterRanges
parameterRanges = Maybe ParameterRanges
a} :: HyperParameterTuningJobConfig)

-- | The HyperParameterTuningJobObjective object that specifies the objective
-- metric for this tuning job.
hyperParameterTuningJobConfig_hyperParameterTuningJobObjective :: Lens.Lens' HyperParameterTuningJobConfig (Prelude.Maybe HyperParameterTuningJobObjective)
hyperParameterTuningJobConfig_hyperParameterTuningJobObjective :: (Maybe HyperParameterTuningJobObjective
 -> f (Maybe HyperParameterTuningJobObjective))
-> HyperParameterTuningJobConfig -> f HyperParameterTuningJobConfig
hyperParameterTuningJobConfig_hyperParameterTuningJobObjective = (HyperParameterTuningJobConfig
 -> Maybe HyperParameterTuningJobObjective)
-> (HyperParameterTuningJobConfig
    -> Maybe HyperParameterTuningJobObjective
    -> HyperParameterTuningJobConfig)
-> Lens
     HyperParameterTuningJobConfig
     HyperParameterTuningJobConfig
     (Maybe HyperParameterTuningJobObjective)
     (Maybe HyperParameterTuningJobObjective)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HyperParameterTuningJobConfig' {Maybe HyperParameterTuningJobObjective
hyperParameterTuningJobObjective :: Maybe HyperParameterTuningJobObjective
$sel:hyperParameterTuningJobObjective:HyperParameterTuningJobConfig' :: HyperParameterTuningJobConfig
-> Maybe HyperParameterTuningJobObjective
hyperParameterTuningJobObjective} -> Maybe HyperParameterTuningJobObjective
hyperParameterTuningJobObjective) (\s :: HyperParameterTuningJobConfig
s@HyperParameterTuningJobConfig' {} Maybe HyperParameterTuningJobObjective
a -> HyperParameterTuningJobConfig
s {$sel:hyperParameterTuningJobObjective:HyperParameterTuningJobConfig' :: Maybe HyperParameterTuningJobObjective
hyperParameterTuningJobObjective = Maybe HyperParameterTuningJobObjective
a} :: HyperParameterTuningJobConfig)

-- | Specifies whether to use early stopping for training jobs launched by
-- the hyperparameter tuning job. This can be one of the following values
-- (the default value is @OFF@):
--
-- [OFF]
--     Training jobs launched by the hyperparameter tuning job do not use
--     early stopping.
--
-- [AUTO]
--     Amazon SageMaker stops training jobs launched by the hyperparameter
--     tuning job when they are unlikely to perform better than previously
--     completed training jobs. For more information, see
--     <https://docs.aws.amazon.com/sagemaker/latest/dg/automatic-model-tuning-early-stopping.html Stop Training Jobs Early>.
hyperParameterTuningJobConfig_trainingJobEarlyStoppingType :: Lens.Lens' HyperParameterTuningJobConfig (Prelude.Maybe TrainingJobEarlyStoppingType)
hyperParameterTuningJobConfig_trainingJobEarlyStoppingType :: (Maybe TrainingJobEarlyStoppingType
 -> f (Maybe TrainingJobEarlyStoppingType))
-> HyperParameterTuningJobConfig -> f HyperParameterTuningJobConfig
hyperParameterTuningJobConfig_trainingJobEarlyStoppingType = (HyperParameterTuningJobConfig
 -> Maybe TrainingJobEarlyStoppingType)
-> (HyperParameterTuningJobConfig
    -> Maybe TrainingJobEarlyStoppingType
    -> HyperParameterTuningJobConfig)
-> Lens
     HyperParameterTuningJobConfig
     HyperParameterTuningJobConfig
     (Maybe TrainingJobEarlyStoppingType)
     (Maybe TrainingJobEarlyStoppingType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HyperParameterTuningJobConfig' {Maybe TrainingJobEarlyStoppingType
trainingJobEarlyStoppingType :: Maybe TrainingJobEarlyStoppingType
$sel:trainingJobEarlyStoppingType:HyperParameterTuningJobConfig' :: HyperParameterTuningJobConfig -> Maybe TrainingJobEarlyStoppingType
trainingJobEarlyStoppingType} -> Maybe TrainingJobEarlyStoppingType
trainingJobEarlyStoppingType) (\s :: HyperParameterTuningJobConfig
s@HyperParameterTuningJobConfig' {} Maybe TrainingJobEarlyStoppingType
a -> HyperParameterTuningJobConfig
s {$sel:trainingJobEarlyStoppingType:HyperParameterTuningJobConfig' :: Maybe TrainingJobEarlyStoppingType
trainingJobEarlyStoppingType = Maybe TrainingJobEarlyStoppingType
a} :: HyperParameterTuningJobConfig)

-- | Specifies how hyperparameter tuning chooses the combinations of
-- hyperparameter values to use for the training job it launches. To use
-- the Bayesian search strategy, set this to @Bayesian@. To randomly
-- search, set it to @Random@. For information about search strategies, see
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/automatic-model-tuning-how-it-works.html How Hyperparameter Tuning Works>.
hyperParameterTuningJobConfig_strategy :: Lens.Lens' HyperParameterTuningJobConfig HyperParameterTuningJobStrategyType
hyperParameterTuningJobConfig_strategy :: (HyperParameterTuningJobStrategyType
 -> f HyperParameterTuningJobStrategyType)
-> HyperParameterTuningJobConfig -> f HyperParameterTuningJobConfig
hyperParameterTuningJobConfig_strategy = (HyperParameterTuningJobConfig
 -> HyperParameterTuningJobStrategyType)
-> (HyperParameterTuningJobConfig
    -> HyperParameterTuningJobStrategyType
    -> HyperParameterTuningJobConfig)
-> Lens
     HyperParameterTuningJobConfig
     HyperParameterTuningJobConfig
     HyperParameterTuningJobStrategyType
     HyperParameterTuningJobStrategyType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HyperParameterTuningJobConfig' {HyperParameterTuningJobStrategyType
strategy :: HyperParameterTuningJobStrategyType
$sel:strategy:HyperParameterTuningJobConfig' :: HyperParameterTuningJobConfig
-> HyperParameterTuningJobStrategyType
strategy} -> HyperParameterTuningJobStrategyType
strategy) (\s :: HyperParameterTuningJobConfig
s@HyperParameterTuningJobConfig' {} HyperParameterTuningJobStrategyType
a -> HyperParameterTuningJobConfig
s {$sel:strategy:HyperParameterTuningJobConfig' :: HyperParameterTuningJobStrategyType
strategy = HyperParameterTuningJobStrategyType
a} :: HyperParameterTuningJobConfig)

-- | The ResourceLimits object that specifies the maximum number of training
-- jobs and parallel training jobs for this tuning job.
hyperParameterTuningJobConfig_resourceLimits :: Lens.Lens' HyperParameterTuningJobConfig ResourceLimits
hyperParameterTuningJobConfig_resourceLimits :: (ResourceLimits -> f ResourceLimits)
-> HyperParameterTuningJobConfig -> f HyperParameterTuningJobConfig
hyperParameterTuningJobConfig_resourceLimits = (HyperParameterTuningJobConfig -> ResourceLimits)
-> (HyperParameterTuningJobConfig
    -> ResourceLimits -> HyperParameterTuningJobConfig)
-> Lens
     HyperParameterTuningJobConfig
     HyperParameterTuningJobConfig
     ResourceLimits
     ResourceLimits
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HyperParameterTuningJobConfig' {ResourceLimits
resourceLimits :: ResourceLimits
$sel:resourceLimits:HyperParameterTuningJobConfig' :: HyperParameterTuningJobConfig -> ResourceLimits
resourceLimits} -> ResourceLimits
resourceLimits) (\s :: HyperParameterTuningJobConfig
s@HyperParameterTuningJobConfig' {} ResourceLimits
a -> HyperParameterTuningJobConfig
s {$sel:resourceLimits:HyperParameterTuningJobConfig' :: ResourceLimits
resourceLimits = ResourceLimits
a} :: HyperParameterTuningJobConfig)

instance Core.FromJSON HyperParameterTuningJobConfig where
  parseJSON :: Value -> Parser HyperParameterTuningJobConfig
parseJSON =
    String
-> (Object -> Parser HyperParameterTuningJobConfig)
-> Value
-> Parser HyperParameterTuningJobConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"HyperParameterTuningJobConfig"
      ( \Object
x ->
          Maybe TuningJobCompletionCriteria
-> Maybe ParameterRanges
-> Maybe HyperParameterTuningJobObjective
-> Maybe TrainingJobEarlyStoppingType
-> HyperParameterTuningJobStrategyType
-> ResourceLimits
-> HyperParameterTuningJobConfig
HyperParameterTuningJobConfig'
            (Maybe TuningJobCompletionCriteria
 -> Maybe ParameterRanges
 -> Maybe HyperParameterTuningJobObjective
 -> Maybe TrainingJobEarlyStoppingType
 -> HyperParameterTuningJobStrategyType
 -> ResourceLimits
 -> HyperParameterTuningJobConfig)
-> Parser (Maybe TuningJobCompletionCriteria)
-> Parser
     (Maybe ParameterRanges
      -> Maybe HyperParameterTuningJobObjective
      -> Maybe TrainingJobEarlyStoppingType
      -> HyperParameterTuningJobStrategyType
      -> ResourceLimits
      -> HyperParameterTuningJobConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe TuningJobCompletionCriteria)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TuningJobCompletionCriteria")
            Parser
  (Maybe ParameterRanges
   -> Maybe HyperParameterTuningJobObjective
   -> Maybe TrainingJobEarlyStoppingType
   -> HyperParameterTuningJobStrategyType
   -> ResourceLimits
   -> HyperParameterTuningJobConfig)
-> Parser (Maybe ParameterRanges)
-> Parser
     (Maybe HyperParameterTuningJobObjective
      -> Maybe TrainingJobEarlyStoppingType
      -> HyperParameterTuningJobStrategyType
      -> ResourceLimits
      -> HyperParameterTuningJobConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ParameterRanges)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ParameterRanges")
            Parser
  (Maybe HyperParameterTuningJobObjective
   -> Maybe TrainingJobEarlyStoppingType
   -> HyperParameterTuningJobStrategyType
   -> ResourceLimits
   -> HyperParameterTuningJobConfig)
-> Parser (Maybe HyperParameterTuningJobObjective)
-> Parser
     (Maybe TrainingJobEarlyStoppingType
      -> HyperParameterTuningJobStrategyType
      -> ResourceLimits
      -> HyperParameterTuningJobConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe HyperParameterTuningJobObjective)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"HyperParameterTuningJobObjective")
            Parser
  (Maybe TrainingJobEarlyStoppingType
   -> HyperParameterTuningJobStrategyType
   -> ResourceLimits
   -> HyperParameterTuningJobConfig)
-> Parser (Maybe TrainingJobEarlyStoppingType)
-> Parser
     (HyperParameterTuningJobStrategyType
      -> ResourceLimits -> HyperParameterTuningJobConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe TrainingJobEarlyStoppingType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TrainingJobEarlyStoppingType")
            Parser
  (HyperParameterTuningJobStrategyType
   -> ResourceLimits -> HyperParameterTuningJobConfig)
-> Parser HyperParameterTuningJobStrategyType
-> Parser (ResourceLimits -> HyperParameterTuningJobConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser HyperParameterTuningJobStrategyType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Strategy")
            Parser (ResourceLimits -> HyperParameterTuningJobConfig)
-> Parser ResourceLimits -> Parser HyperParameterTuningJobConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ResourceLimits
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ResourceLimits")
      )

instance
  Prelude.Hashable
    HyperParameterTuningJobConfig

instance Prelude.NFData HyperParameterTuningJobConfig

instance Core.ToJSON HyperParameterTuningJobConfig where
  toJSON :: HyperParameterTuningJobConfig -> Value
toJSON HyperParameterTuningJobConfig' {Maybe HyperParameterTuningJobObjective
Maybe ParameterRanges
Maybe TrainingJobEarlyStoppingType
Maybe TuningJobCompletionCriteria
HyperParameterTuningJobStrategyType
ResourceLimits
resourceLimits :: ResourceLimits
strategy :: HyperParameterTuningJobStrategyType
trainingJobEarlyStoppingType :: Maybe TrainingJobEarlyStoppingType
hyperParameterTuningJobObjective :: Maybe HyperParameterTuningJobObjective
parameterRanges :: Maybe ParameterRanges
tuningJobCompletionCriteria :: Maybe TuningJobCompletionCriteria
$sel:resourceLimits:HyperParameterTuningJobConfig' :: HyperParameterTuningJobConfig -> ResourceLimits
$sel:strategy:HyperParameterTuningJobConfig' :: HyperParameterTuningJobConfig
-> HyperParameterTuningJobStrategyType
$sel:trainingJobEarlyStoppingType:HyperParameterTuningJobConfig' :: HyperParameterTuningJobConfig -> Maybe TrainingJobEarlyStoppingType
$sel:hyperParameterTuningJobObjective:HyperParameterTuningJobConfig' :: HyperParameterTuningJobConfig
-> Maybe HyperParameterTuningJobObjective
$sel:parameterRanges:HyperParameterTuningJobConfig' :: HyperParameterTuningJobConfig -> Maybe ParameterRanges
$sel:tuningJobCompletionCriteria:HyperParameterTuningJobConfig' :: HyperParameterTuningJobConfig -> Maybe TuningJobCompletionCriteria
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"TuningJobCompletionCriteria" Text -> TuningJobCompletionCriteria -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (TuningJobCompletionCriteria -> Pair)
-> Maybe TuningJobCompletionCriteria -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe TuningJobCompletionCriteria
tuningJobCompletionCriteria,
            (Text
"ParameterRanges" Text -> ParameterRanges -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ParameterRanges -> Pair) -> Maybe ParameterRanges -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ParameterRanges
parameterRanges,
            (Text
"HyperParameterTuningJobObjective" Text -> HyperParameterTuningJobObjective -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (HyperParameterTuningJobObjective -> Pair)
-> Maybe HyperParameterTuningJobObjective -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe HyperParameterTuningJobObjective
hyperParameterTuningJobObjective,
            (Text
"TrainingJobEarlyStoppingType" Text -> TrainingJobEarlyStoppingType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (TrainingJobEarlyStoppingType -> Pair)
-> Maybe TrainingJobEarlyStoppingType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe TrainingJobEarlyStoppingType
trainingJobEarlyStoppingType,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Strategy" Text -> HyperParameterTuningJobStrategyType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= HyperParameterTuningJobStrategyType
strategy),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ResourceLimits" Text -> ResourceLimits -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ResourceLimits
resourceLimits)
          ]
      )