{-# 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-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.HyperParameterTuningJobConfig 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
import Amazonka.SageMaker.Types.HyperParameterTuningJobObjective
import Amazonka.SageMaker.Types.HyperParameterTuningJobStrategyConfig
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 HyperParameterTuningJobObjective specifies the objective metric used
    -- to evaluate the performance of training jobs launched by this tuning
    -- job.
    HyperParameterTuningJobConfig
-> Maybe HyperParameterTuningJobObjective
hyperParameterTuningJobObjective :: Prelude.Maybe HyperParameterTuningJobObjective,
    -- | The ParameterRanges object that specifies the ranges of hyperparameters
    -- that this tuning job searches over to find the optimal configuration for
    -- the highest model performance against your chosen objective metric.
    HyperParameterTuningJobConfig -> Maybe ParameterRanges
parameterRanges :: Prelude.Maybe ParameterRanges,
    -- | A value used to initialize a pseudo-random number generator. Setting a
    -- random seed and using the same seed later for the same tuning job will
    -- allow hyperparameter optimization to find more a consistent
    -- hyperparameter configuration between the two runs.
    HyperParameterTuningJobConfig -> Maybe Natural
randomSeed :: Prelude.Maybe Prelude.Natural,
    -- | The configuration for the @Hyperband@ optimization strategy. This
    -- parameter should be provided only if @Hyperband@ is selected as the
    -- strategy for @HyperParameterTuningJobConfig@.
    HyperParameterTuningJobConfig
-> Maybe HyperParameterTuningJobStrategyConfig
strategyConfig :: Prelude.Maybe HyperParameterTuningJobStrategyConfig,
    -- | Specifies whether to use early stopping for training jobs launched by
    -- the hyperparameter tuning job. Because the @Hyperband@ strategy has its
    -- own advanced internal early stopping mechanism,
    -- @TrainingJobEarlyStoppingType@ must be @OFF@ to use @Hyperband@. This
    -- parameter can take on 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]
    --     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,
    -- | The tuning job\'s completion criteria.
    HyperParameterTuningJobConfig -> Maybe TuningJobCompletionCriteria
tuningJobCompletionCriteria :: Prelude.Maybe TuningJobCompletionCriteria,
    -- | Specifies how hyperparameter tuning chooses the combinations of
    -- hyperparameter values to use for the training job it launches. 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
    -- and parallel training jobs that can be used for this hyperparameter
    -- tuning job.
    HyperParameterTuningJobConfig -> ResourceLimits
resourceLimits :: ResourceLimits
  }
  deriving (HyperParameterTuningJobConfig
-> HyperParameterTuningJobConfig -> Bool
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]
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
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.
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:
--
-- 'hyperParameterTuningJobObjective', 'hyperParameterTuningJobConfig_hyperParameterTuningJobObjective' - The HyperParameterTuningJobObjective specifies the objective metric used
-- to evaluate the performance of training jobs launched by this tuning
-- job.
--
-- 'parameterRanges', 'hyperParameterTuningJobConfig_parameterRanges' - The ParameterRanges object that specifies the ranges of hyperparameters
-- that this tuning job searches over to find the optimal configuration for
-- the highest model performance against your chosen objective metric.
--
-- 'randomSeed', 'hyperParameterTuningJobConfig_randomSeed' - A value used to initialize a pseudo-random number generator. Setting a
-- random seed and using the same seed later for the same tuning job will
-- allow hyperparameter optimization to find more a consistent
-- hyperparameter configuration between the two runs.
--
-- 'strategyConfig', 'hyperParameterTuningJobConfig_strategyConfig' - The configuration for the @Hyperband@ optimization strategy. This
-- parameter should be provided only if @Hyperband@ is selected as the
-- strategy for @HyperParameterTuningJobConfig@.
--
-- 'trainingJobEarlyStoppingType', 'hyperParameterTuningJobConfig_trainingJobEarlyStoppingType' - Specifies whether to use early stopping for training jobs launched by
-- the hyperparameter tuning job. Because the @Hyperband@ strategy has its
-- own advanced internal early stopping mechanism,
-- @TrainingJobEarlyStoppingType@ must be @OFF@ to use @Hyperband@. This
-- parameter can take on 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]
--     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>.
--
-- 'tuningJobCompletionCriteria', 'hyperParameterTuningJobConfig_tuningJobCompletionCriteria' - The tuning job\'s completion criteria.
--
-- 'strategy', 'hyperParameterTuningJobConfig_strategy' - Specifies how hyperparameter tuning chooses the combinations of
-- hyperparameter values to use for the training job it launches. 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
-- and parallel training jobs that can be used for this hyperparameter
-- tuning job.
newHyperParameterTuningJobConfig ::
  -- | 'strategy'
  HyperParameterTuningJobStrategyType ->
  -- | 'resourceLimits'
  ResourceLimits ->
  HyperParameterTuningJobConfig
newHyperParameterTuningJobConfig :: HyperParameterTuningJobStrategyType
-> ResourceLimits -> HyperParameterTuningJobConfig
newHyperParameterTuningJobConfig
  HyperParameterTuningJobStrategyType
pStrategy_
  ResourceLimits
pResourceLimits_ =
    HyperParameterTuningJobConfig'
      { $sel:hyperParameterTuningJobObjective:HyperParameterTuningJobConfig' :: Maybe HyperParameterTuningJobObjective
hyperParameterTuningJobObjective =
          forall a. Maybe a
Prelude.Nothing,
        $sel:parameterRanges:HyperParameterTuningJobConfig' :: Maybe ParameterRanges
parameterRanges = forall a. Maybe a
Prelude.Nothing,
        $sel:randomSeed:HyperParameterTuningJobConfig' :: Maybe Natural
randomSeed = forall a. Maybe a
Prelude.Nothing,
        $sel:strategyConfig:HyperParameterTuningJobConfig' :: Maybe HyperParameterTuningJobStrategyConfig
strategyConfig = forall a. Maybe a
Prelude.Nothing,
        $sel:trainingJobEarlyStoppingType:HyperParameterTuningJobConfig' :: Maybe TrainingJobEarlyStoppingType
trainingJobEarlyStoppingType =
          forall a. Maybe a
Prelude.Nothing,
        $sel:tuningJobCompletionCriteria:HyperParameterTuningJobConfig' :: Maybe TuningJobCompletionCriteria
tuningJobCompletionCriteria =
          forall a. Maybe a
Prelude.Nothing,
        $sel:strategy:HyperParameterTuningJobConfig' :: HyperParameterTuningJobStrategyType
strategy = HyperParameterTuningJobStrategyType
pStrategy_,
        $sel:resourceLimits:HyperParameterTuningJobConfig' :: ResourceLimits
resourceLimits = ResourceLimits
pResourceLimits_
      }

-- | The HyperParameterTuningJobObjective specifies the objective metric used
-- to evaluate the performance of training jobs launched by this tuning
-- job.
hyperParameterTuningJobConfig_hyperParameterTuningJobObjective :: Lens.Lens' HyperParameterTuningJobConfig (Prelude.Maybe HyperParameterTuningJobObjective)
hyperParameterTuningJobConfig_hyperParameterTuningJobObjective :: Lens'
  HyperParameterTuningJobConfig
  (Maybe HyperParameterTuningJobObjective)
hyperParameterTuningJobConfig_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)

-- | The ParameterRanges object that specifies the ranges of hyperparameters
-- that this tuning job searches over to find the optimal configuration for
-- the highest model performance against your chosen objective metric.
hyperParameterTuningJobConfig_parameterRanges :: Lens.Lens' HyperParameterTuningJobConfig (Prelude.Maybe ParameterRanges)
hyperParameterTuningJobConfig_parameterRanges :: Lens' HyperParameterTuningJobConfig (Maybe ParameterRanges)
hyperParameterTuningJobConfig_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)

-- | A value used to initialize a pseudo-random number generator. Setting a
-- random seed and using the same seed later for the same tuning job will
-- allow hyperparameter optimization to find more a consistent
-- hyperparameter configuration between the two runs.
hyperParameterTuningJobConfig_randomSeed :: Lens.Lens' HyperParameterTuningJobConfig (Prelude.Maybe Prelude.Natural)
hyperParameterTuningJobConfig_randomSeed :: Lens' HyperParameterTuningJobConfig (Maybe Natural)
hyperParameterTuningJobConfig_randomSeed = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HyperParameterTuningJobConfig' {Maybe Natural
randomSeed :: Maybe Natural
$sel:randomSeed:HyperParameterTuningJobConfig' :: HyperParameterTuningJobConfig -> Maybe Natural
randomSeed} -> Maybe Natural
randomSeed) (\s :: HyperParameterTuningJobConfig
s@HyperParameterTuningJobConfig' {} Maybe Natural
a -> HyperParameterTuningJobConfig
s {$sel:randomSeed:HyperParameterTuningJobConfig' :: Maybe Natural
randomSeed = Maybe Natural
a} :: HyperParameterTuningJobConfig)

-- | The configuration for the @Hyperband@ optimization strategy. This
-- parameter should be provided only if @Hyperband@ is selected as the
-- strategy for @HyperParameterTuningJobConfig@.
hyperParameterTuningJobConfig_strategyConfig :: Lens.Lens' HyperParameterTuningJobConfig (Prelude.Maybe HyperParameterTuningJobStrategyConfig)
hyperParameterTuningJobConfig_strategyConfig :: Lens'
  HyperParameterTuningJobConfig
  (Maybe HyperParameterTuningJobStrategyConfig)
hyperParameterTuningJobConfig_strategyConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HyperParameterTuningJobConfig' {Maybe HyperParameterTuningJobStrategyConfig
strategyConfig :: Maybe HyperParameterTuningJobStrategyConfig
$sel:strategyConfig:HyperParameterTuningJobConfig' :: HyperParameterTuningJobConfig
-> Maybe HyperParameterTuningJobStrategyConfig
strategyConfig} -> Maybe HyperParameterTuningJobStrategyConfig
strategyConfig) (\s :: HyperParameterTuningJobConfig
s@HyperParameterTuningJobConfig' {} Maybe HyperParameterTuningJobStrategyConfig
a -> HyperParameterTuningJobConfig
s {$sel:strategyConfig:HyperParameterTuningJobConfig' :: Maybe HyperParameterTuningJobStrategyConfig
strategyConfig = Maybe HyperParameterTuningJobStrategyConfig
a} :: HyperParameterTuningJobConfig)

-- | Specifies whether to use early stopping for training jobs launched by
-- the hyperparameter tuning job. Because the @Hyperband@ strategy has its
-- own advanced internal early stopping mechanism,
-- @TrainingJobEarlyStoppingType@ must be @OFF@ to use @Hyperband@. This
-- parameter can take on 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]
--     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 :: Lens'
  HyperParameterTuningJobConfig (Maybe TrainingJobEarlyStoppingType)
hyperParameterTuningJobConfig_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)

-- | The tuning job\'s completion criteria.
hyperParameterTuningJobConfig_tuningJobCompletionCriteria :: Lens.Lens' HyperParameterTuningJobConfig (Prelude.Maybe TuningJobCompletionCriteria)
hyperParameterTuningJobConfig_tuningJobCompletionCriteria :: Lens'
  HyperParameterTuningJobConfig (Maybe TuningJobCompletionCriteria)
hyperParameterTuningJobConfig_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)

-- | Specifies how hyperparameter tuning chooses the combinations of
-- hyperparameter values to use for the training job it launches. 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 :: Lens'
  HyperParameterTuningJobConfig HyperParameterTuningJobStrategyType
hyperParameterTuningJobConfig_strategy = 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
-- and parallel training jobs that can be used for this hyperparameter
-- tuning job.
hyperParameterTuningJobConfig_resourceLimits :: Lens.Lens' HyperParameterTuningJobConfig ResourceLimits
hyperParameterTuningJobConfig_resourceLimits :: Lens' HyperParameterTuningJobConfig ResourceLimits
hyperParameterTuningJobConfig_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 Data.FromJSON HyperParameterTuningJobConfig where
  parseJSON :: Value -> Parser HyperParameterTuningJobConfig
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"HyperParameterTuningJobConfig"
      ( \Object
x ->
          Maybe HyperParameterTuningJobObjective
-> Maybe ParameterRanges
-> Maybe Natural
-> Maybe HyperParameterTuningJobStrategyConfig
-> Maybe TrainingJobEarlyStoppingType
-> Maybe TuningJobCompletionCriteria
-> HyperParameterTuningJobStrategyType
-> ResourceLimits
-> HyperParameterTuningJobConfig
HyperParameterTuningJobConfig'
            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
"HyperParameterTuningJobObjective")
            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
"ParameterRanges")
            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
"RandomSeed")
            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
"StrategyConfig")
            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
"TrainingJobEarlyStoppingType")
            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
"TuningJobCompletionCriteria")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Strategy")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"ResourceLimits")
      )

instance
  Prelude.Hashable
    HyperParameterTuningJobConfig
  where
  hashWithSalt :: Int -> HyperParameterTuningJobConfig -> Int
hashWithSalt Int
_salt HyperParameterTuningJobConfig' {Maybe Natural
Maybe HyperParameterTuningJobObjective
Maybe HyperParameterTuningJobStrategyConfig
Maybe ParameterRanges
Maybe TrainingJobEarlyStoppingType
Maybe TuningJobCompletionCriteria
HyperParameterTuningJobStrategyType
ResourceLimits
resourceLimits :: ResourceLimits
strategy :: HyperParameterTuningJobStrategyType
tuningJobCompletionCriteria :: Maybe TuningJobCompletionCriteria
trainingJobEarlyStoppingType :: Maybe TrainingJobEarlyStoppingType
strategyConfig :: Maybe HyperParameterTuningJobStrategyConfig
randomSeed :: Maybe Natural
parameterRanges :: Maybe ParameterRanges
hyperParameterTuningJobObjective :: Maybe HyperParameterTuningJobObjective
$sel:resourceLimits:HyperParameterTuningJobConfig' :: HyperParameterTuningJobConfig -> ResourceLimits
$sel:strategy:HyperParameterTuningJobConfig' :: HyperParameterTuningJobConfig
-> HyperParameterTuningJobStrategyType
$sel:tuningJobCompletionCriteria:HyperParameterTuningJobConfig' :: HyperParameterTuningJobConfig -> Maybe TuningJobCompletionCriteria
$sel:trainingJobEarlyStoppingType:HyperParameterTuningJobConfig' :: HyperParameterTuningJobConfig -> Maybe TrainingJobEarlyStoppingType
$sel:strategyConfig:HyperParameterTuningJobConfig' :: HyperParameterTuningJobConfig
-> Maybe HyperParameterTuningJobStrategyConfig
$sel:randomSeed:HyperParameterTuningJobConfig' :: HyperParameterTuningJobConfig -> Maybe Natural
$sel:parameterRanges:HyperParameterTuningJobConfig' :: HyperParameterTuningJobConfig -> Maybe ParameterRanges
$sel:hyperParameterTuningJobObjective:HyperParameterTuningJobConfig' :: HyperParameterTuningJobConfig
-> Maybe HyperParameterTuningJobObjective
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe HyperParameterTuningJobObjective
hyperParameterTuningJobObjective
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ParameterRanges
parameterRanges
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
randomSeed
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe HyperParameterTuningJobStrategyConfig
strategyConfig
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TrainingJobEarlyStoppingType
trainingJobEarlyStoppingType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TuningJobCompletionCriteria
tuningJobCompletionCriteria
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` HyperParameterTuningJobStrategyType
strategy
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ResourceLimits
resourceLimits

instance Prelude.NFData HyperParameterTuningJobConfig where
  rnf :: HyperParameterTuningJobConfig -> ()
rnf HyperParameterTuningJobConfig' {Maybe Natural
Maybe HyperParameterTuningJobObjective
Maybe HyperParameterTuningJobStrategyConfig
Maybe ParameterRanges
Maybe TrainingJobEarlyStoppingType
Maybe TuningJobCompletionCriteria
HyperParameterTuningJobStrategyType
ResourceLimits
resourceLimits :: ResourceLimits
strategy :: HyperParameterTuningJobStrategyType
tuningJobCompletionCriteria :: Maybe TuningJobCompletionCriteria
trainingJobEarlyStoppingType :: Maybe TrainingJobEarlyStoppingType
strategyConfig :: Maybe HyperParameterTuningJobStrategyConfig
randomSeed :: Maybe Natural
parameterRanges :: Maybe ParameterRanges
hyperParameterTuningJobObjective :: Maybe HyperParameterTuningJobObjective
$sel:resourceLimits:HyperParameterTuningJobConfig' :: HyperParameterTuningJobConfig -> ResourceLimits
$sel:strategy:HyperParameterTuningJobConfig' :: HyperParameterTuningJobConfig
-> HyperParameterTuningJobStrategyType
$sel:tuningJobCompletionCriteria:HyperParameterTuningJobConfig' :: HyperParameterTuningJobConfig -> Maybe TuningJobCompletionCriteria
$sel:trainingJobEarlyStoppingType:HyperParameterTuningJobConfig' :: HyperParameterTuningJobConfig -> Maybe TrainingJobEarlyStoppingType
$sel:strategyConfig:HyperParameterTuningJobConfig' :: HyperParameterTuningJobConfig
-> Maybe HyperParameterTuningJobStrategyConfig
$sel:randomSeed:HyperParameterTuningJobConfig' :: HyperParameterTuningJobConfig -> Maybe Natural
$sel:parameterRanges:HyperParameterTuningJobConfig' :: HyperParameterTuningJobConfig -> Maybe ParameterRanges
$sel:hyperParameterTuningJobObjective:HyperParameterTuningJobConfig' :: HyperParameterTuningJobConfig
-> Maybe HyperParameterTuningJobObjective
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe HyperParameterTuningJobObjective
hyperParameterTuningJobObjective
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ParameterRanges
parameterRanges
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
randomSeed
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe HyperParameterTuningJobStrategyConfig
strategyConfig
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TrainingJobEarlyStoppingType
trainingJobEarlyStoppingType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TuningJobCompletionCriteria
tuningJobCompletionCriteria
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf HyperParameterTuningJobStrategyType
strategy
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ResourceLimits
resourceLimits

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