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

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

-- | If hyperparameter optimization (HPO) was performed, contains the
-- hyperparameter values of the best performing model.
--
-- /See:/ 'newTunedHPOParams' smart constructor.
data TunedHPOParams = TunedHPOParams'
  { -- | A list of the hyperparameter values of the best performing model.
    TunedHPOParams -> Maybe (HashMap Text Text)
algorithmHyperParameters :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  deriving (TunedHPOParams -> TunedHPOParams -> Bool
(TunedHPOParams -> TunedHPOParams -> Bool)
-> (TunedHPOParams -> TunedHPOParams -> Bool) -> Eq TunedHPOParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TunedHPOParams -> TunedHPOParams -> Bool
$c/= :: TunedHPOParams -> TunedHPOParams -> Bool
== :: TunedHPOParams -> TunedHPOParams -> Bool
$c== :: TunedHPOParams -> TunedHPOParams -> Bool
Prelude.Eq, ReadPrec [TunedHPOParams]
ReadPrec TunedHPOParams
Int -> ReadS TunedHPOParams
ReadS [TunedHPOParams]
(Int -> ReadS TunedHPOParams)
-> ReadS [TunedHPOParams]
-> ReadPrec TunedHPOParams
-> ReadPrec [TunedHPOParams]
-> Read TunedHPOParams
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TunedHPOParams]
$creadListPrec :: ReadPrec [TunedHPOParams]
readPrec :: ReadPrec TunedHPOParams
$creadPrec :: ReadPrec TunedHPOParams
readList :: ReadS [TunedHPOParams]
$creadList :: ReadS [TunedHPOParams]
readsPrec :: Int -> ReadS TunedHPOParams
$creadsPrec :: Int -> ReadS TunedHPOParams
Prelude.Read, Int -> TunedHPOParams -> ShowS
[TunedHPOParams] -> ShowS
TunedHPOParams -> String
(Int -> TunedHPOParams -> ShowS)
-> (TunedHPOParams -> String)
-> ([TunedHPOParams] -> ShowS)
-> Show TunedHPOParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TunedHPOParams] -> ShowS
$cshowList :: [TunedHPOParams] -> ShowS
show :: TunedHPOParams -> String
$cshow :: TunedHPOParams -> String
showsPrec :: Int -> TunedHPOParams -> ShowS
$cshowsPrec :: Int -> TunedHPOParams -> ShowS
Prelude.Show, (forall x. TunedHPOParams -> Rep TunedHPOParams x)
-> (forall x. Rep TunedHPOParams x -> TunedHPOParams)
-> Generic TunedHPOParams
forall x. Rep TunedHPOParams x -> TunedHPOParams
forall x. TunedHPOParams -> Rep TunedHPOParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TunedHPOParams x -> TunedHPOParams
$cfrom :: forall x. TunedHPOParams -> Rep TunedHPOParams x
Prelude.Generic)

-- |
-- Create a value of 'TunedHPOParams' 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:
--
-- 'algorithmHyperParameters', 'tunedHPOParams_algorithmHyperParameters' - A list of the hyperparameter values of the best performing model.
newTunedHPOParams ::
  TunedHPOParams
newTunedHPOParams :: TunedHPOParams
newTunedHPOParams =
  TunedHPOParams' :: Maybe (HashMap Text Text) -> TunedHPOParams
TunedHPOParams'
    { $sel:algorithmHyperParameters:TunedHPOParams' :: Maybe (HashMap Text Text)
algorithmHyperParameters =
        Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing
    }

-- | A list of the hyperparameter values of the best performing model.
tunedHPOParams_algorithmHyperParameters :: Lens.Lens' TunedHPOParams (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
tunedHPOParams_algorithmHyperParameters :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> TunedHPOParams -> f TunedHPOParams
tunedHPOParams_algorithmHyperParameters = (TunedHPOParams -> Maybe (HashMap Text Text))
-> (TunedHPOParams -> Maybe (HashMap Text Text) -> TunedHPOParams)
-> Lens
     TunedHPOParams
     TunedHPOParams
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TunedHPOParams' {Maybe (HashMap Text Text)
algorithmHyperParameters :: Maybe (HashMap Text Text)
$sel:algorithmHyperParameters:TunedHPOParams' :: TunedHPOParams -> Maybe (HashMap Text Text)
algorithmHyperParameters} -> Maybe (HashMap Text Text)
algorithmHyperParameters) (\s :: TunedHPOParams
s@TunedHPOParams' {} Maybe (HashMap Text Text)
a -> TunedHPOParams
s {$sel:algorithmHyperParameters:TunedHPOParams' :: Maybe (HashMap Text Text)
algorithmHyperParameters = Maybe (HashMap Text Text)
a} :: TunedHPOParams) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> TunedHPOParams -> f TunedHPOParams)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> TunedHPOParams
-> f TunedHPOParams
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON TunedHPOParams where
  parseJSON :: Value -> Parser TunedHPOParams
parseJSON =
    String
-> (Object -> Parser TunedHPOParams)
-> Value
-> Parser TunedHPOParams
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TunedHPOParams"
      ( \Object
x ->
          Maybe (HashMap Text Text) -> TunedHPOParams
TunedHPOParams'
            (Maybe (HashMap Text Text) -> TunedHPOParams)
-> Parser (Maybe (HashMap Text Text)) -> Parser TunedHPOParams
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"algorithmHyperParameters"
                            Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable TunedHPOParams

instance Prelude.NFData TunedHPOParams