{-# 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.FraudDetector.Types.TrainingResult
-- 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.FraudDetector.Types.TrainingResult where

import qualified Amazonka.Core as Core
import Amazonka.FraudDetector.Types.DataValidationMetrics
import Amazonka.FraudDetector.Types.TrainingMetrics
import Amazonka.FraudDetector.Types.VariableImportanceMetrics
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The training result details.
--
-- /See:/ 'newTrainingResult' smart constructor.
data TrainingResult = TrainingResult'
  { -- | The validation metrics.
    TrainingResult -> Maybe DataValidationMetrics
dataValidationMetrics :: Prelude.Maybe DataValidationMetrics,
    -- | The training metric details.
    TrainingResult -> Maybe TrainingMetrics
trainingMetrics :: Prelude.Maybe TrainingMetrics,
    -- | The variable importance metrics.
    TrainingResult -> Maybe VariableImportanceMetrics
variableImportanceMetrics :: Prelude.Maybe VariableImportanceMetrics
  }
  deriving (TrainingResult -> TrainingResult -> Bool
(TrainingResult -> TrainingResult -> Bool)
-> (TrainingResult -> TrainingResult -> Bool) -> Eq TrainingResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TrainingResult -> TrainingResult -> Bool
$c/= :: TrainingResult -> TrainingResult -> Bool
== :: TrainingResult -> TrainingResult -> Bool
$c== :: TrainingResult -> TrainingResult -> Bool
Prelude.Eq, ReadPrec [TrainingResult]
ReadPrec TrainingResult
Int -> ReadS TrainingResult
ReadS [TrainingResult]
(Int -> ReadS TrainingResult)
-> ReadS [TrainingResult]
-> ReadPrec TrainingResult
-> ReadPrec [TrainingResult]
-> Read TrainingResult
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TrainingResult]
$creadListPrec :: ReadPrec [TrainingResult]
readPrec :: ReadPrec TrainingResult
$creadPrec :: ReadPrec TrainingResult
readList :: ReadS [TrainingResult]
$creadList :: ReadS [TrainingResult]
readsPrec :: Int -> ReadS TrainingResult
$creadsPrec :: Int -> ReadS TrainingResult
Prelude.Read, Int -> TrainingResult -> ShowS
[TrainingResult] -> ShowS
TrainingResult -> String
(Int -> TrainingResult -> ShowS)
-> (TrainingResult -> String)
-> ([TrainingResult] -> ShowS)
-> Show TrainingResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TrainingResult] -> ShowS
$cshowList :: [TrainingResult] -> ShowS
show :: TrainingResult -> String
$cshow :: TrainingResult -> String
showsPrec :: Int -> TrainingResult -> ShowS
$cshowsPrec :: Int -> TrainingResult -> ShowS
Prelude.Show, (forall x. TrainingResult -> Rep TrainingResult x)
-> (forall x. Rep TrainingResult x -> TrainingResult)
-> Generic TrainingResult
forall x. Rep TrainingResult x -> TrainingResult
forall x. TrainingResult -> Rep TrainingResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TrainingResult x -> TrainingResult
$cfrom :: forall x. TrainingResult -> Rep TrainingResult x
Prelude.Generic)

-- |
-- Create a value of 'TrainingResult' 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:
--
-- 'dataValidationMetrics', 'trainingResult_dataValidationMetrics' - The validation metrics.
--
-- 'trainingMetrics', 'trainingResult_trainingMetrics' - The training metric details.
--
-- 'variableImportanceMetrics', 'trainingResult_variableImportanceMetrics' - The variable importance metrics.
newTrainingResult ::
  TrainingResult
newTrainingResult :: TrainingResult
newTrainingResult =
  TrainingResult' :: Maybe DataValidationMetrics
-> Maybe TrainingMetrics
-> Maybe VariableImportanceMetrics
-> TrainingResult
TrainingResult'
    { $sel:dataValidationMetrics:TrainingResult' :: Maybe DataValidationMetrics
dataValidationMetrics =
        Maybe DataValidationMetrics
forall a. Maybe a
Prelude.Nothing,
      $sel:trainingMetrics:TrainingResult' :: Maybe TrainingMetrics
trainingMetrics = Maybe TrainingMetrics
forall a. Maybe a
Prelude.Nothing,
      $sel:variableImportanceMetrics:TrainingResult' :: Maybe VariableImportanceMetrics
variableImportanceMetrics = Maybe VariableImportanceMetrics
forall a. Maybe a
Prelude.Nothing
    }

-- | The validation metrics.
trainingResult_dataValidationMetrics :: Lens.Lens' TrainingResult (Prelude.Maybe DataValidationMetrics)
trainingResult_dataValidationMetrics :: (Maybe DataValidationMetrics -> f (Maybe DataValidationMetrics))
-> TrainingResult -> f TrainingResult
trainingResult_dataValidationMetrics = (TrainingResult -> Maybe DataValidationMetrics)
-> (TrainingResult
    -> Maybe DataValidationMetrics -> TrainingResult)
-> Lens
     TrainingResult
     TrainingResult
     (Maybe DataValidationMetrics)
     (Maybe DataValidationMetrics)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrainingResult' {Maybe DataValidationMetrics
dataValidationMetrics :: Maybe DataValidationMetrics
$sel:dataValidationMetrics:TrainingResult' :: TrainingResult -> Maybe DataValidationMetrics
dataValidationMetrics} -> Maybe DataValidationMetrics
dataValidationMetrics) (\s :: TrainingResult
s@TrainingResult' {} Maybe DataValidationMetrics
a -> TrainingResult
s {$sel:dataValidationMetrics:TrainingResult' :: Maybe DataValidationMetrics
dataValidationMetrics = Maybe DataValidationMetrics
a} :: TrainingResult)

-- | The training metric details.
trainingResult_trainingMetrics :: Lens.Lens' TrainingResult (Prelude.Maybe TrainingMetrics)
trainingResult_trainingMetrics :: (Maybe TrainingMetrics -> f (Maybe TrainingMetrics))
-> TrainingResult -> f TrainingResult
trainingResult_trainingMetrics = (TrainingResult -> Maybe TrainingMetrics)
-> (TrainingResult -> Maybe TrainingMetrics -> TrainingResult)
-> Lens
     TrainingResult
     TrainingResult
     (Maybe TrainingMetrics)
     (Maybe TrainingMetrics)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrainingResult' {Maybe TrainingMetrics
trainingMetrics :: Maybe TrainingMetrics
$sel:trainingMetrics:TrainingResult' :: TrainingResult -> Maybe TrainingMetrics
trainingMetrics} -> Maybe TrainingMetrics
trainingMetrics) (\s :: TrainingResult
s@TrainingResult' {} Maybe TrainingMetrics
a -> TrainingResult
s {$sel:trainingMetrics:TrainingResult' :: Maybe TrainingMetrics
trainingMetrics = Maybe TrainingMetrics
a} :: TrainingResult)

-- | The variable importance metrics.
trainingResult_variableImportanceMetrics :: Lens.Lens' TrainingResult (Prelude.Maybe VariableImportanceMetrics)
trainingResult_variableImportanceMetrics :: (Maybe VariableImportanceMetrics
 -> f (Maybe VariableImportanceMetrics))
-> TrainingResult -> f TrainingResult
trainingResult_variableImportanceMetrics = (TrainingResult -> Maybe VariableImportanceMetrics)
-> (TrainingResult
    -> Maybe VariableImportanceMetrics -> TrainingResult)
-> Lens
     TrainingResult
     TrainingResult
     (Maybe VariableImportanceMetrics)
     (Maybe VariableImportanceMetrics)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrainingResult' {Maybe VariableImportanceMetrics
variableImportanceMetrics :: Maybe VariableImportanceMetrics
$sel:variableImportanceMetrics:TrainingResult' :: TrainingResult -> Maybe VariableImportanceMetrics
variableImportanceMetrics} -> Maybe VariableImportanceMetrics
variableImportanceMetrics) (\s :: TrainingResult
s@TrainingResult' {} Maybe VariableImportanceMetrics
a -> TrainingResult
s {$sel:variableImportanceMetrics:TrainingResult' :: Maybe VariableImportanceMetrics
variableImportanceMetrics = Maybe VariableImportanceMetrics
a} :: TrainingResult)

instance Core.FromJSON TrainingResult where
  parseJSON :: Value -> Parser TrainingResult
parseJSON =
    String
-> (Object -> Parser TrainingResult)
-> Value
-> Parser TrainingResult
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TrainingResult"
      ( \Object
x ->
          Maybe DataValidationMetrics
-> Maybe TrainingMetrics
-> Maybe VariableImportanceMetrics
-> TrainingResult
TrainingResult'
            (Maybe DataValidationMetrics
 -> Maybe TrainingMetrics
 -> Maybe VariableImportanceMetrics
 -> TrainingResult)
-> Parser (Maybe DataValidationMetrics)
-> Parser
     (Maybe TrainingMetrics
      -> Maybe VariableImportanceMetrics -> TrainingResult)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe DataValidationMetrics)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"dataValidationMetrics")
            Parser
  (Maybe TrainingMetrics
   -> Maybe VariableImportanceMetrics -> TrainingResult)
-> Parser (Maybe TrainingMetrics)
-> Parser (Maybe VariableImportanceMetrics -> TrainingResult)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe TrainingMetrics)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"trainingMetrics")
            Parser (Maybe VariableImportanceMetrics -> TrainingResult)
-> Parser (Maybe VariableImportanceMetrics)
-> Parser TrainingResult
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe VariableImportanceMetrics)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"variableImportanceMetrics")
      )

instance Prelude.Hashable TrainingResult

instance Prelude.NFData TrainingResult