{-# 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.OFIMetricDataPoint
-- 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.OFIMetricDataPoint 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 Online Fraud Insights (OFI) model performance metrics data points.
--
-- /See:/ 'newOFIMetricDataPoint' smart constructor.
data OFIMetricDataPoint = OFIMetricDataPoint'
  { -- | The false positive rate. This is the percentage of total legitimate
    -- events that are incorrectly predicted as fraud.
    OFIMetricDataPoint -> Maybe Double
fpr :: Prelude.Maybe Prelude.Double,
    -- | The percentage of fraud events correctly predicted as fraudulent as
    -- compared to all events predicted as fraudulent.
    OFIMetricDataPoint -> 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.
    OFIMetricDataPoint -> 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.
    OFIMetricDataPoint -> Maybe Double
tpr :: Prelude.Maybe Prelude.Double
  }
  deriving (OFIMetricDataPoint -> OFIMetricDataPoint -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OFIMetricDataPoint -> OFIMetricDataPoint -> Bool
$c/= :: OFIMetricDataPoint -> OFIMetricDataPoint -> Bool
== :: OFIMetricDataPoint -> OFIMetricDataPoint -> Bool
$c== :: OFIMetricDataPoint -> OFIMetricDataPoint -> Bool
Prelude.Eq, ReadPrec [OFIMetricDataPoint]
ReadPrec OFIMetricDataPoint
Int -> ReadS OFIMetricDataPoint
ReadS [OFIMetricDataPoint]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OFIMetricDataPoint]
$creadListPrec :: ReadPrec [OFIMetricDataPoint]
readPrec :: ReadPrec OFIMetricDataPoint
$creadPrec :: ReadPrec OFIMetricDataPoint
readList :: ReadS [OFIMetricDataPoint]
$creadList :: ReadS [OFIMetricDataPoint]
readsPrec :: Int -> ReadS OFIMetricDataPoint
$creadsPrec :: Int -> ReadS OFIMetricDataPoint
Prelude.Read, Int -> OFIMetricDataPoint -> ShowS
[OFIMetricDataPoint] -> ShowS
OFIMetricDataPoint -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OFIMetricDataPoint] -> ShowS
$cshowList :: [OFIMetricDataPoint] -> ShowS
show :: OFIMetricDataPoint -> String
$cshow :: OFIMetricDataPoint -> String
showsPrec :: Int -> OFIMetricDataPoint -> ShowS
$cshowsPrec :: Int -> OFIMetricDataPoint -> ShowS
Prelude.Show, forall x. Rep OFIMetricDataPoint x -> OFIMetricDataPoint
forall x. OFIMetricDataPoint -> Rep OFIMetricDataPoint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OFIMetricDataPoint x -> OFIMetricDataPoint
$cfrom :: forall x. OFIMetricDataPoint -> Rep OFIMetricDataPoint x
Prelude.Generic)

-- |
-- Create a value of 'OFIMetricDataPoint' 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', 'oFIMetricDataPoint_fpr' - The false positive rate. This is the percentage of total legitimate
-- events that are incorrectly predicted as fraud.
--
-- 'precision', 'oFIMetricDataPoint_precision' - The percentage of fraud events correctly predicted as fraudulent as
-- compared to all events predicted as fraudulent.
--
-- 'threshold', 'oFIMetricDataPoint_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', 'oFIMetricDataPoint_tpr' - The true positive rate. This is the percentage of total fraud the model
-- detects. Also known as capture rate.
newOFIMetricDataPoint ::
  OFIMetricDataPoint
newOFIMetricDataPoint :: OFIMetricDataPoint
newOFIMetricDataPoint =
  OFIMetricDataPoint'
    { $sel:fpr:OFIMetricDataPoint' :: Maybe Double
fpr = forall a. Maybe a
Prelude.Nothing,
      $sel:precision:OFIMetricDataPoint' :: Maybe Double
precision = forall a. Maybe a
Prelude.Nothing,
      $sel:threshold:OFIMetricDataPoint' :: Maybe Double
threshold = forall a. Maybe a
Prelude.Nothing,
      $sel:tpr:OFIMetricDataPoint' :: 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.
oFIMetricDataPoint_fpr :: Lens.Lens' OFIMetricDataPoint (Prelude.Maybe Prelude.Double)
oFIMetricDataPoint_fpr :: Lens' OFIMetricDataPoint (Maybe Double)
oFIMetricDataPoint_fpr = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OFIMetricDataPoint' {Maybe Double
fpr :: Maybe Double
$sel:fpr:OFIMetricDataPoint' :: OFIMetricDataPoint -> Maybe Double
fpr} -> Maybe Double
fpr) (\s :: OFIMetricDataPoint
s@OFIMetricDataPoint' {} Maybe Double
a -> OFIMetricDataPoint
s {$sel:fpr:OFIMetricDataPoint' :: Maybe Double
fpr = Maybe Double
a} :: OFIMetricDataPoint)

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

-- | 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.
oFIMetricDataPoint_threshold :: Lens.Lens' OFIMetricDataPoint (Prelude.Maybe Prelude.Double)
oFIMetricDataPoint_threshold :: Lens' OFIMetricDataPoint (Maybe Double)
oFIMetricDataPoint_threshold = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OFIMetricDataPoint' {Maybe Double
threshold :: Maybe Double
$sel:threshold:OFIMetricDataPoint' :: OFIMetricDataPoint -> Maybe Double
threshold} -> Maybe Double
threshold) (\s :: OFIMetricDataPoint
s@OFIMetricDataPoint' {} Maybe Double
a -> OFIMetricDataPoint
s {$sel:threshold:OFIMetricDataPoint' :: Maybe Double
threshold = Maybe Double
a} :: OFIMetricDataPoint)

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

instance Data.FromJSON OFIMetricDataPoint where
  parseJSON :: Value -> Parser OFIMetricDataPoint
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"OFIMetricDataPoint"
      ( \Object
x ->
          Maybe Double
-> Maybe Double
-> Maybe Double
-> Maybe Double
-> OFIMetricDataPoint
OFIMetricDataPoint'
            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 OFIMetricDataPoint where
  hashWithSalt :: Int -> OFIMetricDataPoint -> Int
hashWithSalt Int
_salt OFIMetricDataPoint' {Maybe Double
tpr :: Maybe Double
threshold :: Maybe Double
precision :: Maybe Double
fpr :: Maybe Double
$sel:tpr:OFIMetricDataPoint' :: OFIMetricDataPoint -> Maybe Double
$sel:threshold:OFIMetricDataPoint' :: OFIMetricDataPoint -> Maybe Double
$sel:precision:OFIMetricDataPoint' :: OFIMetricDataPoint -> Maybe Double
$sel:fpr:OFIMetricDataPoint' :: OFIMetricDataPoint -> 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 OFIMetricDataPoint where
  rnf :: OFIMetricDataPoint -> ()
rnf OFIMetricDataPoint' {Maybe Double
tpr :: Maybe Double
threshold :: Maybe Double
precision :: Maybe Double
fpr :: Maybe Double
$sel:tpr:OFIMetricDataPoint' :: OFIMetricDataPoint -> Maybe Double
$sel:threshold:OFIMetricDataPoint' :: OFIMetricDataPoint -> Maybe Double
$sel:precision:OFIMetricDataPoint' :: OFIMetricDataPoint -> Maybe Double
$sel:fpr:OFIMetricDataPoint' :: OFIMetricDataPoint -> 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