{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.CreateHyperParameterTuningJob
-- 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)
--
-- Starts a hyperparameter tuning job. A hyperparameter tuning job finds
-- the best version of a model by running many training jobs on your
-- dataset using the algorithm you choose and values for hyperparameters
-- within ranges that you specify. It then chooses the hyperparameter
-- values that result in a model that performs the best, as measured by an
-- objective metric that you choose.
module Amazonka.SageMaker.CreateHyperParameterTuningJob
  ( -- * Creating a Request
    CreateHyperParameterTuningJob (..),
    newCreateHyperParameterTuningJob,

    -- * Request Lenses
    createHyperParameterTuningJob_trainingJobDefinition,
    createHyperParameterTuningJob_warmStartConfig,
    createHyperParameterTuningJob_tags,
    createHyperParameterTuningJob_trainingJobDefinitions,
    createHyperParameterTuningJob_hyperParameterTuningJobName,
    createHyperParameterTuningJob_hyperParameterTuningJobConfig,

    -- * Destructuring the Response
    CreateHyperParameterTuningJobResponse (..),
    newCreateHyperParameterTuningJobResponse,

    -- * Response Lenses
    createHyperParameterTuningJobResponse_httpStatus,
    createHyperParameterTuningJobResponse_hyperParameterTuningJobArn,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SageMaker.Types

-- | /See:/ 'newCreateHyperParameterTuningJob' smart constructor.
data CreateHyperParameterTuningJob = CreateHyperParameterTuningJob'
  { -- | The HyperParameterTrainingJobDefinition object that describes the
    -- training jobs that this tuning job launches, including static
    -- hyperparameters, input data configuration, output data configuration,
    -- resource configuration, and stopping condition.
    CreateHyperParameterTuningJob
-> Maybe HyperParameterTrainingJobDefinition
trainingJobDefinition :: Prelude.Maybe HyperParameterTrainingJobDefinition,
    -- | Specifies the configuration for starting the hyperparameter tuning job
    -- using one or more previous tuning jobs as a starting point. The results
    -- of previous tuning jobs are used to inform which combinations of
    -- hyperparameters to search over in the new tuning job.
    --
    -- All training jobs launched by the new hyperparameter tuning job are
    -- evaluated by using the objective metric. If you specify
    -- @IDENTICAL_DATA_AND_ALGORITHM@ as the @WarmStartType@ value for the warm
    -- start configuration, the training job that performs the best in the new
    -- tuning job is compared to the best training jobs from the parent tuning
    -- jobs. From these, the training job that performs the best as measured by
    -- the objective metric is returned as the overall best training job.
    --
    -- All training jobs launched by parent hyperparameter tuning jobs and the
    -- new hyperparameter tuning jobs count against the limit of training jobs
    -- for the tuning job.
    CreateHyperParameterTuningJob
-> Maybe HyperParameterTuningJobWarmStartConfig
warmStartConfig :: Prelude.Maybe HyperParameterTuningJobWarmStartConfig,
    -- | An array of key-value pairs. You can use tags to categorize your Amazon
    -- Web Services resources in different ways, for example, by purpose,
    -- owner, or environment. For more information, see
    -- <https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html Tagging Amazon Web Services Resources>.
    --
    -- Tags that you specify for the tuning job are also added to all training
    -- jobs that the tuning job launches.
    CreateHyperParameterTuningJob -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | A list of the HyperParameterTrainingJobDefinition objects launched for
    -- this tuning job.
    CreateHyperParameterTuningJob
-> Maybe (NonEmpty HyperParameterTrainingJobDefinition)
trainingJobDefinitions :: Prelude.Maybe (Prelude.NonEmpty HyperParameterTrainingJobDefinition),
    -- | The name of the tuning job. This name is the prefix for the names of all
    -- training jobs that this tuning job launches. The name must be unique
    -- within the same Amazon Web Services account and Amazon Web Services
    -- Region. The name must have 1 to 32 characters. Valid characters are a-z,
    -- A-Z, 0-9, and : + = \@ _ % - (hyphen). The name is not case sensitive.
    CreateHyperParameterTuningJob -> Text
hyperParameterTuningJobName :: Prelude.Text,
    -- | The HyperParameterTuningJobConfig object that describes the tuning job,
    -- including the search strategy, the objective metric used to evaluate
    -- training jobs, ranges of parameters to search, and resource limits for
    -- the tuning job. For more information, see
    -- <https://docs.aws.amazon.com/sagemaker/latest/dg/automatic-model-tuning-how-it-works.html How Hyperparameter Tuning Works>.
    CreateHyperParameterTuningJob -> HyperParameterTuningJobConfig
hyperParameterTuningJobConfig :: HyperParameterTuningJobConfig
  }
  deriving (CreateHyperParameterTuningJob
-> CreateHyperParameterTuningJob -> Bool
(CreateHyperParameterTuningJob
 -> CreateHyperParameterTuningJob -> Bool)
-> (CreateHyperParameterTuningJob
    -> CreateHyperParameterTuningJob -> Bool)
-> Eq CreateHyperParameterTuningJob
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateHyperParameterTuningJob
-> CreateHyperParameterTuningJob -> Bool
$c/= :: CreateHyperParameterTuningJob
-> CreateHyperParameterTuningJob -> Bool
== :: CreateHyperParameterTuningJob
-> CreateHyperParameterTuningJob -> Bool
$c== :: CreateHyperParameterTuningJob
-> CreateHyperParameterTuningJob -> Bool
Prelude.Eq, ReadPrec [CreateHyperParameterTuningJob]
ReadPrec CreateHyperParameterTuningJob
Int -> ReadS CreateHyperParameterTuningJob
ReadS [CreateHyperParameterTuningJob]
(Int -> ReadS CreateHyperParameterTuningJob)
-> ReadS [CreateHyperParameterTuningJob]
-> ReadPrec CreateHyperParameterTuningJob
-> ReadPrec [CreateHyperParameterTuningJob]
-> Read CreateHyperParameterTuningJob
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateHyperParameterTuningJob]
$creadListPrec :: ReadPrec [CreateHyperParameterTuningJob]
readPrec :: ReadPrec CreateHyperParameterTuningJob
$creadPrec :: ReadPrec CreateHyperParameterTuningJob
readList :: ReadS [CreateHyperParameterTuningJob]
$creadList :: ReadS [CreateHyperParameterTuningJob]
readsPrec :: Int -> ReadS CreateHyperParameterTuningJob
$creadsPrec :: Int -> ReadS CreateHyperParameterTuningJob
Prelude.Read, Int -> CreateHyperParameterTuningJob -> ShowS
[CreateHyperParameterTuningJob] -> ShowS
CreateHyperParameterTuningJob -> String
(Int -> CreateHyperParameterTuningJob -> ShowS)
-> (CreateHyperParameterTuningJob -> String)
-> ([CreateHyperParameterTuningJob] -> ShowS)
-> Show CreateHyperParameterTuningJob
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateHyperParameterTuningJob] -> ShowS
$cshowList :: [CreateHyperParameterTuningJob] -> ShowS
show :: CreateHyperParameterTuningJob -> String
$cshow :: CreateHyperParameterTuningJob -> String
showsPrec :: Int -> CreateHyperParameterTuningJob -> ShowS
$cshowsPrec :: Int -> CreateHyperParameterTuningJob -> ShowS
Prelude.Show, (forall x.
 CreateHyperParameterTuningJob
 -> Rep CreateHyperParameterTuningJob x)
-> (forall x.
    Rep CreateHyperParameterTuningJob x
    -> CreateHyperParameterTuningJob)
-> Generic CreateHyperParameterTuningJob
forall x.
Rep CreateHyperParameterTuningJob x
-> CreateHyperParameterTuningJob
forall x.
CreateHyperParameterTuningJob
-> Rep CreateHyperParameterTuningJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateHyperParameterTuningJob x
-> CreateHyperParameterTuningJob
$cfrom :: forall x.
CreateHyperParameterTuningJob
-> Rep CreateHyperParameterTuningJob x
Prelude.Generic)

-- |
-- Create a value of 'CreateHyperParameterTuningJob' 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:
--
-- 'trainingJobDefinition', 'createHyperParameterTuningJob_trainingJobDefinition' - The HyperParameterTrainingJobDefinition object that describes the
-- training jobs that this tuning job launches, including static
-- hyperparameters, input data configuration, output data configuration,
-- resource configuration, and stopping condition.
--
-- 'warmStartConfig', 'createHyperParameterTuningJob_warmStartConfig' - Specifies the configuration for starting the hyperparameter tuning job
-- using one or more previous tuning jobs as a starting point. The results
-- of previous tuning jobs are used to inform which combinations of
-- hyperparameters to search over in the new tuning job.
--
-- All training jobs launched by the new hyperparameter tuning job are
-- evaluated by using the objective metric. If you specify
-- @IDENTICAL_DATA_AND_ALGORITHM@ as the @WarmStartType@ value for the warm
-- start configuration, the training job that performs the best in the new
-- tuning job is compared to the best training jobs from the parent tuning
-- jobs. From these, the training job that performs the best as measured by
-- the objective metric is returned as the overall best training job.
--
-- All training jobs launched by parent hyperparameter tuning jobs and the
-- new hyperparameter tuning jobs count against the limit of training jobs
-- for the tuning job.
--
-- 'tags', 'createHyperParameterTuningJob_tags' - An array of key-value pairs. You can use tags to categorize your Amazon
-- Web Services resources in different ways, for example, by purpose,
-- owner, or environment. For more information, see
-- <https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html Tagging Amazon Web Services Resources>.
--
-- Tags that you specify for the tuning job are also added to all training
-- jobs that the tuning job launches.
--
-- 'trainingJobDefinitions', 'createHyperParameterTuningJob_trainingJobDefinitions' - A list of the HyperParameterTrainingJobDefinition objects launched for
-- this tuning job.
--
-- 'hyperParameterTuningJobName', 'createHyperParameterTuningJob_hyperParameterTuningJobName' - The name of the tuning job. This name is the prefix for the names of all
-- training jobs that this tuning job launches. The name must be unique
-- within the same Amazon Web Services account and Amazon Web Services
-- Region. The name must have 1 to 32 characters. Valid characters are a-z,
-- A-Z, 0-9, and : + = \@ _ % - (hyphen). The name is not case sensitive.
--
-- 'hyperParameterTuningJobConfig', 'createHyperParameterTuningJob_hyperParameterTuningJobConfig' - The HyperParameterTuningJobConfig object that describes the tuning job,
-- including the search strategy, the objective metric used to evaluate
-- training jobs, ranges of parameters to search, and resource limits for
-- the tuning job. For more information, see
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/automatic-model-tuning-how-it-works.html How Hyperparameter Tuning Works>.
newCreateHyperParameterTuningJob ::
  -- | 'hyperParameterTuningJobName'
  Prelude.Text ->
  -- | 'hyperParameterTuningJobConfig'
  HyperParameterTuningJobConfig ->
  CreateHyperParameterTuningJob
newCreateHyperParameterTuningJob :: Text
-> HyperParameterTuningJobConfig -> CreateHyperParameterTuningJob
newCreateHyperParameterTuningJob
  Text
pHyperParameterTuningJobName_
  HyperParameterTuningJobConfig
pHyperParameterTuningJobConfig_ =
    CreateHyperParameterTuningJob' :: Maybe HyperParameterTrainingJobDefinition
-> Maybe HyperParameterTuningJobWarmStartConfig
-> Maybe [Tag]
-> Maybe (NonEmpty HyperParameterTrainingJobDefinition)
-> Text
-> HyperParameterTuningJobConfig
-> CreateHyperParameterTuningJob
CreateHyperParameterTuningJob'
      { $sel:trainingJobDefinition:CreateHyperParameterTuningJob' :: Maybe HyperParameterTrainingJobDefinition
trainingJobDefinition =
          Maybe HyperParameterTrainingJobDefinition
forall a. Maybe a
Prelude.Nothing,
        $sel:warmStartConfig:CreateHyperParameterTuningJob' :: Maybe HyperParameterTuningJobWarmStartConfig
warmStartConfig = Maybe HyperParameterTuningJobWarmStartConfig
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateHyperParameterTuningJob' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:trainingJobDefinitions:CreateHyperParameterTuningJob' :: Maybe (NonEmpty HyperParameterTrainingJobDefinition)
trainingJobDefinitions = Maybe (NonEmpty HyperParameterTrainingJobDefinition)
forall a. Maybe a
Prelude.Nothing,
        $sel:hyperParameterTuningJobName:CreateHyperParameterTuningJob' :: Text
hyperParameterTuningJobName =
          Text
pHyperParameterTuningJobName_,
        $sel:hyperParameterTuningJobConfig:CreateHyperParameterTuningJob' :: HyperParameterTuningJobConfig
hyperParameterTuningJobConfig =
          HyperParameterTuningJobConfig
pHyperParameterTuningJobConfig_
      }

-- | The HyperParameterTrainingJobDefinition object that describes the
-- training jobs that this tuning job launches, including static
-- hyperparameters, input data configuration, output data configuration,
-- resource configuration, and stopping condition.
createHyperParameterTuningJob_trainingJobDefinition :: Lens.Lens' CreateHyperParameterTuningJob (Prelude.Maybe HyperParameterTrainingJobDefinition)
createHyperParameterTuningJob_trainingJobDefinition :: (Maybe HyperParameterTrainingJobDefinition
 -> f (Maybe HyperParameterTrainingJobDefinition))
-> CreateHyperParameterTuningJob -> f CreateHyperParameterTuningJob
createHyperParameterTuningJob_trainingJobDefinition = (CreateHyperParameterTuningJob
 -> Maybe HyperParameterTrainingJobDefinition)
-> (CreateHyperParameterTuningJob
    -> Maybe HyperParameterTrainingJobDefinition
    -> CreateHyperParameterTuningJob)
-> Lens
     CreateHyperParameterTuningJob
     CreateHyperParameterTuningJob
     (Maybe HyperParameterTrainingJobDefinition)
     (Maybe HyperParameterTrainingJobDefinition)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHyperParameterTuningJob' {Maybe HyperParameterTrainingJobDefinition
trainingJobDefinition :: Maybe HyperParameterTrainingJobDefinition
$sel:trainingJobDefinition:CreateHyperParameterTuningJob' :: CreateHyperParameterTuningJob
-> Maybe HyperParameterTrainingJobDefinition
trainingJobDefinition} -> Maybe HyperParameterTrainingJobDefinition
trainingJobDefinition) (\s :: CreateHyperParameterTuningJob
s@CreateHyperParameterTuningJob' {} Maybe HyperParameterTrainingJobDefinition
a -> CreateHyperParameterTuningJob
s {$sel:trainingJobDefinition:CreateHyperParameterTuningJob' :: Maybe HyperParameterTrainingJobDefinition
trainingJobDefinition = Maybe HyperParameterTrainingJobDefinition
a} :: CreateHyperParameterTuningJob)

-- | Specifies the configuration for starting the hyperparameter tuning job
-- using one or more previous tuning jobs as a starting point. The results
-- of previous tuning jobs are used to inform which combinations of
-- hyperparameters to search over in the new tuning job.
--
-- All training jobs launched by the new hyperparameter tuning job are
-- evaluated by using the objective metric. If you specify
-- @IDENTICAL_DATA_AND_ALGORITHM@ as the @WarmStartType@ value for the warm
-- start configuration, the training job that performs the best in the new
-- tuning job is compared to the best training jobs from the parent tuning
-- jobs. From these, the training job that performs the best as measured by
-- the objective metric is returned as the overall best training job.
--
-- All training jobs launched by parent hyperparameter tuning jobs and the
-- new hyperparameter tuning jobs count against the limit of training jobs
-- for the tuning job.
createHyperParameterTuningJob_warmStartConfig :: Lens.Lens' CreateHyperParameterTuningJob (Prelude.Maybe HyperParameterTuningJobWarmStartConfig)
createHyperParameterTuningJob_warmStartConfig :: (Maybe HyperParameterTuningJobWarmStartConfig
 -> f (Maybe HyperParameterTuningJobWarmStartConfig))
-> CreateHyperParameterTuningJob -> f CreateHyperParameterTuningJob
createHyperParameterTuningJob_warmStartConfig = (CreateHyperParameterTuningJob
 -> Maybe HyperParameterTuningJobWarmStartConfig)
-> (CreateHyperParameterTuningJob
    -> Maybe HyperParameterTuningJobWarmStartConfig
    -> CreateHyperParameterTuningJob)
-> Lens
     CreateHyperParameterTuningJob
     CreateHyperParameterTuningJob
     (Maybe HyperParameterTuningJobWarmStartConfig)
     (Maybe HyperParameterTuningJobWarmStartConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHyperParameterTuningJob' {Maybe HyperParameterTuningJobWarmStartConfig
warmStartConfig :: Maybe HyperParameterTuningJobWarmStartConfig
$sel:warmStartConfig:CreateHyperParameterTuningJob' :: CreateHyperParameterTuningJob
-> Maybe HyperParameterTuningJobWarmStartConfig
warmStartConfig} -> Maybe HyperParameterTuningJobWarmStartConfig
warmStartConfig) (\s :: CreateHyperParameterTuningJob
s@CreateHyperParameterTuningJob' {} Maybe HyperParameterTuningJobWarmStartConfig
a -> CreateHyperParameterTuningJob
s {$sel:warmStartConfig:CreateHyperParameterTuningJob' :: Maybe HyperParameterTuningJobWarmStartConfig
warmStartConfig = Maybe HyperParameterTuningJobWarmStartConfig
a} :: CreateHyperParameterTuningJob)

-- | An array of key-value pairs. You can use tags to categorize your Amazon
-- Web Services resources in different ways, for example, by purpose,
-- owner, or environment. For more information, see
-- <https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html Tagging Amazon Web Services Resources>.
--
-- Tags that you specify for the tuning job are also added to all training
-- jobs that the tuning job launches.
createHyperParameterTuningJob_tags :: Lens.Lens' CreateHyperParameterTuningJob (Prelude.Maybe [Tag])
createHyperParameterTuningJob_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateHyperParameterTuningJob -> f CreateHyperParameterTuningJob
createHyperParameterTuningJob_tags = (CreateHyperParameterTuningJob -> Maybe [Tag])
-> (CreateHyperParameterTuningJob
    -> Maybe [Tag] -> CreateHyperParameterTuningJob)
-> Lens
     CreateHyperParameterTuningJob
     CreateHyperParameterTuningJob
     (Maybe [Tag])
     (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHyperParameterTuningJob' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateHyperParameterTuningJob' :: CreateHyperParameterTuningJob -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateHyperParameterTuningJob
s@CreateHyperParameterTuningJob' {} Maybe [Tag]
a -> CreateHyperParameterTuningJob
s {$sel:tags:CreateHyperParameterTuningJob' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateHyperParameterTuningJob) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreateHyperParameterTuningJob
 -> f CreateHyperParameterTuningJob)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateHyperParameterTuningJob
-> f CreateHyperParameterTuningJob
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A list of the HyperParameterTrainingJobDefinition objects launched for
-- this tuning job.
createHyperParameterTuningJob_trainingJobDefinitions :: Lens.Lens' CreateHyperParameterTuningJob (Prelude.Maybe (Prelude.NonEmpty HyperParameterTrainingJobDefinition))
createHyperParameterTuningJob_trainingJobDefinitions :: (Maybe (NonEmpty HyperParameterTrainingJobDefinition)
 -> f (Maybe (NonEmpty HyperParameterTrainingJobDefinition)))
-> CreateHyperParameterTuningJob -> f CreateHyperParameterTuningJob
createHyperParameterTuningJob_trainingJobDefinitions = (CreateHyperParameterTuningJob
 -> Maybe (NonEmpty HyperParameterTrainingJobDefinition))
-> (CreateHyperParameterTuningJob
    -> Maybe (NonEmpty HyperParameterTrainingJobDefinition)
    -> CreateHyperParameterTuningJob)
-> Lens
     CreateHyperParameterTuningJob
     CreateHyperParameterTuningJob
     (Maybe (NonEmpty HyperParameterTrainingJobDefinition))
     (Maybe (NonEmpty HyperParameterTrainingJobDefinition))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHyperParameterTuningJob' {Maybe (NonEmpty HyperParameterTrainingJobDefinition)
trainingJobDefinitions :: Maybe (NonEmpty HyperParameterTrainingJobDefinition)
$sel:trainingJobDefinitions:CreateHyperParameterTuningJob' :: CreateHyperParameterTuningJob
-> Maybe (NonEmpty HyperParameterTrainingJobDefinition)
trainingJobDefinitions} -> Maybe (NonEmpty HyperParameterTrainingJobDefinition)
trainingJobDefinitions) (\s :: CreateHyperParameterTuningJob
s@CreateHyperParameterTuningJob' {} Maybe (NonEmpty HyperParameterTrainingJobDefinition)
a -> CreateHyperParameterTuningJob
s {$sel:trainingJobDefinitions:CreateHyperParameterTuningJob' :: Maybe (NonEmpty HyperParameterTrainingJobDefinition)
trainingJobDefinitions = Maybe (NonEmpty HyperParameterTrainingJobDefinition)
a} :: CreateHyperParameterTuningJob) ((Maybe (NonEmpty HyperParameterTrainingJobDefinition)
  -> f (Maybe (NonEmpty HyperParameterTrainingJobDefinition)))
 -> CreateHyperParameterTuningJob
 -> f CreateHyperParameterTuningJob)
-> ((Maybe (NonEmpty HyperParameterTrainingJobDefinition)
     -> f (Maybe (NonEmpty HyperParameterTrainingJobDefinition)))
    -> Maybe (NonEmpty HyperParameterTrainingJobDefinition)
    -> f (Maybe (NonEmpty HyperParameterTrainingJobDefinition)))
-> (Maybe (NonEmpty HyperParameterTrainingJobDefinition)
    -> f (Maybe (NonEmpty HyperParameterTrainingJobDefinition)))
-> CreateHyperParameterTuningJob
-> f CreateHyperParameterTuningJob
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty HyperParameterTrainingJobDefinition)
  (NonEmpty HyperParameterTrainingJobDefinition)
  (NonEmpty HyperParameterTrainingJobDefinition)
  (NonEmpty HyperParameterTrainingJobDefinition)
-> Iso
     (Maybe (NonEmpty HyperParameterTrainingJobDefinition))
     (Maybe (NonEmpty HyperParameterTrainingJobDefinition))
     (Maybe (NonEmpty HyperParameterTrainingJobDefinition))
     (Maybe (NonEmpty HyperParameterTrainingJobDefinition))
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
  (NonEmpty HyperParameterTrainingJobDefinition)
  (NonEmpty HyperParameterTrainingJobDefinition)
  (NonEmpty HyperParameterTrainingJobDefinition)
  (NonEmpty HyperParameterTrainingJobDefinition)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the tuning job. This name is the prefix for the names of all
-- training jobs that this tuning job launches. The name must be unique
-- within the same Amazon Web Services account and Amazon Web Services
-- Region. The name must have 1 to 32 characters. Valid characters are a-z,
-- A-Z, 0-9, and : + = \@ _ % - (hyphen). The name is not case sensitive.
createHyperParameterTuningJob_hyperParameterTuningJobName :: Lens.Lens' CreateHyperParameterTuningJob Prelude.Text
createHyperParameterTuningJob_hyperParameterTuningJobName :: (Text -> f Text)
-> CreateHyperParameterTuningJob -> f CreateHyperParameterTuningJob
createHyperParameterTuningJob_hyperParameterTuningJobName = (CreateHyperParameterTuningJob -> Text)
-> (CreateHyperParameterTuningJob
    -> Text -> CreateHyperParameterTuningJob)
-> Lens
     CreateHyperParameterTuningJob
     CreateHyperParameterTuningJob
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHyperParameterTuningJob' {Text
hyperParameterTuningJobName :: Text
$sel:hyperParameterTuningJobName:CreateHyperParameterTuningJob' :: CreateHyperParameterTuningJob -> Text
hyperParameterTuningJobName} -> Text
hyperParameterTuningJobName) (\s :: CreateHyperParameterTuningJob
s@CreateHyperParameterTuningJob' {} Text
a -> CreateHyperParameterTuningJob
s {$sel:hyperParameterTuningJobName:CreateHyperParameterTuningJob' :: Text
hyperParameterTuningJobName = Text
a} :: CreateHyperParameterTuningJob)

-- | The HyperParameterTuningJobConfig object that describes the tuning job,
-- including the search strategy, the objective metric used to evaluate
-- training jobs, ranges of parameters to search, and resource limits for
-- the tuning job. For more information, see
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/automatic-model-tuning-how-it-works.html How Hyperparameter Tuning Works>.
createHyperParameterTuningJob_hyperParameterTuningJobConfig :: Lens.Lens' CreateHyperParameterTuningJob HyperParameterTuningJobConfig
createHyperParameterTuningJob_hyperParameterTuningJobConfig :: (HyperParameterTuningJobConfig -> f HyperParameterTuningJobConfig)
-> CreateHyperParameterTuningJob -> f CreateHyperParameterTuningJob
createHyperParameterTuningJob_hyperParameterTuningJobConfig = (CreateHyperParameterTuningJob -> HyperParameterTuningJobConfig)
-> (CreateHyperParameterTuningJob
    -> HyperParameterTuningJobConfig -> CreateHyperParameterTuningJob)
-> Lens
     CreateHyperParameterTuningJob
     CreateHyperParameterTuningJob
     HyperParameterTuningJobConfig
     HyperParameterTuningJobConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHyperParameterTuningJob' {HyperParameterTuningJobConfig
hyperParameterTuningJobConfig :: HyperParameterTuningJobConfig
$sel:hyperParameterTuningJobConfig:CreateHyperParameterTuningJob' :: CreateHyperParameterTuningJob -> HyperParameterTuningJobConfig
hyperParameterTuningJobConfig} -> HyperParameterTuningJobConfig
hyperParameterTuningJobConfig) (\s :: CreateHyperParameterTuningJob
s@CreateHyperParameterTuningJob' {} HyperParameterTuningJobConfig
a -> CreateHyperParameterTuningJob
s {$sel:hyperParameterTuningJobConfig:CreateHyperParameterTuningJob' :: HyperParameterTuningJobConfig
hyperParameterTuningJobConfig = HyperParameterTuningJobConfig
a} :: CreateHyperParameterTuningJob)

instance
  Core.AWSRequest
    CreateHyperParameterTuningJob
  where
  type
    AWSResponse CreateHyperParameterTuningJob =
      CreateHyperParameterTuningJobResponse
  request :: CreateHyperParameterTuningJob
-> Request CreateHyperParameterTuningJob
request = Service
-> CreateHyperParameterTuningJob
-> Request CreateHyperParameterTuningJob
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateHyperParameterTuningJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateHyperParameterTuningJob)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateHyperParameterTuningJob))
-> Logger
-> Service
-> Proxy CreateHyperParameterTuningJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateHyperParameterTuningJob)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int -> Text -> CreateHyperParameterTuningJobResponse
CreateHyperParameterTuningJobResponse'
            (Int -> Text -> CreateHyperParameterTuningJobResponse)
-> Either String Int
-> Either String (Text -> CreateHyperParameterTuningJobResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            Either String (Text -> CreateHyperParameterTuningJobResponse)
-> Either String Text
-> Either String CreateHyperParameterTuningJobResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"HyperParameterTuningJobArn")
      )

instance
  Prelude.Hashable
    CreateHyperParameterTuningJob

instance Prelude.NFData CreateHyperParameterTuningJob

instance Core.ToHeaders CreateHyperParameterTuningJob where
  toHeaders :: CreateHyperParameterTuningJob -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateHyperParameterTuningJob -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"SageMaker.CreateHyperParameterTuningJob" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON CreateHyperParameterTuningJob where
  toJSON :: CreateHyperParameterTuningJob -> Value
toJSON CreateHyperParameterTuningJob' {Maybe [Tag]
Maybe (NonEmpty HyperParameterTrainingJobDefinition)
Maybe HyperParameterTuningJobWarmStartConfig
Maybe HyperParameterTrainingJobDefinition
Text
HyperParameterTuningJobConfig
hyperParameterTuningJobConfig :: HyperParameterTuningJobConfig
hyperParameterTuningJobName :: Text
trainingJobDefinitions :: Maybe (NonEmpty HyperParameterTrainingJobDefinition)
tags :: Maybe [Tag]
warmStartConfig :: Maybe HyperParameterTuningJobWarmStartConfig
trainingJobDefinition :: Maybe HyperParameterTrainingJobDefinition
$sel:hyperParameterTuningJobConfig:CreateHyperParameterTuningJob' :: CreateHyperParameterTuningJob -> HyperParameterTuningJobConfig
$sel:hyperParameterTuningJobName:CreateHyperParameterTuningJob' :: CreateHyperParameterTuningJob -> Text
$sel:trainingJobDefinitions:CreateHyperParameterTuningJob' :: CreateHyperParameterTuningJob
-> Maybe (NonEmpty HyperParameterTrainingJobDefinition)
$sel:tags:CreateHyperParameterTuningJob' :: CreateHyperParameterTuningJob -> Maybe [Tag]
$sel:warmStartConfig:CreateHyperParameterTuningJob' :: CreateHyperParameterTuningJob
-> Maybe HyperParameterTuningJobWarmStartConfig
$sel:trainingJobDefinition:CreateHyperParameterTuningJob' :: CreateHyperParameterTuningJob
-> Maybe HyperParameterTrainingJobDefinition
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"TrainingJobDefinition" Text -> HyperParameterTrainingJobDefinition -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (HyperParameterTrainingJobDefinition -> Pair)
-> Maybe HyperParameterTrainingJobDefinition -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe HyperParameterTrainingJobDefinition
trainingJobDefinition,
            (Text
"WarmStartConfig" Text -> HyperParameterTuningJobWarmStartConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (HyperParameterTuningJobWarmStartConfig -> Pair)
-> Maybe HyperParameterTuningJobWarmStartConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe HyperParameterTuningJobWarmStartConfig
warmStartConfig,
            (Text
"Tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
            (Text
"TrainingJobDefinitions" Text -> NonEmpty HyperParameterTrainingJobDefinition -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NonEmpty HyperParameterTrainingJobDefinition -> Pair)
-> Maybe (NonEmpty HyperParameterTrainingJobDefinition)
-> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty HyperParameterTrainingJobDefinition)
trainingJobDefinitions,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"HyperParameterTuningJobName"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
hyperParameterTuningJobName
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"HyperParameterTuningJobConfig"
                  Text -> HyperParameterTuningJobConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= HyperParameterTuningJobConfig
hyperParameterTuningJobConfig
              )
          ]
      )

instance Core.ToPath CreateHyperParameterTuningJob where
  toPath :: CreateHyperParameterTuningJob -> ByteString
toPath = ByteString -> CreateHyperParameterTuningJob -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery CreateHyperParameterTuningJob where
  toQuery :: CreateHyperParameterTuningJob -> QueryString
toQuery = QueryString -> CreateHyperParameterTuningJob -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newCreateHyperParameterTuningJobResponse' smart constructor.
data CreateHyperParameterTuningJobResponse = CreateHyperParameterTuningJobResponse'
  { -- | The response's http status code.
    CreateHyperParameterTuningJobResponse -> Int
httpStatus :: Prelude.Int,
    -- | The Amazon Resource Name (ARN) of the tuning job. Amazon SageMaker
    -- assigns an ARN to a hyperparameter tuning job when you create it.
    CreateHyperParameterTuningJobResponse -> Text
hyperParameterTuningJobArn :: Prelude.Text
  }
  deriving (CreateHyperParameterTuningJobResponse
-> CreateHyperParameterTuningJobResponse -> Bool
(CreateHyperParameterTuningJobResponse
 -> CreateHyperParameterTuningJobResponse -> Bool)
-> (CreateHyperParameterTuningJobResponse
    -> CreateHyperParameterTuningJobResponse -> Bool)
-> Eq CreateHyperParameterTuningJobResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateHyperParameterTuningJobResponse
-> CreateHyperParameterTuningJobResponse -> Bool
$c/= :: CreateHyperParameterTuningJobResponse
-> CreateHyperParameterTuningJobResponse -> Bool
== :: CreateHyperParameterTuningJobResponse
-> CreateHyperParameterTuningJobResponse -> Bool
$c== :: CreateHyperParameterTuningJobResponse
-> CreateHyperParameterTuningJobResponse -> Bool
Prelude.Eq, ReadPrec [CreateHyperParameterTuningJobResponse]
ReadPrec CreateHyperParameterTuningJobResponse
Int -> ReadS CreateHyperParameterTuningJobResponse
ReadS [CreateHyperParameterTuningJobResponse]
(Int -> ReadS CreateHyperParameterTuningJobResponse)
-> ReadS [CreateHyperParameterTuningJobResponse]
-> ReadPrec CreateHyperParameterTuningJobResponse
-> ReadPrec [CreateHyperParameterTuningJobResponse]
-> Read CreateHyperParameterTuningJobResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateHyperParameterTuningJobResponse]
$creadListPrec :: ReadPrec [CreateHyperParameterTuningJobResponse]
readPrec :: ReadPrec CreateHyperParameterTuningJobResponse
$creadPrec :: ReadPrec CreateHyperParameterTuningJobResponse
readList :: ReadS [CreateHyperParameterTuningJobResponse]
$creadList :: ReadS [CreateHyperParameterTuningJobResponse]
readsPrec :: Int -> ReadS CreateHyperParameterTuningJobResponse
$creadsPrec :: Int -> ReadS CreateHyperParameterTuningJobResponse
Prelude.Read, Int -> CreateHyperParameterTuningJobResponse -> ShowS
[CreateHyperParameterTuningJobResponse] -> ShowS
CreateHyperParameterTuningJobResponse -> String
(Int -> CreateHyperParameterTuningJobResponse -> ShowS)
-> (CreateHyperParameterTuningJobResponse -> String)
-> ([CreateHyperParameterTuningJobResponse] -> ShowS)
-> Show CreateHyperParameterTuningJobResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateHyperParameterTuningJobResponse] -> ShowS
$cshowList :: [CreateHyperParameterTuningJobResponse] -> ShowS
show :: CreateHyperParameterTuningJobResponse -> String
$cshow :: CreateHyperParameterTuningJobResponse -> String
showsPrec :: Int -> CreateHyperParameterTuningJobResponse -> ShowS
$cshowsPrec :: Int -> CreateHyperParameterTuningJobResponse -> ShowS
Prelude.Show, (forall x.
 CreateHyperParameterTuningJobResponse
 -> Rep CreateHyperParameterTuningJobResponse x)
-> (forall x.
    Rep CreateHyperParameterTuningJobResponse x
    -> CreateHyperParameterTuningJobResponse)
-> Generic CreateHyperParameterTuningJobResponse
forall x.
Rep CreateHyperParameterTuningJobResponse x
-> CreateHyperParameterTuningJobResponse
forall x.
CreateHyperParameterTuningJobResponse
-> Rep CreateHyperParameterTuningJobResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateHyperParameterTuningJobResponse x
-> CreateHyperParameterTuningJobResponse
$cfrom :: forall x.
CreateHyperParameterTuningJobResponse
-> Rep CreateHyperParameterTuningJobResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateHyperParameterTuningJobResponse' 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:
--
-- 'httpStatus', 'createHyperParameterTuningJobResponse_httpStatus' - The response's http status code.
--
-- 'hyperParameterTuningJobArn', 'createHyperParameterTuningJobResponse_hyperParameterTuningJobArn' - The Amazon Resource Name (ARN) of the tuning job. Amazon SageMaker
-- assigns an ARN to a hyperparameter tuning job when you create it.
newCreateHyperParameterTuningJobResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'hyperParameterTuningJobArn'
  Prelude.Text ->
  CreateHyperParameterTuningJobResponse
newCreateHyperParameterTuningJobResponse :: Int -> Text -> CreateHyperParameterTuningJobResponse
newCreateHyperParameterTuningJobResponse
  Int
pHttpStatus_
  Text
pHyperParameterTuningJobArn_ =
    CreateHyperParameterTuningJobResponse' :: Int -> Text -> CreateHyperParameterTuningJobResponse
CreateHyperParameterTuningJobResponse'
      { $sel:httpStatus:CreateHyperParameterTuningJobResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:hyperParameterTuningJobArn:CreateHyperParameterTuningJobResponse' :: Text
hyperParameterTuningJobArn =
          Text
pHyperParameterTuningJobArn_
      }

-- | The response's http status code.
createHyperParameterTuningJobResponse_httpStatus :: Lens.Lens' CreateHyperParameterTuningJobResponse Prelude.Int
createHyperParameterTuningJobResponse_httpStatus :: (Int -> f Int)
-> CreateHyperParameterTuningJobResponse
-> f CreateHyperParameterTuningJobResponse
createHyperParameterTuningJobResponse_httpStatus = (CreateHyperParameterTuningJobResponse -> Int)
-> (CreateHyperParameterTuningJobResponse
    -> Int -> CreateHyperParameterTuningJobResponse)
-> Lens
     CreateHyperParameterTuningJobResponse
     CreateHyperParameterTuningJobResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHyperParameterTuningJobResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateHyperParameterTuningJobResponse' :: CreateHyperParameterTuningJobResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateHyperParameterTuningJobResponse
s@CreateHyperParameterTuningJobResponse' {} Int
a -> CreateHyperParameterTuningJobResponse
s {$sel:httpStatus:CreateHyperParameterTuningJobResponse' :: Int
httpStatus = Int
a} :: CreateHyperParameterTuningJobResponse)

-- | The Amazon Resource Name (ARN) of the tuning job. Amazon SageMaker
-- assigns an ARN to a hyperparameter tuning job when you create it.
createHyperParameterTuningJobResponse_hyperParameterTuningJobArn :: Lens.Lens' CreateHyperParameterTuningJobResponse Prelude.Text
createHyperParameterTuningJobResponse_hyperParameterTuningJobArn :: (Text -> f Text)
-> CreateHyperParameterTuningJobResponse
-> f CreateHyperParameterTuningJobResponse
createHyperParameterTuningJobResponse_hyperParameterTuningJobArn = (CreateHyperParameterTuningJobResponse -> Text)
-> (CreateHyperParameterTuningJobResponse
    -> Text -> CreateHyperParameterTuningJobResponse)
-> Lens
     CreateHyperParameterTuningJobResponse
     CreateHyperParameterTuningJobResponse
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHyperParameterTuningJobResponse' {Text
hyperParameterTuningJobArn :: Text
$sel:hyperParameterTuningJobArn:CreateHyperParameterTuningJobResponse' :: CreateHyperParameterTuningJobResponse -> Text
hyperParameterTuningJobArn} -> Text
hyperParameterTuningJobArn) (\s :: CreateHyperParameterTuningJobResponse
s@CreateHyperParameterTuningJobResponse' {} Text
a -> CreateHyperParameterTuningJobResponse
s {$sel:hyperParameterTuningJobArn:CreateHyperParameterTuningJobResponse' :: Text
hyperParameterTuningJobArn = Text
a} :: CreateHyperParameterTuningJobResponse)

instance
  Prelude.NFData
    CreateHyperParameterTuningJobResponse