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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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'
  { -- | An MD5 hash of the training algorithm that identifies the Docker image
    -- used for training.
    TrainingSpecification -> Maybe Text
trainingImageDigest :: Prelude.Maybe Prelude.Text,
    -- | 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,
    -- | 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],
    -- | A list of @MetricDefinition@ objects, which are used for parsing metrics
    -- generated by the algorithm.
    TrainingSpecification -> Maybe [MetricDefinition]
metricDefinitions :: Prelude.Maybe [MetricDefinition],
    -- | 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
(TrainingSpecification -> TrainingSpecification -> Bool)
-> (TrainingSpecification -> TrainingSpecification -> Bool)
-> Eq TrainingSpecification
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]
(Int -> ReadS TrainingSpecification)
-> ReadS [TrainingSpecification]
-> ReadPrec TrainingSpecification
-> ReadPrec [TrainingSpecification]
-> Read 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
(Int -> TrainingSpecification -> ShowS)
-> (TrainingSpecification -> String)
-> ([TrainingSpecification] -> ShowS)
-> Show TrainingSpecification
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. TrainingSpecification -> Rep TrainingSpecification x)
-> (forall x. Rep TrainingSpecification x -> TrainingSpecification)
-> Generic TrainingSpecification
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:
--
-- 'trainingImageDigest', 'trainingSpecification_trainingImageDigest' - An MD5 hash of the training algorithm that identifies the Docker image
-- used for training.
--
-- 'supportsDistributedTraining', 'trainingSpecification_supportsDistributedTraining' - Indicates whether the algorithm supports distributed training. If set to
-- false, buyers can\'t request more than one instance during training.
--
-- '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.
--
-- 'metricDefinitions', 'trainingSpecification_metricDefinitions' - A list of @MetricDefinition@ objects, which are used for parsing metrics
-- generated by the algorithm.
--
-- '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' :: Maybe Text
-> Maybe Bool
-> Maybe [HyperParameterSpecification]
-> Maybe [HyperParameterTuningJobObjective]
-> Maybe [MetricDefinition]
-> Text
-> [TrainingInstanceType]
-> NonEmpty ChannelSpecification
-> TrainingSpecification
TrainingSpecification'
      { $sel:trainingImageDigest:TrainingSpecification' :: Maybe Text
trainingImageDigest =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:supportsDistributedTraining:TrainingSpecification' :: Maybe Bool
supportsDistributedTraining = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:supportedHyperParameters:TrainingSpecification' :: Maybe [HyperParameterSpecification]
supportedHyperParameters = Maybe [HyperParameterSpecification]
forall a. Maybe a
Prelude.Nothing,
        $sel:supportedTuningJobObjectiveMetrics:TrainingSpecification' :: Maybe [HyperParameterTuningJobObjective]
supportedTuningJobObjectiveMetrics = Maybe [HyperParameterTuningJobObjective]
forall a. Maybe a
Prelude.Nothing,
        $sel:metricDefinitions:TrainingSpecification' :: Maybe [MetricDefinition]
metricDefinitions = Maybe [MetricDefinition]
forall a. Maybe a
Prelude.Nothing,
        $sel:trainingImage:TrainingSpecification' :: Text
trainingImage = Text
pTrainingImage_,
        $sel:supportedTrainingInstanceTypes:TrainingSpecification' :: [TrainingInstanceType]
supportedTrainingInstanceTypes = [TrainingInstanceType]
forall a. Monoid a => a
Prelude.mempty,
        $sel:trainingChannels:TrainingSpecification' :: NonEmpty ChannelSpecification
trainingChannels =
          Tagged
  (NonEmpty ChannelSpecification)
  (Identity (NonEmpty ChannelSpecification))
-> Tagged
     (NonEmpty ChannelSpecification)
     (Identity (NonEmpty ChannelSpecification))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged
   (NonEmpty ChannelSpecification)
   (Identity (NonEmpty ChannelSpecification))
 -> Tagged
      (NonEmpty ChannelSpecification)
      (Identity (NonEmpty ChannelSpecification)))
-> NonEmpty ChannelSpecification -> NonEmpty ChannelSpecification
forall t b. AReview t b -> b -> t
Lens.# NonEmpty ChannelSpecification
pTrainingChannels_
      }

-- | 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 :: (Maybe Text -> f (Maybe Text))
-> TrainingSpecification -> f TrainingSpecification
trainingSpecification_trainingImageDigest = (TrainingSpecification -> Maybe Text)
-> (TrainingSpecification -> Maybe Text -> TrainingSpecification)
-> Lens
     TrainingSpecification
     TrainingSpecification
     (Maybe Text)
     (Maybe Text)
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)

-- | 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 :: (Maybe Bool -> f (Maybe Bool))
-> TrainingSpecification -> f TrainingSpecification
trainingSpecification_supportsDistributedTraining = (TrainingSpecification -> Maybe Bool)
-> (TrainingSpecification -> Maybe Bool -> TrainingSpecification)
-> Lens
     TrainingSpecification
     TrainingSpecification
     (Maybe Bool)
     (Maybe Bool)
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)

-- | 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 :: (Maybe [HyperParameterSpecification]
 -> f (Maybe [HyperParameterSpecification]))
-> TrainingSpecification -> f TrainingSpecification
trainingSpecification_supportedHyperParameters = (TrainingSpecification -> Maybe [HyperParameterSpecification])
-> (TrainingSpecification
    -> Maybe [HyperParameterSpecification] -> TrainingSpecification)
-> Lens
     TrainingSpecification
     TrainingSpecification
     (Maybe [HyperParameterSpecification])
     (Maybe [HyperParameterSpecification])
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) ((Maybe [HyperParameterSpecification]
  -> f (Maybe [HyperParameterSpecification]))
 -> TrainingSpecification -> f TrainingSpecification)
-> ((Maybe [HyperParameterSpecification]
     -> f (Maybe [HyperParameterSpecification]))
    -> Maybe [HyperParameterSpecification]
    -> f (Maybe [HyperParameterSpecification]))
-> (Maybe [HyperParameterSpecification]
    -> f (Maybe [HyperParameterSpecification]))
-> TrainingSpecification
-> f TrainingSpecification
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [HyperParameterSpecification]
  [HyperParameterSpecification]
  [HyperParameterSpecification]
  [HyperParameterSpecification]
-> Iso
     (Maybe [HyperParameterSpecification])
     (Maybe [HyperParameterSpecification])
     (Maybe [HyperParameterSpecification])
     (Maybe [HyperParameterSpecification])
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 AnIso
  [HyperParameterSpecification]
  [HyperParameterSpecification]
  [HyperParameterSpecification]
  [HyperParameterSpecification]
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 :: (Maybe [HyperParameterTuningJobObjective]
 -> f (Maybe [HyperParameterTuningJobObjective]))
-> TrainingSpecification -> f TrainingSpecification
trainingSpecification_supportedTuningJobObjectiveMetrics = (TrainingSpecification -> Maybe [HyperParameterTuningJobObjective])
-> (TrainingSpecification
    -> Maybe [HyperParameterTuningJobObjective]
    -> TrainingSpecification)
-> Lens
     TrainingSpecification
     TrainingSpecification
     (Maybe [HyperParameterTuningJobObjective])
     (Maybe [HyperParameterTuningJobObjective])
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) ((Maybe [HyperParameterTuningJobObjective]
  -> f (Maybe [HyperParameterTuningJobObjective]))
 -> TrainingSpecification -> f TrainingSpecification)
-> ((Maybe [HyperParameterTuningJobObjective]
     -> f (Maybe [HyperParameterTuningJobObjective]))
    -> Maybe [HyperParameterTuningJobObjective]
    -> f (Maybe [HyperParameterTuningJobObjective]))
-> (Maybe [HyperParameterTuningJobObjective]
    -> f (Maybe [HyperParameterTuningJobObjective]))
-> TrainingSpecification
-> f TrainingSpecification
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [HyperParameterTuningJobObjective]
  [HyperParameterTuningJobObjective]
  [HyperParameterTuningJobObjective]
  [HyperParameterTuningJobObjective]
-> Iso
     (Maybe [HyperParameterTuningJobObjective])
     (Maybe [HyperParameterTuningJobObjective])
     (Maybe [HyperParameterTuningJobObjective])
     (Maybe [HyperParameterTuningJobObjective])
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 AnIso
  [HyperParameterTuningJobObjective]
  [HyperParameterTuningJobObjective]
  [HyperParameterTuningJobObjective]
  [HyperParameterTuningJobObjective]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | 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 :: (Maybe [MetricDefinition] -> f (Maybe [MetricDefinition]))
-> TrainingSpecification -> f TrainingSpecification
trainingSpecification_metricDefinitions = (TrainingSpecification -> Maybe [MetricDefinition])
-> (TrainingSpecification
    -> Maybe [MetricDefinition] -> TrainingSpecification)
-> Lens
     TrainingSpecification
     TrainingSpecification
     (Maybe [MetricDefinition])
     (Maybe [MetricDefinition])
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) ((Maybe [MetricDefinition] -> f (Maybe [MetricDefinition]))
 -> TrainingSpecification -> f TrainingSpecification)
-> ((Maybe [MetricDefinition] -> f (Maybe [MetricDefinition]))
    -> Maybe [MetricDefinition] -> f (Maybe [MetricDefinition]))
-> (Maybe [MetricDefinition] -> f (Maybe [MetricDefinition]))
-> TrainingSpecification
-> f TrainingSpecification
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [MetricDefinition]
  [MetricDefinition]
  [MetricDefinition]
  [MetricDefinition]
-> Iso
     (Maybe [MetricDefinition])
     (Maybe [MetricDefinition])
     (Maybe [MetricDefinition])
     (Maybe [MetricDefinition])
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 AnIso
  [MetricDefinition]
  [MetricDefinition]
  [MetricDefinition]
  [MetricDefinition]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The Amazon ECR registry path of the Docker image that contains the
-- training algorithm.
trainingSpecification_trainingImage :: Lens.Lens' TrainingSpecification Prelude.Text
trainingSpecification_trainingImage :: (Text -> f Text)
-> TrainingSpecification -> f TrainingSpecification
trainingSpecification_trainingImage = (TrainingSpecification -> Text)
-> (TrainingSpecification -> Text -> TrainingSpecification)
-> Lens TrainingSpecification TrainingSpecification Text Text
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 :: ([TrainingInstanceType] -> f [TrainingInstanceType])
-> TrainingSpecification -> f TrainingSpecification
trainingSpecification_supportedTrainingInstanceTypes = (TrainingSpecification -> [TrainingInstanceType])
-> (TrainingSpecification
    -> [TrainingInstanceType] -> TrainingSpecification)
-> Lens
     TrainingSpecification
     TrainingSpecification
     [TrainingInstanceType]
     [TrainingInstanceType]
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) (([TrainingInstanceType] -> f [TrainingInstanceType])
 -> TrainingSpecification -> f TrainingSpecification)
-> (([TrainingInstanceType] -> f [TrainingInstanceType])
    -> [TrainingInstanceType] -> f [TrainingInstanceType])
-> ([TrainingInstanceType] -> f [TrainingInstanceType])
-> TrainingSpecification
-> f TrainingSpecification
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([TrainingInstanceType] -> f [TrainingInstanceType])
-> [TrainingInstanceType] -> f [TrainingInstanceType]
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 :: (NonEmpty ChannelSpecification
 -> f (NonEmpty ChannelSpecification))
-> TrainingSpecification -> f TrainingSpecification
trainingSpecification_trainingChannels = (TrainingSpecification -> NonEmpty ChannelSpecification)
-> (TrainingSpecification
    -> NonEmpty ChannelSpecification -> TrainingSpecification)
-> Lens
     TrainingSpecification
     TrainingSpecification
     (NonEmpty ChannelSpecification)
     (NonEmpty ChannelSpecification)
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) ((NonEmpty ChannelSpecification
  -> f (NonEmpty ChannelSpecification))
 -> TrainingSpecification -> f TrainingSpecification)
-> ((NonEmpty ChannelSpecification
     -> f (NonEmpty ChannelSpecification))
    -> NonEmpty ChannelSpecification
    -> f (NonEmpty ChannelSpecification))
-> (NonEmpty ChannelSpecification
    -> f (NonEmpty ChannelSpecification))
-> TrainingSpecification
-> f TrainingSpecification
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty ChannelSpecification
 -> f (NonEmpty ChannelSpecification))
-> NonEmpty ChannelSpecification
-> f (NonEmpty ChannelSpecification)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON TrainingSpecification where
  parseJSON :: Value -> Parser TrainingSpecification
parseJSON =
    String
-> (Object -> Parser TrainingSpecification)
-> Value
-> Parser TrainingSpecification
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TrainingSpecification"
      ( \Object
x ->
          Maybe Text
-> Maybe Bool
-> Maybe [HyperParameterSpecification]
-> Maybe [HyperParameterTuningJobObjective]
-> Maybe [MetricDefinition]
-> Text
-> [TrainingInstanceType]
-> NonEmpty ChannelSpecification
-> TrainingSpecification
TrainingSpecification'
            (Maybe Text
 -> Maybe Bool
 -> Maybe [HyperParameterSpecification]
 -> Maybe [HyperParameterTuningJobObjective]
 -> Maybe [MetricDefinition]
 -> Text
 -> [TrainingInstanceType]
 -> NonEmpty ChannelSpecification
 -> TrainingSpecification)
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool
      -> Maybe [HyperParameterSpecification]
      -> Maybe [HyperParameterTuningJobObjective]
      -> Maybe [MetricDefinition]
      -> Text
      -> [TrainingInstanceType]
      -> NonEmpty ChannelSpecification
      -> TrainingSpecification)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TrainingImageDigest")
            Parser
  (Maybe Bool
   -> Maybe [HyperParameterSpecification]
   -> Maybe [HyperParameterTuningJobObjective]
   -> Maybe [MetricDefinition]
   -> Text
   -> [TrainingInstanceType]
   -> NonEmpty ChannelSpecification
   -> TrainingSpecification)
-> Parser (Maybe Bool)
-> Parser
     (Maybe [HyperParameterSpecification]
      -> Maybe [HyperParameterTuningJobObjective]
      -> Maybe [MetricDefinition]
      -> Text
      -> [TrainingInstanceType]
      -> NonEmpty ChannelSpecification
      -> TrainingSpecification)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SupportsDistributedTraining")
            Parser
  (Maybe [HyperParameterSpecification]
   -> Maybe [HyperParameterTuningJobObjective]
   -> Maybe [MetricDefinition]
   -> Text
   -> [TrainingInstanceType]
   -> NonEmpty ChannelSpecification
   -> TrainingSpecification)
-> Parser (Maybe [HyperParameterSpecification])
-> Parser
     (Maybe [HyperParameterTuningJobObjective]
      -> Maybe [MetricDefinition]
      -> Text
      -> [TrainingInstanceType]
      -> NonEmpty ChannelSpecification
      -> TrainingSpecification)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object
-> Text -> Parser (Maybe (Maybe [HyperParameterSpecification]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SupportedHyperParameters"
                            Parser (Maybe (Maybe [HyperParameterSpecification]))
-> Maybe [HyperParameterSpecification]
-> Parser (Maybe [HyperParameterSpecification])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [HyperParameterSpecification]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe [HyperParameterTuningJobObjective]
   -> Maybe [MetricDefinition]
   -> Text
   -> [TrainingInstanceType]
   -> NonEmpty ChannelSpecification
   -> TrainingSpecification)
-> Parser (Maybe [HyperParameterTuningJobObjective])
-> Parser
     (Maybe [MetricDefinition]
      -> Text
      -> [TrainingInstanceType]
      -> NonEmpty ChannelSpecification
      -> TrainingSpecification)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object
-> Text
-> Parser (Maybe (Maybe [HyperParameterTuningJobObjective]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SupportedTuningJobObjectiveMetrics"
                            Parser (Maybe (Maybe [HyperParameterTuningJobObjective]))
-> Maybe [HyperParameterTuningJobObjective]
-> Parser (Maybe [HyperParameterTuningJobObjective])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [HyperParameterTuningJobObjective]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe [MetricDefinition]
   -> Text
   -> [TrainingInstanceType]
   -> NonEmpty ChannelSpecification
   -> TrainingSpecification)
-> Parser (Maybe [MetricDefinition])
-> Parser
     (Text
      -> [TrainingInstanceType]
      -> NonEmpty ChannelSpecification
      -> TrainingSpecification)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [MetricDefinition]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MetricDefinitions"
                            Parser (Maybe (Maybe [MetricDefinition]))
-> Maybe [MetricDefinition] -> Parser (Maybe [MetricDefinition])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [MetricDefinition]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Text
   -> [TrainingInstanceType]
   -> NonEmpty ChannelSpecification
   -> TrainingSpecification)
-> Parser Text
-> Parser
     ([TrainingInstanceType]
      -> NonEmpty ChannelSpecification -> TrainingSpecification)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"TrainingImage")
            Parser
  ([TrainingInstanceType]
   -> NonEmpty ChannelSpecification -> TrainingSpecification)
-> Parser [TrainingInstanceType]
-> Parser (NonEmpty ChannelSpecification -> TrainingSpecification)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe [TrainingInstanceType])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SupportedTrainingInstanceTypes"
                            Parser (Maybe [TrainingInstanceType])
-> [TrainingInstanceType] -> Parser [TrainingInstanceType]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [TrainingInstanceType]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (NonEmpty ChannelSpecification -> TrainingSpecification)
-> Parser (NonEmpty ChannelSpecification)
-> Parser TrainingSpecification
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (NonEmpty ChannelSpecification)
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"TrainingChannels")
      )

instance Prelude.Hashable TrainingSpecification

instance Prelude.NFData TrainingSpecification

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