{-# 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.AggregatedVariablesImpactExplanation
-- 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.AggregatedVariablesImpactExplanation 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 details of the impact of aggregated variables on the prediction
-- score.
--
-- Account Takeover Insights (ATI) model uses the login data you provide to
-- continuously calculate a set of variables (aggregated variables) based
-- on historical events. For example, the model might calculate the number
-- of times an user has logged in using the same IP address. In this case,
-- event variables used to derive the aggregated variables are @IP address@
-- and @user@.
--
-- /See:/ 'newAggregatedVariablesImpactExplanation' smart constructor.
data AggregatedVariablesImpactExplanation = AggregatedVariablesImpactExplanation'
  { -- | The names of all the event variables that were used to derive the
    -- aggregated variables.
    AggregatedVariablesImpactExplanation -> Maybe [Text]
eventVariableNames :: Prelude.Maybe [Prelude.Text],
    -- | The raw, uninterpreted value represented as log-odds of the fraud. These
    -- values are usually between -10 to +10, but range from -infinity to
    -- +infinity.
    --
    -- -   A positive value indicates that the variables drove the risk score
    --     up.
    --
    -- -   A negative value indicates that the variables drove the risk score
    --     down.
    AggregatedVariablesImpactExplanation -> Maybe Double
logOddsImpact :: Prelude.Maybe Prelude.Double,
    -- | The relative impact of the aggregated variables in terms of magnitude on
    -- the prediction scores.
    AggregatedVariablesImpactExplanation -> Maybe Text
relativeImpact :: Prelude.Maybe Prelude.Text
  }
  deriving (AggregatedVariablesImpactExplanation
-> AggregatedVariablesImpactExplanation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AggregatedVariablesImpactExplanation
-> AggregatedVariablesImpactExplanation -> Bool
$c/= :: AggregatedVariablesImpactExplanation
-> AggregatedVariablesImpactExplanation -> Bool
== :: AggregatedVariablesImpactExplanation
-> AggregatedVariablesImpactExplanation -> Bool
$c== :: AggregatedVariablesImpactExplanation
-> AggregatedVariablesImpactExplanation -> Bool
Prelude.Eq, ReadPrec [AggregatedVariablesImpactExplanation]
ReadPrec AggregatedVariablesImpactExplanation
Int -> ReadS AggregatedVariablesImpactExplanation
ReadS [AggregatedVariablesImpactExplanation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AggregatedVariablesImpactExplanation]
$creadListPrec :: ReadPrec [AggregatedVariablesImpactExplanation]
readPrec :: ReadPrec AggregatedVariablesImpactExplanation
$creadPrec :: ReadPrec AggregatedVariablesImpactExplanation
readList :: ReadS [AggregatedVariablesImpactExplanation]
$creadList :: ReadS [AggregatedVariablesImpactExplanation]
readsPrec :: Int -> ReadS AggregatedVariablesImpactExplanation
$creadsPrec :: Int -> ReadS AggregatedVariablesImpactExplanation
Prelude.Read, Int -> AggregatedVariablesImpactExplanation -> ShowS
[AggregatedVariablesImpactExplanation] -> ShowS
AggregatedVariablesImpactExplanation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AggregatedVariablesImpactExplanation] -> ShowS
$cshowList :: [AggregatedVariablesImpactExplanation] -> ShowS
show :: AggregatedVariablesImpactExplanation -> String
$cshow :: AggregatedVariablesImpactExplanation -> String
showsPrec :: Int -> AggregatedVariablesImpactExplanation -> ShowS
$cshowsPrec :: Int -> AggregatedVariablesImpactExplanation -> ShowS
Prelude.Show, forall x.
Rep AggregatedVariablesImpactExplanation x
-> AggregatedVariablesImpactExplanation
forall x.
AggregatedVariablesImpactExplanation
-> Rep AggregatedVariablesImpactExplanation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AggregatedVariablesImpactExplanation x
-> AggregatedVariablesImpactExplanation
$cfrom :: forall x.
AggregatedVariablesImpactExplanation
-> Rep AggregatedVariablesImpactExplanation x
Prelude.Generic)

-- |
-- Create a value of 'AggregatedVariablesImpactExplanation' 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:
--
-- 'eventVariableNames', 'aggregatedVariablesImpactExplanation_eventVariableNames' - The names of all the event variables that were used to derive the
-- aggregated variables.
--
-- 'logOddsImpact', 'aggregatedVariablesImpactExplanation_logOddsImpact' - The raw, uninterpreted value represented as log-odds of the fraud. These
-- values are usually between -10 to +10, but range from -infinity to
-- +infinity.
--
-- -   A positive value indicates that the variables drove the risk score
--     up.
--
-- -   A negative value indicates that the variables drove the risk score
--     down.
--
-- 'relativeImpact', 'aggregatedVariablesImpactExplanation_relativeImpact' - The relative impact of the aggregated variables in terms of magnitude on
-- the prediction scores.
newAggregatedVariablesImpactExplanation ::
  AggregatedVariablesImpactExplanation
newAggregatedVariablesImpactExplanation :: AggregatedVariablesImpactExplanation
newAggregatedVariablesImpactExplanation =
  AggregatedVariablesImpactExplanation'
    { $sel:eventVariableNames:AggregatedVariablesImpactExplanation' :: Maybe [Text]
eventVariableNames =
        forall a. Maybe a
Prelude.Nothing,
      $sel:logOddsImpact:AggregatedVariablesImpactExplanation' :: Maybe Double
logOddsImpact = forall a. Maybe a
Prelude.Nothing,
      $sel:relativeImpact:AggregatedVariablesImpactExplanation' :: Maybe Text
relativeImpact = forall a. Maybe a
Prelude.Nothing
    }

-- | The names of all the event variables that were used to derive the
-- aggregated variables.
aggregatedVariablesImpactExplanation_eventVariableNames :: Lens.Lens' AggregatedVariablesImpactExplanation (Prelude.Maybe [Prelude.Text])
aggregatedVariablesImpactExplanation_eventVariableNames :: Lens' AggregatedVariablesImpactExplanation (Maybe [Text])
aggregatedVariablesImpactExplanation_eventVariableNames = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AggregatedVariablesImpactExplanation' {Maybe [Text]
eventVariableNames :: Maybe [Text]
$sel:eventVariableNames:AggregatedVariablesImpactExplanation' :: AggregatedVariablesImpactExplanation -> Maybe [Text]
eventVariableNames} -> Maybe [Text]
eventVariableNames) (\s :: AggregatedVariablesImpactExplanation
s@AggregatedVariablesImpactExplanation' {} Maybe [Text]
a -> AggregatedVariablesImpactExplanation
s {$sel:eventVariableNames:AggregatedVariablesImpactExplanation' :: Maybe [Text]
eventVariableNames = Maybe [Text]
a} :: AggregatedVariablesImpactExplanation) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The raw, uninterpreted value represented as log-odds of the fraud. These
-- values are usually between -10 to +10, but range from -infinity to
-- +infinity.
--
-- -   A positive value indicates that the variables drove the risk score
--     up.
--
-- -   A negative value indicates that the variables drove the risk score
--     down.
aggregatedVariablesImpactExplanation_logOddsImpact :: Lens.Lens' AggregatedVariablesImpactExplanation (Prelude.Maybe Prelude.Double)
aggregatedVariablesImpactExplanation_logOddsImpact :: Lens' AggregatedVariablesImpactExplanation (Maybe Double)
aggregatedVariablesImpactExplanation_logOddsImpact = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AggregatedVariablesImpactExplanation' {Maybe Double
logOddsImpact :: Maybe Double
$sel:logOddsImpact:AggregatedVariablesImpactExplanation' :: AggregatedVariablesImpactExplanation -> Maybe Double
logOddsImpact} -> Maybe Double
logOddsImpact) (\s :: AggregatedVariablesImpactExplanation
s@AggregatedVariablesImpactExplanation' {} Maybe Double
a -> AggregatedVariablesImpactExplanation
s {$sel:logOddsImpact:AggregatedVariablesImpactExplanation' :: Maybe Double
logOddsImpact = Maybe Double
a} :: AggregatedVariablesImpactExplanation)

-- | The relative impact of the aggregated variables in terms of magnitude on
-- the prediction scores.
aggregatedVariablesImpactExplanation_relativeImpact :: Lens.Lens' AggregatedVariablesImpactExplanation (Prelude.Maybe Prelude.Text)
aggregatedVariablesImpactExplanation_relativeImpact :: Lens' AggregatedVariablesImpactExplanation (Maybe Text)
aggregatedVariablesImpactExplanation_relativeImpact = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AggregatedVariablesImpactExplanation' {Maybe Text
relativeImpact :: Maybe Text
$sel:relativeImpact:AggregatedVariablesImpactExplanation' :: AggregatedVariablesImpactExplanation -> Maybe Text
relativeImpact} -> Maybe Text
relativeImpact) (\s :: AggregatedVariablesImpactExplanation
s@AggregatedVariablesImpactExplanation' {} Maybe Text
a -> AggregatedVariablesImpactExplanation
s {$sel:relativeImpact:AggregatedVariablesImpactExplanation' :: Maybe Text
relativeImpact = Maybe Text
a} :: AggregatedVariablesImpactExplanation)

instance
  Data.FromJSON
    AggregatedVariablesImpactExplanation
  where
  parseJSON :: Value -> Parser AggregatedVariablesImpactExplanation
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AggregatedVariablesImpactExplanation"
      ( \Object
x ->
          Maybe [Text]
-> Maybe Double
-> Maybe Text
-> AggregatedVariablesImpactExplanation
AggregatedVariablesImpactExplanation'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"eventVariableNames"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"logOddsImpact")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"relativeImpact")
      )

instance
  Prelude.Hashable
    AggregatedVariablesImpactExplanation
  where
  hashWithSalt :: Int -> AggregatedVariablesImpactExplanation -> Int
hashWithSalt
    Int
_salt
    AggregatedVariablesImpactExplanation' {Maybe Double
Maybe [Text]
Maybe Text
relativeImpact :: Maybe Text
logOddsImpact :: Maybe Double
eventVariableNames :: Maybe [Text]
$sel:relativeImpact:AggregatedVariablesImpactExplanation' :: AggregatedVariablesImpactExplanation -> Maybe Text
$sel:logOddsImpact:AggregatedVariablesImpactExplanation' :: AggregatedVariablesImpactExplanation -> Maybe Double
$sel:eventVariableNames:AggregatedVariablesImpactExplanation' :: AggregatedVariablesImpactExplanation -> Maybe [Text]
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
eventVariableNames
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
logOddsImpact
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
relativeImpact

instance
  Prelude.NFData
    AggregatedVariablesImpactExplanation
  where
  rnf :: AggregatedVariablesImpactExplanation -> ()
rnf AggregatedVariablesImpactExplanation' {Maybe Double
Maybe [Text]
Maybe Text
relativeImpact :: Maybe Text
logOddsImpact :: Maybe Double
eventVariableNames :: Maybe [Text]
$sel:relativeImpact:AggregatedVariablesImpactExplanation' :: AggregatedVariablesImpactExplanation -> Maybe Text
$sel:logOddsImpact:AggregatedVariablesImpactExplanation' :: AggregatedVariablesImpactExplanation -> Maybe Double
$sel:eventVariableNames:AggregatedVariablesImpactExplanation' :: AggregatedVariablesImpactExplanation -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
eventVariableNames
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
logOddsImpact
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
relativeImpact