{-# 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.AggregatedLogOddsMetric
-- 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.AggregatedLogOddsMetric 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.
--
-- Account Takeover Insights (ATI) model uses event variables from the
-- login data you provide to continuously calculate a set of variables
-- (aggregated variables) based on historical events. For example, your ATI
-- 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:/ 'newAggregatedLogOddsMetric' smart constructor.
data AggregatedLogOddsMetric = AggregatedLogOddsMetric'
  { -- | The names of all the variables.
    AggregatedLogOddsMetric -> [Text]
variableNames :: [Prelude.Text],
    -- | The relative importance of the variables in the list to the other event
    -- variable.
    AggregatedLogOddsMetric -> Double
aggregatedVariablesImportance :: Prelude.Double
  }
  deriving (AggregatedLogOddsMetric -> AggregatedLogOddsMetric -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AggregatedLogOddsMetric -> AggregatedLogOddsMetric -> Bool
$c/= :: AggregatedLogOddsMetric -> AggregatedLogOddsMetric -> Bool
== :: AggregatedLogOddsMetric -> AggregatedLogOddsMetric -> Bool
$c== :: AggregatedLogOddsMetric -> AggregatedLogOddsMetric -> Bool
Prelude.Eq, ReadPrec [AggregatedLogOddsMetric]
ReadPrec AggregatedLogOddsMetric
Int -> ReadS AggregatedLogOddsMetric
ReadS [AggregatedLogOddsMetric]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AggregatedLogOddsMetric]
$creadListPrec :: ReadPrec [AggregatedLogOddsMetric]
readPrec :: ReadPrec AggregatedLogOddsMetric
$creadPrec :: ReadPrec AggregatedLogOddsMetric
readList :: ReadS [AggregatedLogOddsMetric]
$creadList :: ReadS [AggregatedLogOddsMetric]
readsPrec :: Int -> ReadS AggregatedLogOddsMetric
$creadsPrec :: Int -> ReadS AggregatedLogOddsMetric
Prelude.Read, Int -> AggregatedLogOddsMetric -> ShowS
[AggregatedLogOddsMetric] -> ShowS
AggregatedLogOddsMetric -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AggregatedLogOddsMetric] -> ShowS
$cshowList :: [AggregatedLogOddsMetric] -> ShowS
show :: AggregatedLogOddsMetric -> String
$cshow :: AggregatedLogOddsMetric -> String
showsPrec :: Int -> AggregatedLogOddsMetric -> ShowS
$cshowsPrec :: Int -> AggregatedLogOddsMetric -> ShowS
Prelude.Show, forall x. Rep AggregatedLogOddsMetric x -> AggregatedLogOddsMetric
forall x. AggregatedLogOddsMetric -> Rep AggregatedLogOddsMetric x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AggregatedLogOddsMetric x -> AggregatedLogOddsMetric
$cfrom :: forall x. AggregatedLogOddsMetric -> Rep AggregatedLogOddsMetric x
Prelude.Generic)

-- |
-- Create a value of 'AggregatedLogOddsMetric' 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:
--
-- 'variableNames', 'aggregatedLogOddsMetric_variableNames' - The names of all the variables.
--
-- 'aggregatedVariablesImportance', 'aggregatedLogOddsMetric_aggregatedVariablesImportance' - The relative importance of the variables in the list to the other event
-- variable.
newAggregatedLogOddsMetric ::
  -- | 'aggregatedVariablesImportance'
  Prelude.Double ->
  AggregatedLogOddsMetric
newAggregatedLogOddsMetric :: Double -> AggregatedLogOddsMetric
newAggregatedLogOddsMetric
  Double
pAggregatedVariablesImportance_ =
    AggregatedLogOddsMetric'
      { $sel:variableNames:AggregatedLogOddsMetric' :: [Text]
variableNames =
          forall a. Monoid a => a
Prelude.mempty,
        $sel:aggregatedVariablesImportance:AggregatedLogOddsMetric' :: Double
aggregatedVariablesImportance =
          Double
pAggregatedVariablesImportance_
      }

-- | The names of all the variables.
aggregatedLogOddsMetric_variableNames :: Lens.Lens' AggregatedLogOddsMetric [Prelude.Text]
aggregatedLogOddsMetric_variableNames :: Lens' AggregatedLogOddsMetric [Text]
aggregatedLogOddsMetric_variableNames = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AggregatedLogOddsMetric' {[Text]
variableNames :: [Text]
$sel:variableNames:AggregatedLogOddsMetric' :: AggregatedLogOddsMetric -> [Text]
variableNames} -> [Text]
variableNames) (\s :: AggregatedLogOddsMetric
s@AggregatedLogOddsMetric' {} [Text]
a -> AggregatedLogOddsMetric
s {$sel:variableNames:AggregatedLogOddsMetric' :: [Text]
variableNames = [Text]
a} :: AggregatedLogOddsMetric) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The relative importance of the variables in the list to the other event
-- variable.
aggregatedLogOddsMetric_aggregatedVariablesImportance :: Lens.Lens' AggregatedLogOddsMetric Prelude.Double
aggregatedLogOddsMetric_aggregatedVariablesImportance :: Lens' AggregatedLogOddsMetric Double
aggregatedLogOddsMetric_aggregatedVariablesImportance = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AggregatedLogOddsMetric' {Double
aggregatedVariablesImportance :: Double
$sel:aggregatedVariablesImportance:AggregatedLogOddsMetric' :: AggregatedLogOddsMetric -> Double
aggregatedVariablesImportance} -> Double
aggregatedVariablesImportance) (\s :: AggregatedLogOddsMetric
s@AggregatedLogOddsMetric' {} Double
a -> AggregatedLogOddsMetric
s {$sel:aggregatedVariablesImportance:AggregatedLogOddsMetric' :: Double
aggregatedVariablesImportance = Double
a} :: AggregatedLogOddsMetric)

instance Data.FromJSON AggregatedLogOddsMetric where
  parseJSON :: Value -> Parser AggregatedLogOddsMetric
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AggregatedLogOddsMetric"
      ( \Object
x ->
          [Text] -> Double -> AggregatedLogOddsMetric
AggregatedLogOddsMetric'
            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
"variableNames" 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 a
Data..: Key
"aggregatedVariablesImportance")
      )

instance Prelude.Hashable AggregatedLogOddsMetric where
  hashWithSalt :: Int -> AggregatedLogOddsMetric -> Int
hashWithSalt Int
_salt AggregatedLogOddsMetric' {Double
[Text]
aggregatedVariablesImportance :: Double
variableNames :: [Text]
$sel:aggregatedVariablesImportance:AggregatedLogOddsMetric' :: AggregatedLogOddsMetric -> Double
$sel:variableNames:AggregatedLogOddsMetric' :: AggregatedLogOddsMetric -> [Text]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
variableNames
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Double
aggregatedVariablesImportance

instance Prelude.NFData AggregatedLogOddsMetric where
  rnf :: AggregatedLogOddsMetric -> ()
rnf AggregatedLogOddsMetric' {Double
[Text]
aggregatedVariablesImportance :: Double
variableNames :: [Text]
$sel:aggregatedVariablesImportance:AggregatedLogOddsMetric' :: AggregatedLogOddsMetric -> Double
$sel:variableNames:AggregatedLogOddsMetric' :: AggregatedLogOddsMetric -> [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf [Text]
variableNames
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Double
aggregatedVariablesImportance