{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.FraudDetector.Types.LogOddsMetric where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
      { $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 :: Lens' LogOddsMetric Text
logOddsMetric_variableName = 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 :: Lens' LogOddsMetric Text
logOddsMetric_variableType = 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 :: Lens' LogOddsMetric Double
logOddsMetric_variableImportance = 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 Data.FromJSON LogOddsMetric where
  parseJSON :: Value -> Parser LogOddsMetric
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"LogOddsMetric"
      ( \Object
x ->
          Text -> Text -> Double -> LogOddsMetric
LogOddsMetric'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"variableName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"variableType")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"variableImportance")
      )

instance Prelude.Hashable LogOddsMetric where
  hashWithSalt :: Int -> LogOddsMetric -> Int
hashWithSalt Int
_salt LogOddsMetric' {Double
Text
variableImportance :: Double
variableType :: Text
variableName :: Text
$sel:variableImportance:LogOddsMetric' :: LogOddsMetric -> Double
$sel:variableType:LogOddsMetric' :: LogOddsMetric -> Text
$sel:variableName:LogOddsMetric' :: LogOddsMetric -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
variableName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
variableType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Double
variableImportance

instance Prelude.NFData LogOddsMetric where
  rnf :: LogOddsMetric -> ()
rnf LogOddsMetric' {Double
Text
variableImportance :: Double
variableType :: Text
variableName :: Text
$sel:variableImportance:LogOddsMetric' :: LogOddsMetric -> Double
$sel:variableType:LogOddsMetric' :: LogOddsMetric -> Text
$sel:variableName:LogOddsMetric' :: LogOddsMetric -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
variableName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
variableType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Double
variableImportance