{-# 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.TFIMetricDataPoint
-- 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.TFIMetricDataPoint 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 performance metrics data points for Transaction Fraud Insights (TFI)
-- model.
--
-- /See:/ 'newTFIMetricDataPoint' smart constructor.
data TFIMetricDataPoint = TFIMetricDataPoint'
  { -- | The false positive rate. This is the percentage of total legitimate
    -- events that are incorrectly predicted as fraud.
    TFIMetricDataPoint -> Maybe Double
fpr :: Prelude.Maybe Prelude.Double,
    -- | The percentage of fraud events correctly predicted as fraudulent as
    -- compared to all events predicted as fraudulent.
    TFIMetricDataPoint -> Maybe Double
precision :: Prelude.Maybe Prelude.Double,
    -- | The model threshold that specifies an acceptable fraud capture rate. For
    -- example, a threshold of 500 means any model score 500 or above is
    -- labeled as fraud.
    TFIMetricDataPoint -> Maybe Double
threshold :: Prelude.Maybe Prelude.Double,
    -- | The true positive rate. This is the percentage of total fraud the model
    -- detects. Also known as capture rate.
    TFIMetricDataPoint -> Maybe Double
tpr :: Prelude.Maybe Prelude.Double
  }
  deriving (TFIMetricDataPoint -> TFIMetricDataPoint -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TFIMetricDataPoint -> TFIMetricDataPoint -> Bool
$c/= :: TFIMetricDataPoint -> TFIMetricDataPoint -> Bool
== :: TFIMetricDataPoint -> TFIMetricDataPoint -> Bool
$c== :: TFIMetricDataPoint -> TFIMetricDataPoint -> Bool
Prelude.Eq, ReadPrec [TFIMetricDataPoint]
ReadPrec TFIMetricDataPoint
Int -> ReadS TFIMetricDataPoint
ReadS [TFIMetricDataPoint]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TFIMetricDataPoint]
$creadListPrec :: ReadPrec [TFIMetricDataPoint]
readPrec :: ReadPrec TFIMetricDataPoint
$creadPrec :: ReadPrec TFIMetricDataPoint
readList :: ReadS [TFIMetricDataPoint]
$creadList :: ReadS [TFIMetricDataPoint]
readsPrec :: Int -> ReadS TFIMetricDataPoint
$creadsPrec :: Int -> ReadS TFIMetricDataPoint
Prelude.Read, Int -> TFIMetricDataPoint -> ShowS
[TFIMetricDataPoint] -> ShowS
TFIMetricDataPoint -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TFIMetricDataPoint] -> ShowS
$cshowList :: [TFIMetricDataPoint] -> ShowS
show :: TFIMetricDataPoint -> String
$cshow :: TFIMetricDataPoint -> String
showsPrec :: Int -> TFIMetricDataPoint -> ShowS
$cshowsPrec :: Int -> TFIMetricDataPoint -> ShowS
Prelude.Show, forall x. Rep TFIMetricDataPoint x -> TFIMetricDataPoint
forall x. TFIMetricDataPoint -> Rep TFIMetricDataPoint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TFIMetricDataPoint x -> TFIMetricDataPoint
$cfrom :: forall x. TFIMetricDataPoint -> Rep TFIMetricDataPoint x
Prelude.Generic)

-- |
-- Create a value of 'TFIMetricDataPoint' 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:
--
-- 'fpr', 'tFIMetricDataPoint_fpr' - The false positive rate. This is the percentage of total legitimate
-- events that are incorrectly predicted as fraud.
--
-- 'precision', 'tFIMetricDataPoint_precision' - The percentage of fraud events correctly predicted as fraudulent as
-- compared to all events predicted as fraudulent.
--
-- 'threshold', 'tFIMetricDataPoint_threshold' - The model threshold that specifies an acceptable fraud capture rate. For
-- example, a threshold of 500 means any model score 500 or above is
-- labeled as fraud.
--
-- 'tpr', 'tFIMetricDataPoint_tpr' - The true positive rate. This is the percentage of total fraud the model
-- detects. Also known as capture rate.
newTFIMetricDataPoint ::
  TFIMetricDataPoint
newTFIMetricDataPoint :: TFIMetricDataPoint
newTFIMetricDataPoint =
  TFIMetricDataPoint'
    { $sel:fpr:TFIMetricDataPoint' :: Maybe Double
fpr = forall a. Maybe a
Prelude.Nothing,
      $sel:precision:TFIMetricDataPoint' :: Maybe Double
precision = forall a. Maybe a
Prelude.Nothing,
      $sel:threshold:TFIMetricDataPoint' :: Maybe Double
threshold = forall a. Maybe a
Prelude.Nothing,
      $sel:tpr:TFIMetricDataPoint' :: Maybe Double
tpr = forall a. Maybe a
Prelude.Nothing
    }

-- | The false positive rate. This is the percentage of total legitimate
-- events that are incorrectly predicted as fraud.
tFIMetricDataPoint_fpr :: Lens.Lens' TFIMetricDataPoint (Prelude.Maybe Prelude.Double)
tFIMetricDataPoint_fpr :: Lens' TFIMetricDataPoint (Maybe Double)
tFIMetricDataPoint_fpr = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TFIMetricDataPoint' {Maybe Double
fpr :: Maybe Double
$sel:fpr:TFIMetricDataPoint' :: TFIMetricDataPoint -> Maybe Double
fpr} -> Maybe Double
fpr) (\s :: TFIMetricDataPoint
s@TFIMetricDataPoint' {} Maybe Double
a -> TFIMetricDataPoint
s {$sel:fpr:TFIMetricDataPoint' :: Maybe Double
fpr = Maybe Double
a} :: TFIMetricDataPoint)

-- | The percentage of fraud events correctly predicted as fraudulent as
-- compared to all events predicted as fraudulent.
tFIMetricDataPoint_precision :: Lens.Lens' TFIMetricDataPoint (Prelude.Maybe Prelude.Double)
tFIMetricDataPoint_precision :: Lens' TFIMetricDataPoint (Maybe Double)
tFIMetricDataPoint_precision = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TFIMetricDataPoint' {Maybe Double
precision :: Maybe Double
$sel:precision:TFIMetricDataPoint' :: TFIMetricDataPoint -> Maybe Double
precision} -> Maybe Double
precision) (\s :: TFIMetricDataPoint
s@TFIMetricDataPoint' {} Maybe Double
a -> TFIMetricDataPoint
s {$sel:precision:TFIMetricDataPoint' :: Maybe Double
precision = Maybe Double
a} :: TFIMetricDataPoint)

-- | The model threshold that specifies an acceptable fraud capture rate. For
-- example, a threshold of 500 means any model score 500 or above is
-- labeled as fraud.
tFIMetricDataPoint_threshold :: Lens.Lens' TFIMetricDataPoint (Prelude.Maybe Prelude.Double)
tFIMetricDataPoint_threshold :: Lens' TFIMetricDataPoint (Maybe Double)
tFIMetricDataPoint_threshold = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TFIMetricDataPoint' {Maybe Double
threshold :: Maybe Double
$sel:threshold:TFIMetricDataPoint' :: TFIMetricDataPoint -> Maybe Double
threshold} -> Maybe Double
threshold) (\s :: TFIMetricDataPoint
s@TFIMetricDataPoint' {} Maybe Double
a -> TFIMetricDataPoint
s {$sel:threshold:TFIMetricDataPoint' :: Maybe Double
threshold = Maybe Double
a} :: TFIMetricDataPoint)

-- | The true positive rate. This is the percentage of total fraud the model
-- detects. Also known as capture rate.
tFIMetricDataPoint_tpr :: Lens.Lens' TFIMetricDataPoint (Prelude.Maybe Prelude.Double)
tFIMetricDataPoint_tpr :: Lens' TFIMetricDataPoint (Maybe Double)
tFIMetricDataPoint_tpr = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TFIMetricDataPoint' {Maybe Double
tpr :: Maybe Double
$sel:tpr:TFIMetricDataPoint' :: TFIMetricDataPoint -> Maybe Double
tpr} -> Maybe Double
tpr) (\s :: TFIMetricDataPoint
s@TFIMetricDataPoint' {} Maybe Double
a -> TFIMetricDataPoint
s {$sel:tpr:TFIMetricDataPoint' :: Maybe Double
tpr = Maybe Double
a} :: TFIMetricDataPoint)

instance Data.FromJSON TFIMetricDataPoint where
  parseJSON :: Value -> Parser TFIMetricDataPoint
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TFIMetricDataPoint"
      ( \Object
x ->
          Maybe Double
-> Maybe Double
-> Maybe Double
-> Maybe Double
-> TFIMetricDataPoint
TFIMetricDataPoint'
            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
"fpr")
            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
"precision")
            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
"threshold")
            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
"tpr")
      )

instance Prelude.Hashable TFIMetricDataPoint where
  hashWithSalt :: Int -> TFIMetricDataPoint -> Int
hashWithSalt Int
_salt TFIMetricDataPoint' {Maybe Double
tpr :: Maybe Double
threshold :: Maybe Double
precision :: Maybe Double
fpr :: Maybe Double
$sel:tpr:TFIMetricDataPoint' :: TFIMetricDataPoint -> Maybe Double
$sel:threshold:TFIMetricDataPoint' :: TFIMetricDataPoint -> Maybe Double
$sel:precision:TFIMetricDataPoint' :: TFIMetricDataPoint -> Maybe Double
$sel:fpr:TFIMetricDataPoint' :: TFIMetricDataPoint -> Maybe Double
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
fpr
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
precision
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
threshold
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
tpr

instance Prelude.NFData TFIMetricDataPoint where
  rnf :: TFIMetricDataPoint -> ()
rnf TFIMetricDataPoint' {Maybe Double
tpr :: Maybe Double
threshold :: Maybe Double
precision :: Maybe Double
fpr :: Maybe Double
$sel:tpr:TFIMetricDataPoint' :: TFIMetricDataPoint -> Maybe Double
$sel:threshold:TFIMetricDataPoint' :: TFIMetricDataPoint -> Maybe Double
$sel:precision:TFIMetricDataPoint' :: TFIMetricDataPoint -> Maybe Double
$sel:fpr:TFIMetricDataPoint' :: TFIMetricDataPoint -> Maybe Double
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
fpr
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
precision
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
threshold
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
tpr