{-# 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.Personalize.Types.DefaultContinuousHyperParameterRange
-- 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.Personalize.Types.DefaultContinuousHyperParameterRange where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Provides the name and default range of a continuous hyperparameter and
-- whether the hyperparameter is tunable. A tunable hyperparameter can have
-- its value determined during hyperparameter optimization (HPO).
--
-- /See:/ 'newDefaultContinuousHyperParameterRange' smart constructor.
data DefaultContinuousHyperParameterRange = DefaultContinuousHyperParameterRange'
  { -- | The maximum allowable value for the hyperparameter.
    DefaultContinuousHyperParameterRange -> Maybe Double
maxValue :: Prelude.Maybe Prelude.Double,
    -- | Whether the hyperparameter is tunable.
    DefaultContinuousHyperParameterRange -> Maybe Bool
isTunable :: Prelude.Maybe Prelude.Bool,
    -- | The name of the hyperparameter.
    DefaultContinuousHyperParameterRange -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The minimum allowable value for the hyperparameter.
    DefaultContinuousHyperParameterRange -> Maybe Double
minValue :: Prelude.Maybe Prelude.Double
  }
  deriving (DefaultContinuousHyperParameterRange
-> DefaultContinuousHyperParameterRange -> Bool
(DefaultContinuousHyperParameterRange
 -> DefaultContinuousHyperParameterRange -> Bool)
-> (DefaultContinuousHyperParameterRange
    -> DefaultContinuousHyperParameterRange -> Bool)
-> Eq DefaultContinuousHyperParameterRange
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DefaultContinuousHyperParameterRange
-> DefaultContinuousHyperParameterRange -> Bool
$c/= :: DefaultContinuousHyperParameterRange
-> DefaultContinuousHyperParameterRange -> Bool
== :: DefaultContinuousHyperParameterRange
-> DefaultContinuousHyperParameterRange -> Bool
$c== :: DefaultContinuousHyperParameterRange
-> DefaultContinuousHyperParameterRange -> Bool
Prelude.Eq, ReadPrec [DefaultContinuousHyperParameterRange]
ReadPrec DefaultContinuousHyperParameterRange
Int -> ReadS DefaultContinuousHyperParameterRange
ReadS [DefaultContinuousHyperParameterRange]
(Int -> ReadS DefaultContinuousHyperParameterRange)
-> ReadS [DefaultContinuousHyperParameterRange]
-> ReadPrec DefaultContinuousHyperParameterRange
-> ReadPrec [DefaultContinuousHyperParameterRange]
-> Read DefaultContinuousHyperParameterRange
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DefaultContinuousHyperParameterRange]
$creadListPrec :: ReadPrec [DefaultContinuousHyperParameterRange]
readPrec :: ReadPrec DefaultContinuousHyperParameterRange
$creadPrec :: ReadPrec DefaultContinuousHyperParameterRange
readList :: ReadS [DefaultContinuousHyperParameterRange]
$creadList :: ReadS [DefaultContinuousHyperParameterRange]
readsPrec :: Int -> ReadS DefaultContinuousHyperParameterRange
$creadsPrec :: Int -> ReadS DefaultContinuousHyperParameterRange
Prelude.Read, Int -> DefaultContinuousHyperParameterRange -> ShowS
[DefaultContinuousHyperParameterRange] -> ShowS
DefaultContinuousHyperParameterRange -> String
(Int -> DefaultContinuousHyperParameterRange -> ShowS)
-> (DefaultContinuousHyperParameterRange -> String)
-> ([DefaultContinuousHyperParameterRange] -> ShowS)
-> Show DefaultContinuousHyperParameterRange
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DefaultContinuousHyperParameterRange] -> ShowS
$cshowList :: [DefaultContinuousHyperParameterRange] -> ShowS
show :: DefaultContinuousHyperParameterRange -> String
$cshow :: DefaultContinuousHyperParameterRange -> String
showsPrec :: Int -> DefaultContinuousHyperParameterRange -> ShowS
$cshowsPrec :: Int -> DefaultContinuousHyperParameterRange -> ShowS
Prelude.Show, (forall x.
 DefaultContinuousHyperParameterRange
 -> Rep DefaultContinuousHyperParameterRange x)
-> (forall x.
    Rep DefaultContinuousHyperParameterRange x
    -> DefaultContinuousHyperParameterRange)
-> Generic DefaultContinuousHyperParameterRange
forall x.
Rep DefaultContinuousHyperParameterRange x
-> DefaultContinuousHyperParameterRange
forall x.
DefaultContinuousHyperParameterRange
-> Rep DefaultContinuousHyperParameterRange x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DefaultContinuousHyperParameterRange x
-> DefaultContinuousHyperParameterRange
$cfrom :: forall x.
DefaultContinuousHyperParameterRange
-> Rep DefaultContinuousHyperParameterRange x
Prelude.Generic)

-- |
-- Create a value of 'DefaultContinuousHyperParameterRange' 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:
--
-- 'maxValue', 'defaultContinuousHyperParameterRange_maxValue' - The maximum allowable value for the hyperparameter.
--
-- 'isTunable', 'defaultContinuousHyperParameterRange_isTunable' - Whether the hyperparameter is tunable.
--
-- 'name', 'defaultContinuousHyperParameterRange_name' - The name of the hyperparameter.
--
-- 'minValue', 'defaultContinuousHyperParameterRange_minValue' - The minimum allowable value for the hyperparameter.
newDefaultContinuousHyperParameterRange ::
  DefaultContinuousHyperParameterRange
newDefaultContinuousHyperParameterRange :: DefaultContinuousHyperParameterRange
newDefaultContinuousHyperParameterRange =
  DefaultContinuousHyperParameterRange' :: Maybe Double
-> Maybe Bool
-> Maybe Text
-> Maybe Double
-> DefaultContinuousHyperParameterRange
DefaultContinuousHyperParameterRange'
    { $sel:maxValue:DefaultContinuousHyperParameterRange' :: Maybe Double
maxValue =
        Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:isTunable:DefaultContinuousHyperParameterRange' :: Maybe Bool
isTunable = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:name:DefaultContinuousHyperParameterRange' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:minValue:DefaultContinuousHyperParameterRange' :: Maybe Double
minValue = Maybe Double
forall a. Maybe a
Prelude.Nothing
    }

-- | The maximum allowable value for the hyperparameter.
defaultContinuousHyperParameterRange_maxValue :: Lens.Lens' DefaultContinuousHyperParameterRange (Prelude.Maybe Prelude.Double)
defaultContinuousHyperParameterRange_maxValue :: (Maybe Double -> f (Maybe Double))
-> DefaultContinuousHyperParameterRange
-> f DefaultContinuousHyperParameterRange
defaultContinuousHyperParameterRange_maxValue = (DefaultContinuousHyperParameterRange -> Maybe Double)
-> (DefaultContinuousHyperParameterRange
    -> Maybe Double -> DefaultContinuousHyperParameterRange)
-> Lens
     DefaultContinuousHyperParameterRange
     DefaultContinuousHyperParameterRange
     (Maybe Double)
     (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DefaultContinuousHyperParameterRange' {Maybe Double
maxValue :: Maybe Double
$sel:maxValue:DefaultContinuousHyperParameterRange' :: DefaultContinuousHyperParameterRange -> Maybe Double
maxValue} -> Maybe Double
maxValue) (\s :: DefaultContinuousHyperParameterRange
s@DefaultContinuousHyperParameterRange' {} Maybe Double
a -> DefaultContinuousHyperParameterRange
s {$sel:maxValue:DefaultContinuousHyperParameterRange' :: Maybe Double
maxValue = Maybe Double
a} :: DefaultContinuousHyperParameterRange)

-- | Whether the hyperparameter is tunable.
defaultContinuousHyperParameterRange_isTunable :: Lens.Lens' DefaultContinuousHyperParameterRange (Prelude.Maybe Prelude.Bool)
defaultContinuousHyperParameterRange_isTunable :: (Maybe Bool -> f (Maybe Bool))
-> DefaultContinuousHyperParameterRange
-> f DefaultContinuousHyperParameterRange
defaultContinuousHyperParameterRange_isTunable = (DefaultContinuousHyperParameterRange -> Maybe Bool)
-> (DefaultContinuousHyperParameterRange
    -> Maybe Bool -> DefaultContinuousHyperParameterRange)
-> Lens
     DefaultContinuousHyperParameterRange
     DefaultContinuousHyperParameterRange
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DefaultContinuousHyperParameterRange' {Maybe Bool
isTunable :: Maybe Bool
$sel:isTunable:DefaultContinuousHyperParameterRange' :: DefaultContinuousHyperParameterRange -> Maybe Bool
isTunable} -> Maybe Bool
isTunable) (\s :: DefaultContinuousHyperParameterRange
s@DefaultContinuousHyperParameterRange' {} Maybe Bool
a -> DefaultContinuousHyperParameterRange
s {$sel:isTunable:DefaultContinuousHyperParameterRange' :: Maybe Bool
isTunable = Maybe Bool
a} :: DefaultContinuousHyperParameterRange)

-- | The name of the hyperparameter.
defaultContinuousHyperParameterRange_name :: Lens.Lens' DefaultContinuousHyperParameterRange (Prelude.Maybe Prelude.Text)
defaultContinuousHyperParameterRange_name :: (Maybe Text -> f (Maybe Text))
-> DefaultContinuousHyperParameterRange
-> f DefaultContinuousHyperParameterRange
defaultContinuousHyperParameterRange_name = (DefaultContinuousHyperParameterRange -> Maybe Text)
-> (DefaultContinuousHyperParameterRange
    -> Maybe Text -> DefaultContinuousHyperParameterRange)
-> Lens
     DefaultContinuousHyperParameterRange
     DefaultContinuousHyperParameterRange
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DefaultContinuousHyperParameterRange' {Maybe Text
name :: Maybe Text
$sel:name:DefaultContinuousHyperParameterRange' :: DefaultContinuousHyperParameterRange -> Maybe Text
name} -> Maybe Text
name) (\s :: DefaultContinuousHyperParameterRange
s@DefaultContinuousHyperParameterRange' {} Maybe Text
a -> DefaultContinuousHyperParameterRange
s {$sel:name:DefaultContinuousHyperParameterRange' :: Maybe Text
name = Maybe Text
a} :: DefaultContinuousHyperParameterRange)

-- | The minimum allowable value for the hyperparameter.
defaultContinuousHyperParameterRange_minValue :: Lens.Lens' DefaultContinuousHyperParameterRange (Prelude.Maybe Prelude.Double)
defaultContinuousHyperParameterRange_minValue :: (Maybe Double -> f (Maybe Double))
-> DefaultContinuousHyperParameterRange
-> f DefaultContinuousHyperParameterRange
defaultContinuousHyperParameterRange_minValue = (DefaultContinuousHyperParameterRange -> Maybe Double)
-> (DefaultContinuousHyperParameterRange
    -> Maybe Double -> DefaultContinuousHyperParameterRange)
-> Lens
     DefaultContinuousHyperParameterRange
     DefaultContinuousHyperParameterRange
     (Maybe Double)
     (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DefaultContinuousHyperParameterRange' {Maybe Double
minValue :: Maybe Double
$sel:minValue:DefaultContinuousHyperParameterRange' :: DefaultContinuousHyperParameterRange -> Maybe Double
minValue} -> Maybe Double
minValue) (\s :: DefaultContinuousHyperParameterRange
s@DefaultContinuousHyperParameterRange' {} Maybe Double
a -> DefaultContinuousHyperParameterRange
s {$sel:minValue:DefaultContinuousHyperParameterRange' :: Maybe Double
minValue = Maybe Double
a} :: DefaultContinuousHyperParameterRange)

instance
  Core.FromJSON
    DefaultContinuousHyperParameterRange
  where
  parseJSON :: Value -> Parser DefaultContinuousHyperParameterRange
parseJSON =
    String
-> (Object -> Parser DefaultContinuousHyperParameterRange)
-> Value
-> Parser DefaultContinuousHyperParameterRange
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DefaultContinuousHyperParameterRange"
      ( \Object
x ->
          Maybe Double
-> Maybe Bool
-> Maybe Text
-> Maybe Double
-> DefaultContinuousHyperParameterRange
DefaultContinuousHyperParameterRange'
            (Maybe Double
 -> Maybe Bool
 -> Maybe Text
 -> Maybe Double
 -> DefaultContinuousHyperParameterRange)
-> Parser (Maybe Double)
-> Parser
     (Maybe Bool
      -> Maybe Text
      -> Maybe Double
      -> DefaultContinuousHyperParameterRange)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"maxValue")
            Parser
  (Maybe Bool
   -> Maybe Text
   -> Maybe Double
   -> DefaultContinuousHyperParameterRange)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text
      -> Maybe Double -> DefaultContinuousHyperParameterRange)
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
"isTunable")
            Parser
  (Maybe Text
   -> Maybe Double -> DefaultContinuousHyperParameterRange)
-> Parser (Maybe Text)
-> Parser (Maybe Double -> DefaultContinuousHyperParameterRange)
forall (f :: * -> *) a b. Applicative f => 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
"name")
            Parser (Maybe Double -> DefaultContinuousHyperParameterRange)
-> Parser (Maybe Double)
-> Parser DefaultContinuousHyperParameterRange
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"minValue")
      )

instance
  Prelude.Hashable
    DefaultContinuousHyperParameterRange

instance
  Prelude.NFData
    DefaultContinuousHyperParameterRange