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

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

-- | The log odds metric details.
--
-- /See:/ 'newLogOddsMetric' smart constructor.
data LogOddsMetric = LogOddsMetric'
  { -- | The name of the variable.
    LogOddsMetric -> Text
variableName :: Prelude.Text,
    -- | The type of variable.
    LogOddsMetric -> Text
variableType :: Prelude.Text,
    -- | The relative importance of the variable. For more information, see
    -- <https://docs.aws.amazon.com/frauddetector/latest/ug/model-variable-importance.html Model variable importance>.
    LogOddsMetric -> Double
variableImportance :: Prelude.Double
  }
  deriving (LogOddsMetric -> LogOddsMetric -> Bool
(LogOddsMetric -> LogOddsMetric -> Bool)
-> (LogOddsMetric -> LogOddsMetric -> Bool) -> Eq LogOddsMetric
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LogOddsMetric -> LogOddsMetric -> Bool
$c/= :: LogOddsMetric -> LogOddsMetric -> Bool
== :: LogOddsMetric -> LogOddsMetric -> Bool
$c== :: LogOddsMetric -> LogOddsMetric -> Bool
Prelude.Eq, ReadPrec [LogOddsMetric]
ReadPrec LogOddsMetric
Int -> ReadS LogOddsMetric
ReadS [LogOddsMetric]
(Int -> ReadS LogOddsMetric)
-> ReadS [LogOddsMetric]
-> ReadPrec LogOddsMetric
-> ReadPrec [LogOddsMetric]
-> Read LogOddsMetric
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LogOddsMetric]
$creadListPrec :: ReadPrec [LogOddsMetric]
readPrec :: ReadPrec LogOddsMetric
$creadPrec :: ReadPrec LogOddsMetric
readList :: ReadS [LogOddsMetric]
$creadList :: ReadS [LogOddsMetric]
readsPrec :: Int -> ReadS LogOddsMetric
$creadsPrec :: Int -> ReadS LogOddsMetric
Prelude.Read, Int -> LogOddsMetric -> ShowS
[LogOddsMetric] -> ShowS
LogOddsMetric -> String
(Int -> LogOddsMetric -> ShowS)
-> (LogOddsMetric -> String)
-> ([LogOddsMetric] -> ShowS)
-> Show LogOddsMetric
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LogOddsMetric] -> ShowS
$cshowList :: [LogOddsMetric] -> ShowS
show :: LogOddsMetric -> String
$cshow :: LogOddsMetric -> String
showsPrec :: Int -> LogOddsMetric -> ShowS
$cshowsPrec :: Int -> LogOddsMetric -> ShowS
Prelude.Show, (forall x. LogOddsMetric -> Rep LogOddsMetric x)
-> (forall x. Rep LogOddsMetric x -> LogOddsMetric)
-> Generic LogOddsMetric
forall x. Rep LogOddsMetric x -> LogOddsMetric
forall x. LogOddsMetric -> Rep LogOddsMetric x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LogOddsMetric x -> LogOddsMetric
$cfrom :: forall x. LogOddsMetric -> Rep LogOddsMetric x
Prelude.Generic)

-- |
-- Create a value of 'LogOddsMetric' 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:
--
-- 'variableName', 'logOddsMetric_variableName' - The name of the variable.
--
-- 'variableType', 'logOddsMetric_variableType' - The type of variable.
--
-- 'variableImportance', 'logOddsMetric_variableImportance' - The relative importance of the variable. For more information, see
-- <https://docs.aws.amazon.com/frauddetector/latest/ug/model-variable-importance.html Model variable importance>.
newLogOddsMetric ::
  -- | 'variableName'
  Prelude.Text ->
  -- | 'variableType'
  Prelude.Text ->
  -- | 'variableImportance'
  Prelude.Double ->
  LogOddsMetric
newLogOddsMetric :: Text -> Text -> Double -> LogOddsMetric
newLogOddsMetric
  Text
pVariableName_
  Text
pVariableType_
  Double
pVariableImportance_ =
    LogOddsMetric' :: Text -> Text -> Double -> LogOddsMetric
LogOddsMetric'
      { $sel:variableName:LogOddsMetric' :: Text
variableName = Text
pVariableName_,
        $sel:variableType:LogOddsMetric' :: Text
variableType = Text
pVariableType_,
        $sel:variableImportance:LogOddsMetric' :: Double
variableImportance = Double
pVariableImportance_
      }

-- | The name of the variable.
logOddsMetric_variableName :: Lens.Lens' LogOddsMetric Prelude.Text
logOddsMetric_variableName :: (Text -> f Text) -> LogOddsMetric -> f LogOddsMetric
logOddsMetric_variableName = (LogOddsMetric -> Text)
-> (LogOddsMetric -> Text -> LogOddsMetric)
-> Lens LogOddsMetric LogOddsMetric Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogOddsMetric' {Text
variableName :: Text
$sel:variableName:LogOddsMetric' :: LogOddsMetric -> Text
variableName} -> Text
variableName) (\s :: LogOddsMetric
s@LogOddsMetric' {} Text
a -> LogOddsMetric
s {$sel:variableName:LogOddsMetric' :: Text
variableName = Text
a} :: LogOddsMetric)

-- | The type of variable.
logOddsMetric_variableType :: Lens.Lens' LogOddsMetric Prelude.Text
logOddsMetric_variableType :: (Text -> f Text) -> LogOddsMetric -> f LogOddsMetric
logOddsMetric_variableType = (LogOddsMetric -> Text)
-> (LogOddsMetric -> Text -> LogOddsMetric)
-> Lens LogOddsMetric LogOddsMetric Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogOddsMetric' {Text
variableType :: Text
$sel:variableType:LogOddsMetric' :: LogOddsMetric -> Text
variableType} -> Text
variableType) (\s :: LogOddsMetric
s@LogOddsMetric' {} Text
a -> LogOddsMetric
s {$sel:variableType:LogOddsMetric' :: Text
variableType = Text
a} :: LogOddsMetric)

-- | The relative importance of the variable. For more information, see
-- <https://docs.aws.amazon.com/frauddetector/latest/ug/model-variable-importance.html Model variable importance>.
logOddsMetric_variableImportance :: Lens.Lens' LogOddsMetric Prelude.Double
logOddsMetric_variableImportance :: (Double -> f Double) -> LogOddsMetric -> f LogOddsMetric
logOddsMetric_variableImportance = (LogOddsMetric -> Double)
-> (LogOddsMetric -> Double -> LogOddsMetric)
-> Lens LogOddsMetric LogOddsMetric Double Double
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogOddsMetric' {Double
variableImportance :: Double
$sel:variableImportance:LogOddsMetric' :: LogOddsMetric -> Double
variableImportance} -> Double
variableImportance) (\s :: LogOddsMetric
s@LogOddsMetric' {} Double
a -> LogOddsMetric
s {$sel:variableImportance:LogOddsMetric' :: Double
variableImportance = Double
a} :: LogOddsMetric)

instance Core.FromJSON LogOddsMetric where
  parseJSON :: Value -> Parser LogOddsMetric
parseJSON =
    String
-> (Object -> Parser LogOddsMetric)
-> Value
-> Parser LogOddsMetric
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LogOddsMetric"
      ( \Object
x ->
          Text -> Text -> Double -> LogOddsMetric
LogOddsMetric'
            (Text -> Text -> Double -> LogOddsMetric)
-> Parser Text -> Parser (Text -> Double -> LogOddsMetric)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"variableName")
            Parser (Text -> Double -> LogOddsMetric)
-> Parser Text -> Parser (Double -> LogOddsMetric)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"variableType")
            Parser (Double -> LogOddsMetric)
-> Parser Double -> Parser LogOddsMetric
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Double
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"variableImportance")
      )

instance Prelude.Hashable LogOddsMetric

instance Prelude.NFData LogOddsMetric