{-# 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.Glue.Types.ConfusionMatrix
-- 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.Glue.Types.ConfusionMatrix 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 confusion matrix shows you what your transform is predicting
-- accurately and what types of errors it is making.
--
-- For more information, see
-- <https://en.wikipedia.org/wiki/Confusion_matrix Confusion matrix> in
-- Wikipedia.
--
-- /See:/ 'newConfusionMatrix' smart constructor.
data ConfusionMatrix = ConfusionMatrix'
  { -- | The number of matches in the data that the transform didn\'t find, in
    -- the confusion matrix for your transform.
    ConfusionMatrix -> Maybe Integer
numFalseNegatives :: Prelude.Maybe Prelude.Integer,
    -- | The number of nonmatches in the data that the transform incorrectly
    -- classified as a match, in the confusion matrix for your transform.
    ConfusionMatrix -> Maybe Integer
numFalsePositives :: Prelude.Maybe Prelude.Integer,
    -- | The number of nonmatches in the data that the transform correctly
    -- rejected, in the confusion matrix for your transform.
    ConfusionMatrix -> Maybe Integer
numTrueNegatives :: Prelude.Maybe Prelude.Integer,
    -- | The number of matches in the data that the transform correctly found, in
    -- the confusion matrix for your transform.
    ConfusionMatrix -> Maybe Integer
numTruePositives :: Prelude.Maybe Prelude.Integer
  }
  deriving (ConfusionMatrix -> ConfusionMatrix -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConfusionMatrix -> ConfusionMatrix -> Bool
$c/= :: ConfusionMatrix -> ConfusionMatrix -> Bool
== :: ConfusionMatrix -> ConfusionMatrix -> Bool
$c== :: ConfusionMatrix -> ConfusionMatrix -> Bool
Prelude.Eq, ReadPrec [ConfusionMatrix]
ReadPrec ConfusionMatrix
Int -> ReadS ConfusionMatrix
ReadS [ConfusionMatrix]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConfusionMatrix]
$creadListPrec :: ReadPrec [ConfusionMatrix]
readPrec :: ReadPrec ConfusionMatrix
$creadPrec :: ReadPrec ConfusionMatrix
readList :: ReadS [ConfusionMatrix]
$creadList :: ReadS [ConfusionMatrix]
readsPrec :: Int -> ReadS ConfusionMatrix
$creadsPrec :: Int -> ReadS ConfusionMatrix
Prelude.Read, Int -> ConfusionMatrix -> ShowS
[ConfusionMatrix] -> ShowS
ConfusionMatrix -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConfusionMatrix] -> ShowS
$cshowList :: [ConfusionMatrix] -> ShowS
show :: ConfusionMatrix -> String
$cshow :: ConfusionMatrix -> String
showsPrec :: Int -> ConfusionMatrix -> ShowS
$cshowsPrec :: Int -> ConfusionMatrix -> ShowS
Prelude.Show, forall x. Rep ConfusionMatrix x -> ConfusionMatrix
forall x. ConfusionMatrix -> Rep ConfusionMatrix x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ConfusionMatrix x -> ConfusionMatrix
$cfrom :: forall x. ConfusionMatrix -> Rep ConfusionMatrix x
Prelude.Generic)

-- |
-- Create a value of 'ConfusionMatrix' 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:
--
-- 'numFalseNegatives', 'confusionMatrix_numFalseNegatives' - The number of matches in the data that the transform didn\'t find, in
-- the confusion matrix for your transform.
--
-- 'numFalsePositives', 'confusionMatrix_numFalsePositives' - The number of nonmatches in the data that the transform incorrectly
-- classified as a match, in the confusion matrix for your transform.
--
-- 'numTrueNegatives', 'confusionMatrix_numTrueNegatives' - The number of nonmatches in the data that the transform correctly
-- rejected, in the confusion matrix for your transform.
--
-- 'numTruePositives', 'confusionMatrix_numTruePositives' - The number of matches in the data that the transform correctly found, in
-- the confusion matrix for your transform.
newConfusionMatrix ::
  ConfusionMatrix
newConfusionMatrix :: ConfusionMatrix
newConfusionMatrix =
  ConfusionMatrix'
    { $sel:numFalseNegatives:ConfusionMatrix' :: Maybe Integer
numFalseNegatives =
        forall a. Maybe a
Prelude.Nothing,
      $sel:numFalsePositives:ConfusionMatrix' :: Maybe Integer
numFalsePositives = forall a. Maybe a
Prelude.Nothing,
      $sel:numTrueNegatives:ConfusionMatrix' :: Maybe Integer
numTrueNegatives = forall a. Maybe a
Prelude.Nothing,
      $sel:numTruePositives:ConfusionMatrix' :: Maybe Integer
numTruePositives = forall a. Maybe a
Prelude.Nothing
    }

-- | The number of matches in the data that the transform didn\'t find, in
-- the confusion matrix for your transform.
confusionMatrix_numFalseNegatives :: Lens.Lens' ConfusionMatrix (Prelude.Maybe Prelude.Integer)
confusionMatrix_numFalseNegatives :: Lens' ConfusionMatrix (Maybe Integer)
confusionMatrix_numFalseNegatives = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfusionMatrix' {Maybe Integer
numFalseNegatives :: Maybe Integer
$sel:numFalseNegatives:ConfusionMatrix' :: ConfusionMatrix -> Maybe Integer
numFalseNegatives} -> Maybe Integer
numFalseNegatives) (\s :: ConfusionMatrix
s@ConfusionMatrix' {} Maybe Integer
a -> ConfusionMatrix
s {$sel:numFalseNegatives:ConfusionMatrix' :: Maybe Integer
numFalseNegatives = Maybe Integer
a} :: ConfusionMatrix)

-- | The number of nonmatches in the data that the transform incorrectly
-- classified as a match, in the confusion matrix for your transform.
confusionMatrix_numFalsePositives :: Lens.Lens' ConfusionMatrix (Prelude.Maybe Prelude.Integer)
confusionMatrix_numFalsePositives :: Lens' ConfusionMatrix (Maybe Integer)
confusionMatrix_numFalsePositives = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfusionMatrix' {Maybe Integer
numFalsePositives :: Maybe Integer
$sel:numFalsePositives:ConfusionMatrix' :: ConfusionMatrix -> Maybe Integer
numFalsePositives} -> Maybe Integer
numFalsePositives) (\s :: ConfusionMatrix
s@ConfusionMatrix' {} Maybe Integer
a -> ConfusionMatrix
s {$sel:numFalsePositives:ConfusionMatrix' :: Maybe Integer
numFalsePositives = Maybe Integer
a} :: ConfusionMatrix)

-- | The number of nonmatches in the data that the transform correctly
-- rejected, in the confusion matrix for your transform.
confusionMatrix_numTrueNegatives :: Lens.Lens' ConfusionMatrix (Prelude.Maybe Prelude.Integer)
confusionMatrix_numTrueNegatives :: Lens' ConfusionMatrix (Maybe Integer)
confusionMatrix_numTrueNegatives = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfusionMatrix' {Maybe Integer
numTrueNegatives :: Maybe Integer
$sel:numTrueNegatives:ConfusionMatrix' :: ConfusionMatrix -> Maybe Integer
numTrueNegatives} -> Maybe Integer
numTrueNegatives) (\s :: ConfusionMatrix
s@ConfusionMatrix' {} Maybe Integer
a -> ConfusionMatrix
s {$sel:numTrueNegatives:ConfusionMatrix' :: Maybe Integer
numTrueNegatives = Maybe Integer
a} :: ConfusionMatrix)

-- | The number of matches in the data that the transform correctly found, in
-- the confusion matrix for your transform.
confusionMatrix_numTruePositives :: Lens.Lens' ConfusionMatrix (Prelude.Maybe Prelude.Integer)
confusionMatrix_numTruePositives :: Lens' ConfusionMatrix (Maybe Integer)
confusionMatrix_numTruePositives = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfusionMatrix' {Maybe Integer
numTruePositives :: Maybe Integer
$sel:numTruePositives:ConfusionMatrix' :: ConfusionMatrix -> Maybe Integer
numTruePositives} -> Maybe Integer
numTruePositives) (\s :: ConfusionMatrix
s@ConfusionMatrix' {} Maybe Integer
a -> ConfusionMatrix
s {$sel:numTruePositives:ConfusionMatrix' :: Maybe Integer
numTruePositives = Maybe Integer
a} :: ConfusionMatrix)

instance Data.FromJSON ConfusionMatrix where
  parseJSON :: Value -> Parser ConfusionMatrix
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ConfusionMatrix"
      ( \Object
x ->
          Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> ConfusionMatrix
ConfusionMatrix'
            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
"NumFalseNegatives")
            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
"NumFalsePositives")
            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
"NumTrueNegatives")
            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
"NumTruePositives")
      )

instance Prelude.Hashable ConfusionMatrix where
  hashWithSalt :: Int -> ConfusionMatrix -> Int
hashWithSalt Int
_salt ConfusionMatrix' {Maybe Integer
numTruePositives :: Maybe Integer
numTrueNegatives :: Maybe Integer
numFalsePositives :: Maybe Integer
numFalseNegatives :: Maybe Integer
$sel:numTruePositives:ConfusionMatrix' :: ConfusionMatrix -> Maybe Integer
$sel:numTrueNegatives:ConfusionMatrix' :: ConfusionMatrix -> Maybe Integer
$sel:numFalsePositives:ConfusionMatrix' :: ConfusionMatrix -> Maybe Integer
$sel:numFalseNegatives:ConfusionMatrix' :: ConfusionMatrix -> Maybe Integer
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
numFalseNegatives
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
numFalsePositives
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
numTrueNegatives
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
numTruePositives

instance Prelude.NFData ConfusionMatrix where
  rnf :: ConfusionMatrix -> ()
rnf ConfusionMatrix' {Maybe Integer
numTruePositives :: Maybe Integer
numTrueNegatives :: Maybe Integer
numFalsePositives :: Maybe Integer
numFalseNegatives :: Maybe Integer
$sel:numTruePositives:ConfusionMatrix' :: ConfusionMatrix -> Maybe Integer
$sel:numTrueNegatives:ConfusionMatrix' :: ConfusionMatrix -> Maybe Integer
$sel:numFalsePositives:ConfusionMatrix' :: ConfusionMatrix -> Maybe Integer
$sel:numFalseNegatives:ConfusionMatrix' :: ConfusionMatrix -> Maybe Integer
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
numFalseNegatives
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
numFalsePositives
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
numTrueNegatives
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
numTruePositives