{-# 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.Forecast.Types.ParameterRanges
-- 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.Forecast.Types.ParameterRanges where

import qualified Amazonka.Core as Core
import Amazonka.Forecast.Types.CategoricalParameterRange
import Amazonka.Forecast.Types.ContinuousParameterRange
import Amazonka.Forecast.Types.IntegerParameterRange
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Specifies the categorical, continuous, and integer hyperparameters, and
-- their ranges of tunable values. The range of tunable values determines
-- which values that a hyperparameter tuning job can choose for the
-- specified hyperparameter. This object is part of the
-- HyperParameterTuningJobConfig object.
--
-- /See:/ 'newParameterRanges' smart constructor.
data ParameterRanges = ParameterRanges'
  { -- | Specifies the tunable range for each categorical hyperparameter.
    ParameterRanges -> Maybe (NonEmpty CategoricalParameterRange)
categoricalParameterRanges :: Prelude.Maybe (Prelude.NonEmpty CategoricalParameterRange),
    -- | Specifies the tunable range for each integer hyperparameter.
    ParameterRanges -> Maybe (NonEmpty IntegerParameterRange)
integerParameterRanges :: Prelude.Maybe (Prelude.NonEmpty IntegerParameterRange),
    -- | Specifies the tunable range for each continuous hyperparameter.
    ParameterRanges -> Maybe (NonEmpty ContinuousParameterRange)
continuousParameterRanges :: Prelude.Maybe (Prelude.NonEmpty ContinuousParameterRange)
  }
  deriving (ParameterRanges -> ParameterRanges -> Bool
(ParameterRanges -> ParameterRanges -> Bool)
-> (ParameterRanges -> ParameterRanges -> Bool)
-> Eq ParameterRanges
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ParameterRanges -> ParameterRanges -> Bool
$c/= :: ParameterRanges -> ParameterRanges -> Bool
== :: ParameterRanges -> ParameterRanges -> Bool
$c== :: ParameterRanges -> ParameterRanges -> Bool
Prelude.Eq, ReadPrec [ParameterRanges]
ReadPrec ParameterRanges
Int -> ReadS ParameterRanges
ReadS [ParameterRanges]
(Int -> ReadS ParameterRanges)
-> ReadS [ParameterRanges]
-> ReadPrec ParameterRanges
-> ReadPrec [ParameterRanges]
-> Read ParameterRanges
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ParameterRanges]
$creadListPrec :: ReadPrec [ParameterRanges]
readPrec :: ReadPrec ParameterRanges
$creadPrec :: ReadPrec ParameterRanges
readList :: ReadS [ParameterRanges]
$creadList :: ReadS [ParameterRanges]
readsPrec :: Int -> ReadS ParameterRanges
$creadsPrec :: Int -> ReadS ParameterRanges
Prelude.Read, Int -> ParameterRanges -> ShowS
[ParameterRanges] -> ShowS
ParameterRanges -> String
(Int -> ParameterRanges -> ShowS)
-> (ParameterRanges -> String)
-> ([ParameterRanges] -> ShowS)
-> Show ParameterRanges
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ParameterRanges] -> ShowS
$cshowList :: [ParameterRanges] -> ShowS
show :: ParameterRanges -> String
$cshow :: ParameterRanges -> String
showsPrec :: Int -> ParameterRanges -> ShowS
$cshowsPrec :: Int -> ParameterRanges -> ShowS
Prelude.Show, (forall x. ParameterRanges -> Rep ParameterRanges x)
-> (forall x. Rep ParameterRanges x -> ParameterRanges)
-> Generic ParameterRanges
forall x. Rep ParameterRanges x -> ParameterRanges
forall x. ParameterRanges -> Rep ParameterRanges x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ParameterRanges x -> ParameterRanges
$cfrom :: forall x. ParameterRanges -> Rep ParameterRanges x
Prelude.Generic)

-- |
-- Create a value of 'ParameterRanges' 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:
--
-- 'categoricalParameterRanges', 'parameterRanges_categoricalParameterRanges' - Specifies the tunable range for each categorical hyperparameter.
--
-- 'integerParameterRanges', 'parameterRanges_integerParameterRanges' - Specifies the tunable range for each integer hyperparameter.
--
-- 'continuousParameterRanges', 'parameterRanges_continuousParameterRanges' - Specifies the tunable range for each continuous hyperparameter.
newParameterRanges ::
  ParameterRanges
newParameterRanges :: ParameterRanges
newParameterRanges =
  ParameterRanges' :: Maybe (NonEmpty CategoricalParameterRange)
-> Maybe (NonEmpty IntegerParameterRange)
-> Maybe (NonEmpty ContinuousParameterRange)
-> ParameterRanges
ParameterRanges'
    { $sel:categoricalParameterRanges:ParameterRanges' :: Maybe (NonEmpty CategoricalParameterRange)
categoricalParameterRanges =
        Maybe (NonEmpty CategoricalParameterRange)
forall a. Maybe a
Prelude.Nothing,
      $sel:integerParameterRanges:ParameterRanges' :: Maybe (NonEmpty IntegerParameterRange)
integerParameterRanges = Maybe (NonEmpty IntegerParameterRange)
forall a. Maybe a
Prelude.Nothing,
      $sel:continuousParameterRanges:ParameterRanges' :: Maybe (NonEmpty ContinuousParameterRange)
continuousParameterRanges = Maybe (NonEmpty ContinuousParameterRange)
forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies the tunable range for each categorical hyperparameter.
parameterRanges_categoricalParameterRanges :: Lens.Lens' ParameterRanges (Prelude.Maybe (Prelude.NonEmpty CategoricalParameterRange))
parameterRanges_categoricalParameterRanges :: (Maybe (NonEmpty CategoricalParameterRange)
 -> f (Maybe (NonEmpty CategoricalParameterRange)))
-> ParameterRanges -> f ParameterRanges
parameterRanges_categoricalParameterRanges = (ParameterRanges -> Maybe (NonEmpty CategoricalParameterRange))
-> (ParameterRanges
    -> Maybe (NonEmpty CategoricalParameterRange) -> ParameterRanges)
-> Lens
     ParameterRanges
     ParameterRanges
     (Maybe (NonEmpty CategoricalParameterRange))
     (Maybe (NonEmpty CategoricalParameterRange))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParameterRanges' {Maybe (NonEmpty CategoricalParameterRange)
categoricalParameterRanges :: Maybe (NonEmpty CategoricalParameterRange)
$sel:categoricalParameterRanges:ParameterRanges' :: ParameterRanges -> Maybe (NonEmpty CategoricalParameterRange)
categoricalParameterRanges} -> Maybe (NonEmpty CategoricalParameterRange)
categoricalParameterRanges) (\s :: ParameterRanges
s@ParameterRanges' {} Maybe (NonEmpty CategoricalParameterRange)
a -> ParameterRanges
s {$sel:categoricalParameterRanges:ParameterRanges' :: Maybe (NonEmpty CategoricalParameterRange)
categoricalParameterRanges = Maybe (NonEmpty CategoricalParameterRange)
a} :: ParameterRanges) ((Maybe (NonEmpty CategoricalParameterRange)
  -> f (Maybe (NonEmpty CategoricalParameterRange)))
 -> ParameterRanges -> f ParameterRanges)
-> ((Maybe (NonEmpty CategoricalParameterRange)
     -> f (Maybe (NonEmpty CategoricalParameterRange)))
    -> Maybe (NonEmpty CategoricalParameterRange)
    -> f (Maybe (NonEmpty CategoricalParameterRange)))
-> (Maybe (NonEmpty CategoricalParameterRange)
    -> f (Maybe (NonEmpty CategoricalParameterRange)))
-> ParameterRanges
-> f ParameterRanges
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty CategoricalParameterRange)
  (NonEmpty CategoricalParameterRange)
  (NonEmpty CategoricalParameterRange)
  (NonEmpty CategoricalParameterRange)
-> Iso
     (Maybe (NonEmpty CategoricalParameterRange))
     (Maybe (NonEmpty CategoricalParameterRange))
     (Maybe (NonEmpty CategoricalParameterRange))
     (Maybe (NonEmpty CategoricalParameterRange))
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 CategoricalParameterRange)
  (NonEmpty CategoricalParameterRange)
  (NonEmpty CategoricalParameterRange)
  (NonEmpty CategoricalParameterRange)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Specifies the tunable range for each integer hyperparameter.
parameterRanges_integerParameterRanges :: Lens.Lens' ParameterRanges (Prelude.Maybe (Prelude.NonEmpty IntegerParameterRange))
parameterRanges_integerParameterRanges :: (Maybe (NonEmpty IntegerParameterRange)
 -> f (Maybe (NonEmpty IntegerParameterRange)))
-> ParameterRanges -> f ParameterRanges
parameterRanges_integerParameterRanges = (ParameterRanges -> Maybe (NonEmpty IntegerParameterRange))
-> (ParameterRanges
    -> Maybe (NonEmpty IntegerParameterRange) -> ParameterRanges)
-> Lens
     ParameterRanges
     ParameterRanges
     (Maybe (NonEmpty IntegerParameterRange))
     (Maybe (NonEmpty IntegerParameterRange))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParameterRanges' {Maybe (NonEmpty IntegerParameterRange)
integerParameterRanges :: Maybe (NonEmpty IntegerParameterRange)
$sel:integerParameterRanges:ParameterRanges' :: ParameterRanges -> Maybe (NonEmpty IntegerParameterRange)
integerParameterRanges} -> Maybe (NonEmpty IntegerParameterRange)
integerParameterRanges) (\s :: ParameterRanges
s@ParameterRanges' {} Maybe (NonEmpty IntegerParameterRange)
a -> ParameterRanges
s {$sel:integerParameterRanges:ParameterRanges' :: Maybe (NonEmpty IntegerParameterRange)
integerParameterRanges = Maybe (NonEmpty IntegerParameterRange)
a} :: ParameterRanges) ((Maybe (NonEmpty IntegerParameterRange)
  -> f (Maybe (NonEmpty IntegerParameterRange)))
 -> ParameterRanges -> f ParameterRanges)
-> ((Maybe (NonEmpty IntegerParameterRange)
     -> f (Maybe (NonEmpty IntegerParameterRange)))
    -> Maybe (NonEmpty IntegerParameterRange)
    -> f (Maybe (NonEmpty IntegerParameterRange)))
-> (Maybe (NonEmpty IntegerParameterRange)
    -> f (Maybe (NonEmpty IntegerParameterRange)))
-> ParameterRanges
-> f ParameterRanges
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty IntegerParameterRange)
  (NonEmpty IntegerParameterRange)
  (NonEmpty IntegerParameterRange)
  (NonEmpty IntegerParameterRange)
-> Iso
     (Maybe (NonEmpty IntegerParameterRange))
     (Maybe (NonEmpty IntegerParameterRange))
     (Maybe (NonEmpty IntegerParameterRange))
     (Maybe (NonEmpty IntegerParameterRange))
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 IntegerParameterRange)
  (NonEmpty IntegerParameterRange)
  (NonEmpty IntegerParameterRange)
  (NonEmpty IntegerParameterRange)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Specifies the tunable range for each continuous hyperparameter.
parameterRanges_continuousParameterRanges :: Lens.Lens' ParameterRanges (Prelude.Maybe (Prelude.NonEmpty ContinuousParameterRange))
parameterRanges_continuousParameterRanges :: (Maybe (NonEmpty ContinuousParameterRange)
 -> f (Maybe (NonEmpty ContinuousParameterRange)))
-> ParameterRanges -> f ParameterRanges
parameterRanges_continuousParameterRanges = (ParameterRanges -> Maybe (NonEmpty ContinuousParameterRange))
-> (ParameterRanges
    -> Maybe (NonEmpty ContinuousParameterRange) -> ParameterRanges)
-> Lens
     ParameterRanges
     ParameterRanges
     (Maybe (NonEmpty ContinuousParameterRange))
     (Maybe (NonEmpty ContinuousParameterRange))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParameterRanges' {Maybe (NonEmpty ContinuousParameterRange)
continuousParameterRanges :: Maybe (NonEmpty ContinuousParameterRange)
$sel:continuousParameterRanges:ParameterRanges' :: ParameterRanges -> Maybe (NonEmpty ContinuousParameterRange)
continuousParameterRanges} -> Maybe (NonEmpty ContinuousParameterRange)
continuousParameterRanges) (\s :: ParameterRanges
s@ParameterRanges' {} Maybe (NonEmpty ContinuousParameterRange)
a -> ParameterRanges
s {$sel:continuousParameterRanges:ParameterRanges' :: Maybe (NonEmpty ContinuousParameterRange)
continuousParameterRanges = Maybe (NonEmpty ContinuousParameterRange)
a} :: ParameterRanges) ((Maybe (NonEmpty ContinuousParameterRange)
  -> f (Maybe (NonEmpty ContinuousParameterRange)))
 -> ParameterRanges -> f ParameterRanges)
-> ((Maybe (NonEmpty ContinuousParameterRange)
     -> f (Maybe (NonEmpty ContinuousParameterRange)))
    -> Maybe (NonEmpty ContinuousParameterRange)
    -> f (Maybe (NonEmpty ContinuousParameterRange)))
-> (Maybe (NonEmpty ContinuousParameterRange)
    -> f (Maybe (NonEmpty ContinuousParameterRange)))
-> ParameterRanges
-> f ParameterRanges
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty ContinuousParameterRange)
  (NonEmpty ContinuousParameterRange)
  (NonEmpty ContinuousParameterRange)
  (NonEmpty ContinuousParameterRange)
-> Iso
     (Maybe (NonEmpty ContinuousParameterRange))
     (Maybe (NonEmpty ContinuousParameterRange))
     (Maybe (NonEmpty ContinuousParameterRange))
     (Maybe (NonEmpty ContinuousParameterRange))
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 ContinuousParameterRange)
  (NonEmpty ContinuousParameterRange)
  (NonEmpty ContinuousParameterRange)
  (NonEmpty ContinuousParameterRange)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON ParameterRanges where
  parseJSON :: Value -> Parser ParameterRanges
parseJSON =
    String
-> (Object -> Parser ParameterRanges)
-> Value
-> Parser ParameterRanges
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ParameterRanges"
      ( \Object
x ->
          Maybe (NonEmpty CategoricalParameterRange)
-> Maybe (NonEmpty IntegerParameterRange)
-> Maybe (NonEmpty ContinuousParameterRange)
-> ParameterRanges
ParameterRanges'
            (Maybe (NonEmpty CategoricalParameterRange)
 -> Maybe (NonEmpty IntegerParameterRange)
 -> Maybe (NonEmpty ContinuousParameterRange)
 -> ParameterRanges)
-> Parser (Maybe (NonEmpty CategoricalParameterRange))
-> Parser
     (Maybe (NonEmpty IntegerParameterRange)
      -> Maybe (NonEmpty ContinuousParameterRange) -> ParameterRanges)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text -> Parser (Maybe (NonEmpty CategoricalParameterRange))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CategoricalParameterRanges")
            Parser
  (Maybe (NonEmpty IntegerParameterRange)
   -> Maybe (NonEmpty ContinuousParameterRange) -> ParameterRanges)
-> Parser (Maybe (NonEmpty IntegerParameterRange))
-> Parser
     (Maybe (NonEmpty ContinuousParameterRange) -> ParameterRanges)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (NonEmpty IntegerParameterRange))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"IntegerParameterRanges")
            Parser
  (Maybe (NonEmpty ContinuousParameterRange) -> ParameterRanges)
-> Parser (Maybe (NonEmpty ContinuousParameterRange))
-> Parser ParameterRanges
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Parser (Maybe (NonEmpty ContinuousParameterRange))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ContinuousParameterRanges")
      )

instance Prelude.Hashable ParameterRanges

instance Prelude.NFData ParameterRanges

instance Core.ToJSON ParameterRanges where
  toJSON :: ParameterRanges -> Value
toJSON ParameterRanges' {Maybe (NonEmpty CategoricalParameterRange)
Maybe (NonEmpty IntegerParameterRange)
Maybe (NonEmpty ContinuousParameterRange)
continuousParameterRanges :: Maybe (NonEmpty ContinuousParameterRange)
integerParameterRanges :: Maybe (NonEmpty IntegerParameterRange)
categoricalParameterRanges :: Maybe (NonEmpty CategoricalParameterRange)
$sel:continuousParameterRanges:ParameterRanges' :: ParameterRanges -> Maybe (NonEmpty ContinuousParameterRange)
$sel:integerParameterRanges:ParameterRanges' :: ParameterRanges -> Maybe (NonEmpty IntegerParameterRange)
$sel:categoricalParameterRanges:ParameterRanges' :: ParameterRanges -> Maybe (NonEmpty CategoricalParameterRange)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"CategoricalParameterRanges" Text -> NonEmpty CategoricalParameterRange -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NonEmpty CategoricalParameterRange -> Pair)
-> Maybe (NonEmpty CategoricalParameterRange) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty CategoricalParameterRange)
categoricalParameterRanges,
            (Text
"IntegerParameterRanges" Text -> NonEmpty IntegerParameterRange -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NonEmpty IntegerParameterRange -> Pair)
-> Maybe (NonEmpty IntegerParameterRange) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty IntegerParameterRange)
integerParameterRanges,
            (Text
"ContinuousParameterRanges" Text -> NonEmpty ContinuousParameterRange -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NonEmpty ContinuousParameterRange -> Pair)
-> Maybe (NonEmpty ContinuousParameterRange) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty ContinuousParameterRange)
continuousParameterRanges
          ]
      )