{-# 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.TrainingSpecification
-- 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.TrainingSpecification 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.ChannelSpecification
import Amazonka.SageMaker.Types.HyperParameterSpecification
import Amazonka.SageMaker.Types.HyperParameterTuningJobObjective
import Amazonka.SageMaker.Types.MetricDefinition
import Amazonka.SageMaker.Types.TrainingInstanceType

-- | Defines how the algorithm is used for a training job.
--
-- /See:/ 'newTrainingSpecification' smart constructor.
data TrainingSpecification = TrainingSpecification'
  { -- | A list of @MetricDefinition@ objects, which are used for parsing metrics
    -- generated by the algorithm.
    TrainingSpecification -> Maybe [MetricDefinition]
metricDefinitions :: Prelude.Maybe [MetricDefinition],
    -- | A list of the @HyperParameterSpecification@ objects, that define the
    -- supported hyperparameters. This is required if the algorithm supports
    -- automatic model tuning.>
    TrainingSpecification -> Maybe [HyperParameterSpecification]
supportedHyperParameters :: Prelude.Maybe [HyperParameterSpecification],
    -- | A list of the metrics that the algorithm emits that can be used as the
    -- objective metric in a hyperparameter tuning job.
    TrainingSpecification -> Maybe [HyperParameterTuningJobObjective]
supportedTuningJobObjectiveMetrics :: Prelude.Maybe [HyperParameterTuningJobObjective],
    -- | Indicates whether the algorithm supports distributed training. If set to
    -- false, buyers can\'t request more than one instance during training.
    TrainingSpecification -> Maybe Bool
supportsDistributedTraining :: Prelude.Maybe Prelude.Bool,
    -- | An MD5 hash of the training algorithm that identifies the Docker image
    -- used for training.
    TrainingSpecification -> Maybe Text
trainingImageDigest :: Prelude.Maybe Prelude.Text,
    -- | The Amazon ECR registry path of the Docker image that contains the
    -- training algorithm.
    TrainingSpecification -> Text
trainingImage :: Prelude.Text,
    -- | A list of the instance types that this algorithm can use for training.
    TrainingSpecification -> [TrainingInstanceType]
supportedTrainingInstanceTypes :: [TrainingInstanceType],
    -- | A list of @ChannelSpecification@ objects, which specify the input
    -- sources to be used by the algorithm.
    TrainingSpecification -> NonEmpty ChannelSpecification
trainingChannels :: Prelude.NonEmpty ChannelSpecification
  }
  deriving (TrainingSpecification -> TrainingSpecification -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TrainingSpecification -> TrainingSpecification -> Bool
$c/= :: TrainingSpecification -> TrainingSpecification -> Bool
== :: TrainingSpecification -> TrainingSpecification -> Bool
$c== :: TrainingSpecification -> TrainingSpecification -> Bool
Prelude.Eq, ReadPrec [TrainingSpecification]
ReadPrec TrainingSpecification
Int -> ReadS TrainingSpecification
ReadS [TrainingSpecification]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TrainingSpecification]
$creadListPrec :: ReadPrec [TrainingSpecification]
readPrec :: ReadPrec TrainingSpecification
$creadPrec :: ReadPrec TrainingSpecification
readList :: ReadS [TrainingSpecification]
$creadList :: ReadS [TrainingSpecification]
readsPrec :: Int -> ReadS TrainingSpecification
$creadsPrec :: Int -> ReadS TrainingSpecification
Prelude.Read, Int -> TrainingSpecification -> ShowS
[TrainingSpecification] -> ShowS
TrainingSpecification -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TrainingSpecification] -> ShowS
$cshowList :: [TrainingSpecification] -> ShowS
show :: TrainingSpecification -> String
$cshow :: TrainingSpecification -> String
showsPrec :: Int -> TrainingSpecification -> ShowS
$cshowsPrec :: Int -> TrainingSpecification -> ShowS
Prelude.Show, forall x. Rep TrainingSpecification x -> TrainingSpecification
forall x. TrainingSpecification -> Rep TrainingSpecification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TrainingSpecification x -> TrainingSpecification
$cfrom :: forall x. TrainingSpecification -> Rep TrainingSpecification x
Prelude.Generic)

-- |
-- Create a value of 'TrainingSpecification' 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:
--
-- 'metricDefinitions', 'trainingSpecification_metricDefinitions' - A list of @MetricDefinition@ objects, which are used for parsing metrics
-- generated by the algorithm.
--
-- 'supportedHyperParameters', 'trainingSpecification_supportedHyperParameters' - A list of the @HyperParameterSpecification@ objects, that define the
-- supported hyperparameters. This is required if the algorithm supports
-- automatic model tuning.>
--
-- 'supportedTuningJobObjectiveMetrics', 'trainingSpecification_supportedTuningJobObjectiveMetrics' - A list of the metrics that the algorithm emits that can be used as the
-- objective metric in a hyperparameter tuning job.
--
-- 'supportsDistributedTraining', 'trainingSpecification_supportsDistributedTraining' - Indicates whether the algorithm supports distributed training. If set to
-- false, buyers can\'t request more than one instance during training.
--
-- 'trainingImageDigest', 'trainingSpecification_trainingImageDigest' - An MD5 hash of the training algorithm that identifies the Docker image
-- used for training.
--
-- 'trainingImage', 'trainingSpecification_trainingImage' - The Amazon ECR registry path of the Docker image that contains the
-- training algorithm.
--
-- 'supportedTrainingInstanceTypes', 'trainingSpecification_supportedTrainingInstanceTypes' - A list of the instance types that this algorithm can use for training.
--
-- 'trainingChannels', 'trainingSpecification_trainingChannels' - A list of @ChannelSpecification@ objects, which specify the input
-- sources to be used by the algorithm.
newTrainingSpecification ::
  -- | 'trainingImage'
  Prelude.Text ->
  -- | 'trainingChannels'
  Prelude.NonEmpty ChannelSpecification ->
  TrainingSpecification
newTrainingSpecification :: Text -> NonEmpty ChannelSpecification -> TrainingSpecification
newTrainingSpecification
  Text
pTrainingImage_
  NonEmpty ChannelSpecification
pTrainingChannels_ =
    TrainingSpecification'
      { $sel:metricDefinitions:TrainingSpecification' :: Maybe [MetricDefinition]
metricDefinitions =
          forall a. Maybe a
Prelude.Nothing,
        $sel:supportedHyperParameters:TrainingSpecification' :: Maybe [HyperParameterSpecification]
supportedHyperParameters = forall a. Maybe a
Prelude.Nothing,
        $sel:supportedTuningJobObjectiveMetrics:TrainingSpecification' :: Maybe [HyperParameterTuningJobObjective]
supportedTuningJobObjectiveMetrics = forall a. Maybe a
Prelude.Nothing,
        $sel:supportsDistributedTraining:TrainingSpecification' :: Maybe Bool
supportsDistributedTraining = forall a. Maybe a
Prelude.Nothing,
        $sel:trainingImageDigest:TrainingSpecification' :: Maybe Text
trainingImageDigest = forall a. Maybe a
Prelude.Nothing,
        $sel:trainingImage:TrainingSpecification' :: Text
trainingImage = Text
pTrainingImage_,
        $sel:supportedTrainingInstanceTypes:TrainingSpecification' :: [TrainingInstanceType]
supportedTrainingInstanceTypes = forall a. Monoid a => a
Prelude.mempty,
        $sel:trainingChannels:TrainingSpecification' :: NonEmpty ChannelSpecification
trainingChannels =
          forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty ChannelSpecification
pTrainingChannels_
      }

-- | A list of @MetricDefinition@ objects, which are used for parsing metrics
-- generated by the algorithm.
trainingSpecification_metricDefinitions :: Lens.Lens' TrainingSpecification (Prelude.Maybe [MetricDefinition])
trainingSpecification_metricDefinitions :: Lens' TrainingSpecification (Maybe [MetricDefinition])
trainingSpecification_metricDefinitions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrainingSpecification' {Maybe [MetricDefinition]
metricDefinitions :: Maybe [MetricDefinition]
$sel:metricDefinitions:TrainingSpecification' :: TrainingSpecification -> Maybe [MetricDefinition]
metricDefinitions} -> Maybe [MetricDefinition]
metricDefinitions) (\s :: TrainingSpecification
s@TrainingSpecification' {} Maybe [MetricDefinition]
a -> TrainingSpecification
s {$sel:metricDefinitions:TrainingSpecification' :: Maybe [MetricDefinition]
metricDefinitions = Maybe [MetricDefinition]
a} :: TrainingSpecification) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A list of the @HyperParameterSpecification@ objects, that define the
-- supported hyperparameters. This is required if the algorithm supports
-- automatic model tuning.>
trainingSpecification_supportedHyperParameters :: Lens.Lens' TrainingSpecification (Prelude.Maybe [HyperParameterSpecification])
trainingSpecification_supportedHyperParameters :: Lens' TrainingSpecification (Maybe [HyperParameterSpecification])
trainingSpecification_supportedHyperParameters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrainingSpecification' {Maybe [HyperParameterSpecification]
supportedHyperParameters :: Maybe [HyperParameterSpecification]
$sel:supportedHyperParameters:TrainingSpecification' :: TrainingSpecification -> Maybe [HyperParameterSpecification]
supportedHyperParameters} -> Maybe [HyperParameterSpecification]
supportedHyperParameters) (\s :: TrainingSpecification
s@TrainingSpecification' {} Maybe [HyperParameterSpecification]
a -> TrainingSpecification
s {$sel:supportedHyperParameters:TrainingSpecification' :: Maybe [HyperParameterSpecification]
supportedHyperParameters = Maybe [HyperParameterSpecification]
a} :: TrainingSpecification) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A list of the metrics that the algorithm emits that can be used as the
-- objective metric in a hyperparameter tuning job.
trainingSpecification_supportedTuningJobObjectiveMetrics :: Lens.Lens' TrainingSpecification (Prelude.Maybe [HyperParameterTuningJobObjective])
trainingSpecification_supportedTuningJobObjectiveMetrics :: Lens'
  TrainingSpecification (Maybe [HyperParameterTuningJobObjective])
trainingSpecification_supportedTuningJobObjectiveMetrics = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrainingSpecification' {Maybe [HyperParameterTuningJobObjective]
supportedTuningJobObjectiveMetrics :: Maybe [HyperParameterTuningJobObjective]
$sel:supportedTuningJobObjectiveMetrics:TrainingSpecification' :: TrainingSpecification -> Maybe [HyperParameterTuningJobObjective]
supportedTuningJobObjectiveMetrics} -> Maybe [HyperParameterTuningJobObjective]
supportedTuningJobObjectiveMetrics) (\s :: TrainingSpecification
s@TrainingSpecification' {} Maybe [HyperParameterTuningJobObjective]
a -> TrainingSpecification
s {$sel:supportedTuningJobObjectiveMetrics:TrainingSpecification' :: Maybe [HyperParameterTuningJobObjective]
supportedTuningJobObjectiveMetrics = Maybe [HyperParameterTuningJobObjective]
a} :: TrainingSpecification) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Indicates whether the algorithm supports distributed training. If set to
-- false, buyers can\'t request more than one instance during training.
trainingSpecification_supportsDistributedTraining :: Lens.Lens' TrainingSpecification (Prelude.Maybe Prelude.Bool)
trainingSpecification_supportsDistributedTraining :: Lens' TrainingSpecification (Maybe Bool)
trainingSpecification_supportsDistributedTraining = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrainingSpecification' {Maybe Bool
supportsDistributedTraining :: Maybe Bool
$sel:supportsDistributedTraining:TrainingSpecification' :: TrainingSpecification -> Maybe Bool
supportsDistributedTraining} -> Maybe Bool
supportsDistributedTraining) (\s :: TrainingSpecification
s@TrainingSpecification' {} Maybe Bool
a -> TrainingSpecification
s {$sel:supportsDistributedTraining:TrainingSpecification' :: Maybe Bool
supportsDistributedTraining = Maybe Bool
a} :: TrainingSpecification)

-- | An MD5 hash of the training algorithm that identifies the Docker image
-- used for training.
trainingSpecification_trainingImageDigest :: Lens.Lens' TrainingSpecification (Prelude.Maybe Prelude.Text)
trainingSpecification_trainingImageDigest :: Lens' TrainingSpecification (Maybe Text)
trainingSpecification_trainingImageDigest = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrainingSpecification' {Maybe Text
trainingImageDigest :: Maybe Text
$sel:trainingImageDigest:TrainingSpecification' :: TrainingSpecification -> Maybe Text
trainingImageDigest} -> Maybe Text
trainingImageDigest) (\s :: TrainingSpecification
s@TrainingSpecification' {} Maybe Text
a -> TrainingSpecification
s {$sel:trainingImageDigest:TrainingSpecification' :: Maybe Text
trainingImageDigest = Maybe Text
a} :: TrainingSpecification)

-- | The Amazon ECR registry path of the Docker image that contains the
-- training algorithm.
trainingSpecification_trainingImage :: Lens.Lens' TrainingSpecification Prelude.Text
trainingSpecification_trainingImage :: Lens' TrainingSpecification Text
trainingSpecification_trainingImage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrainingSpecification' {Text
trainingImage :: Text
$sel:trainingImage:TrainingSpecification' :: TrainingSpecification -> Text
trainingImage} -> Text
trainingImage) (\s :: TrainingSpecification
s@TrainingSpecification' {} Text
a -> TrainingSpecification
s {$sel:trainingImage:TrainingSpecification' :: Text
trainingImage = Text
a} :: TrainingSpecification)

-- | A list of the instance types that this algorithm can use for training.
trainingSpecification_supportedTrainingInstanceTypes :: Lens.Lens' TrainingSpecification [TrainingInstanceType]
trainingSpecification_supportedTrainingInstanceTypes :: Lens' TrainingSpecification [TrainingInstanceType]
trainingSpecification_supportedTrainingInstanceTypes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrainingSpecification' {[TrainingInstanceType]
supportedTrainingInstanceTypes :: [TrainingInstanceType]
$sel:supportedTrainingInstanceTypes:TrainingSpecification' :: TrainingSpecification -> [TrainingInstanceType]
supportedTrainingInstanceTypes} -> [TrainingInstanceType]
supportedTrainingInstanceTypes) (\s :: TrainingSpecification
s@TrainingSpecification' {} [TrainingInstanceType]
a -> TrainingSpecification
s {$sel:supportedTrainingInstanceTypes:TrainingSpecification' :: [TrainingInstanceType]
supportedTrainingInstanceTypes = [TrainingInstanceType]
a} :: TrainingSpecification) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A list of @ChannelSpecification@ objects, which specify the input
-- sources to be used by the algorithm.
trainingSpecification_trainingChannels :: Lens.Lens' TrainingSpecification (Prelude.NonEmpty ChannelSpecification)
trainingSpecification_trainingChannels :: Lens' TrainingSpecification (NonEmpty ChannelSpecification)
trainingSpecification_trainingChannels = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrainingSpecification' {NonEmpty ChannelSpecification
trainingChannels :: NonEmpty ChannelSpecification
$sel:trainingChannels:TrainingSpecification' :: TrainingSpecification -> NonEmpty ChannelSpecification
trainingChannels} -> NonEmpty ChannelSpecification
trainingChannels) (\s :: TrainingSpecification
s@TrainingSpecification' {} NonEmpty ChannelSpecification
a -> TrainingSpecification
s {$sel:trainingChannels:TrainingSpecification' :: NonEmpty ChannelSpecification
trainingChannels = NonEmpty ChannelSpecification
a} :: TrainingSpecification) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON TrainingSpecification where
  parseJSON :: Value -> Parser TrainingSpecification
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TrainingSpecification"
      ( \Object
x ->
          Maybe [MetricDefinition]
-> Maybe [HyperParameterSpecification]
-> Maybe [HyperParameterTuningJobObjective]
-> Maybe Bool
-> Maybe Text
-> Text
-> [TrainingInstanceType]
-> NonEmpty ChannelSpecification
-> TrainingSpecification
TrainingSpecification'
            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
"MetricDefinitions"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            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
"SupportedHyperParameters"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            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
"SupportedTuningJobObjectiveMetrics"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            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
"SupportsDistributedTraining")
            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
"TrainingImageDigest")
            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
"TrainingImage")
            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
"SupportedTrainingInstanceTypes"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            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
"TrainingChannels")
      )

instance Prelude.Hashable TrainingSpecification where
  hashWithSalt :: Int -> TrainingSpecification -> Int
hashWithSalt Int
_salt TrainingSpecification' {[TrainingInstanceType]
Maybe Bool
Maybe [HyperParameterTuningJobObjective]
Maybe [MetricDefinition]
Maybe [HyperParameterSpecification]
Maybe Text
NonEmpty ChannelSpecification
Text
trainingChannels :: NonEmpty ChannelSpecification
supportedTrainingInstanceTypes :: [TrainingInstanceType]
trainingImage :: Text
trainingImageDigest :: Maybe Text
supportsDistributedTraining :: Maybe Bool
supportedTuningJobObjectiveMetrics :: Maybe [HyperParameterTuningJobObjective]
supportedHyperParameters :: Maybe [HyperParameterSpecification]
metricDefinitions :: Maybe [MetricDefinition]
$sel:trainingChannels:TrainingSpecification' :: TrainingSpecification -> NonEmpty ChannelSpecification
$sel:supportedTrainingInstanceTypes:TrainingSpecification' :: TrainingSpecification -> [TrainingInstanceType]
$sel:trainingImage:TrainingSpecification' :: TrainingSpecification -> Text
$sel:trainingImageDigest:TrainingSpecification' :: TrainingSpecification -> Maybe Text
$sel:supportsDistributedTraining:TrainingSpecification' :: TrainingSpecification -> Maybe Bool
$sel:supportedTuningJobObjectiveMetrics:TrainingSpecification' :: TrainingSpecification -> Maybe [HyperParameterTuningJobObjective]
$sel:supportedHyperParameters:TrainingSpecification' :: TrainingSpecification -> Maybe [HyperParameterSpecification]
$sel:metricDefinitions:TrainingSpecification' :: TrainingSpecification -> Maybe [MetricDefinition]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [MetricDefinition]
metricDefinitions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [HyperParameterSpecification]
supportedHyperParameters
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [HyperParameterTuningJobObjective]
supportedTuningJobObjectiveMetrics
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
supportsDistributedTraining
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
trainingImageDigest
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
trainingImage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [TrainingInstanceType]
supportedTrainingInstanceTypes
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty ChannelSpecification
trainingChannels

instance Prelude.NFData TrainingSpecification where
  rnf :: TrainingSpecification -> ()
rnf TrainingSpecification' {[TrainingInstanceType]
Maybe Bool
Maybe [HyperParameterTuningJobObjective]
Maybe [MetricDefinition]
Maybe [HyperParameterSpecification]
Maybe Text
NonEmpty ChannelSpecification
Text
trainingChannels :: NonEmpty ChannelSpecification
supportedTrainingInstanceTypes :: [TrainingInstanceType]
trainingImage :: Text
trainingImageDigest :: Maybe Text
supportsDistributedTraining :: Maybe Bool
supportedTuningJobObjectiveMetrics :: Maybe [HyperParameterTuningJobObjective]
supportedHyperParameters :: Maybe [HyperParameterSpecification]
metricDefinitions :: Maybe [MetricDefinition]
$sel:trainingChannels:TrainingSpecification' :: TrainingSpecification -> NonEmpty ChannelSpecification
$sel:supportedTrainingInstanceTypes:TrainingSpecification' :: TrainingSpecification -> [TrainingInstanceType]
$sel:trainingImage:TrainingSpecification' :: TrainingSpecification -> Text
$sel:trainingImageDigest:TrainingSpecification' :: TrainingSpecification -> Maybe Text
$sel:supportsDistributedTraining:TrainingSpecification' :: TrainingSpecification -> Maybe Bool
$sel:supportedTuningJobObjectiveMetrics:TrainingSpecification' :: TrainingSpecification -> Maybe [HyperParameterTuningJobObjective]
$sel:supportedHyperParameters:TrainingSpecification' :: TrainingSpecification -> Maybe [HyperParameterSpecification]
$sel:metricDefinitions:TrainingSpecification' :: TrainingSpecification -> Maybe [MetricDefinition]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [MetricDefinition]
metricDefinitions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [HyperParameterSpecification]
supportedHyperParameters
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [HyperParameterTuningJobObjective]
supportedTuningJobObjectiveMetrics
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
supportsDistributedTraining
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
trainingImageDigest
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
trainingImage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [TrainingInstanceType]
supportedTrainingInstanceTypes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty ChannelSpecification
trainingChannels

instance Data.ToJSON TrainingSpecification where
  toJSON :: TrainingSpecification -> Value
toJSON TrainingSpecification' {[TrainingInstanceType]
Maybe Bool
Maybe [HyperParameterTuningJobObjective]
Maybe [MetricDefinition]
Maybe [HyperParameterSpecification]
Maybe Text
NonEmpty ChannelSpecification
Text
trainingChannels :: NonEmpty ChannelSpecification
supportedTrainingInstanceTypes :: [TrainingInstanceType]
trainingImage :: Text
trainingImageDigest :: Maybe Text
supportsDistributedTraining :: Maybe Bool
supportedTuningJobObjectiveMetrics :: Maybe [HyperParameterTuningJobObjective]
supportedHyperParameters :: Maybe [HyperParameterSpecification]
metricDefinitions :: Maybe [MetricDefinition]
$sel:trainingChannels:TrainingSpecification' :: TrainingSpecification -> NonEmpty ChannelSpecification
$sel:supportedTrainingInstanceTypes:TrainingSpecification' :: TrainingSpecification -> [TrainingInstanceType]
$sel:trainingImage:TrainingSpecification' :: TrainingSpecification -> Text
$sel:trainingImageDigest:TrainingSpecification' :: TrainingSpecification -> Maybe Text
$sel:supportsDistributedTraining:TrainingSpecification' :: TrainingSpecification -> Maybe Bool
$sel:supportedTuningJobObjectiveMetrics:TrainingSpecification' :: TrainingSpecification -> Maybe [HyperParameterTuningJobObjective]
$sel:supportedHyperParameters:TrainingSpecification' :: TrainingSpecification -> Maybe [HyperParameterSpecification]
$sel:metricDefinitions:TrainingSpecification' :: TrainingSpecification -> Maybe [MetricDefinition]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"MetricDefinitions" 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 [MetricDefinition]
metricDefinitions,
            (Key
"SupportedHyperParameters" 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 [HyperParameterSpecification]
supportedHyperParameters,
            (Key
"SupportedTuningJobObjectiveMetrics" 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]
supportedTuningJobObjectiveMetrics,
            (Key
"SupportsDistributedTraining" 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 Bool
supportsDistributedTraining,
            (Key
"TrainingImageDigest" 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 Text
trainingImageDigest,
            forall a. a -> Maybe a
Prelude.Just (Key
"TrainingImage" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
trainingImage),
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"SupportedTrainingInstanceTypes"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [TrainingInstanceType]
supportedTrainingInstanceTypes
              ),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"TrainingChannels" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty ChannelSpecification
trainingChannels)
          ]
      )