{-# 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.SageMaker.Types.Bias
-- 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.SageMaker.Types.Bias 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
import Amazonka.SageMaker.Types.MetricsSource

-- | Contains bias metrics for a model.
--
-- /See:/ 'newBias' smart constructor.
data Bias = Bias'
  { -- | The post-training bias report for a model.
    Bias -> Maybe MetricsSource
postTrainingReport :: Prelude.Maybe MetricsSource,
    -- | The pre-training bias report for a model.
    Bias -> Maybe MetricsSource
preTrainingReport :: Prelude.Maybe MetricsSource,
    -- | The bias report for a model
    Bias -> Maybe MetricsSource
report :: Prelude.Maybe MetricsSource
  }
  deriving (Bias -> Bias -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Bias -> Bias -> Bool
$c/= :: Bias -> Bias -> Bool
== :: Bias -> Bias -> Bool
$c== :: Bias -> Bias -> Bool
Prelude.Eq, ReadPrec [Bias]
ReadPrec Bias
Int -> ReadS Bias
ReadS [Bias]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Bias]
$creadListPrec :: ReadPrec [Bias]
readPrec :: ReadPrec Bias
$creadPrec :: ReadPrec Bias
readList :: ReadS [Bias]
$creadList :: ReadS [Bias]
readsPrec :: Int -> ReadS Bias
$creadsPrec :: Int -> ReadS Bias
Prelude.Read, Int -> Bias -> ShowS
[Bias] -> ShowS
Bias -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Bias] -> ShowS
$cshowList :: [Bias] -> ShowS
show :: Bias -> String
$cshow :: Bias -> String
showsPrec :: Int -> Bias -> ShowS
$cshowsPrec :: Int -> Bias -> ShowS
Prelude.Show, forall x. Rep Bias x -> Bias
forall x. Bias -> Rep Bias x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Bias x -> Bias
$cfrom :: forall x. Bias -> Rep Bias x
Prelude.Generic)

-- |
-- Create a value of 'Bias' 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:
--
-- 'postTrainingReport', 'bias_postTrainingReport' - The post-training bias report for a model.
--
-- 'preTrainingReport', 'bias_preTrainingReport' - The pre-training bias report for a model.
--
-- 'report', 'bias_report' - The bias report for a model
newBias ::
  Bias
newBias :: Bias
newBias =
  Bias'
    { $sel:postTrainingReport:Bias' :: Maybe MetricsSource
postTrainingReport = forall a. Maybe a
Prelude.Nothing,
      $sel:preTrainingReport:Bias' :: Maybe MetricsSource
preTrainingReport = forall a. Maybe a
Prelude.Nothing,
      $sel:report:Bias' :: Maybe MetricsSource
report = forall a. Maybe a
Prelude.Nothing
    }

-- | The post-training bias report for a model.
bias_postTrainingReport :: Lens.Lens' Bias (Prelude.Maybe MetricsSource)
bias_postTrainingReport :: Lens' Bias (Maybe MetricsSource)
bias_postTrainingReport = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Bias' {Maybe MetricsSource
postTrainingReport :: Maybe MetricsSource
$sel:postTrainingReport:Bias' :: Bias -> Maybe MetricsSource
postTrainingReport} -> Maybe MetricsSource
postTrainingReport) (\s :: Bias
s@Bias' {} Maybe MetricsSource
a -> Bias
s {$sel:postTrainingReport:Bias' :: Maybe MetricsSource
postTrainingReport = Maybe MetricsSource
a} :: Bias)

-- | The pre-training bias report for a model.
bias_preTrainingReport :: Lens.Lens' Bias (Prelude.Maybe MetricsSource)
bias_preTrainingReport :: Lens' Bias (Maybe MetricsSource)
bias_preTrainingReport = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Bias' {Maybe MetricsSource
preTrainingReport :: Maybe MetricsSource
$sel:preTrainingReport:Bias' :: Bias -> Maybe MetricsSource
preTrainingReport} -> Maybe MetricsSource
preTrainingReport) (\s :: Bias
s@Bias' {} Maybe MetricsSource
a -> Bias
s {$sel:preTrainingReport:Bias' :: Maybe MetricsSource
preTrainingReport = Maybe MetricsSource
a} :: Bias)

-- | The bias report for a model
bias_report :: Lens.Lens' Bias (Prelude.Maybe MetricsSource)
bias_report :: Lens' Bias (Maybe MetricsSource)
bias_report = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Bias' {Maybe MetricsSource
report :: Maybe MetricsSource
$sel:report:Bias' :: Bias -> Maybe MetricsSource
report} -> Maybe MetricsSource
report) (\s :: Bias
s@Bias' {} Maybe MetricsSource
a -> Bias
s {$sel:report:Bias' :: Maybe MetricsSource
report = Maybe MetricsSource
a} :: Bias)

instance Data.FromJSON Bias where
  parseJSON :: Value -> Parser Bias
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Bias"
      ( \Object
x ->
          Maybe MetricsSource
-> Maybe MetricsSource -> Maybe MetricsSource -> Bias
Bias'
            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
"PostTrainingReport")
            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
"PreTrainingReport")
            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
"Report")
      )

instance Prelude.Hashable Bias where
  hashWithSalt :: Int -> Bias -> Int
hashWithSalt Int
_salt Bias' {Maybe MetricsSource
report :: Maybe MetricsSource
preTrainingReport :: Maybe MetricsSource
postTrainingReport :: Maybe MetricsSource
$sel:report:Bias' :: Bias -> Maybe MetricsSource
$sel:preTrainingReport:Bias' :: Bias -> Maybe MetricsSource
$sel:postTrainingReport:Bias' :: Bias -> Maybe MetricsSource
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe MetricsSource
postTrainingReport
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe MetricsSource
preTrainingReport
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe MetricsSource
report

instance Prelude.NFData Bias where
  rnf :: Bias -> ()
rnf Bias' {Maybe MetricsSource
report :: Maybe MetricsSource
preTrainingReport :: Maybe MetricsSource
postTrainingReport :: Maybe MetricsSource
$sel:report:Bias' :: Bias -> Maybe MetricsSource
$sel:preTrainingReport:Bias' :: Bias -> Maybe MetricsSource
$sel:postTrainingReport:Bias' :: Bias -> Maybe MetricsSource
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe MetricsSource
postTrainingReport
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe MetricsSource
preTrainingReport
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe MetricsSource
report

instance Data.ToJSON Bias where
  toJSON :: Bias -> Value
toJSON Bias' {Maybe MetricsSource
report :: Maybe MetricsSource
preTrainingReport :: Maybe MetricsSource
postTrainingReport :: Maybe MetricsSource
$sel:report:Bias' :: Bias -> Maybe MetricsSource
$sel:preTrainingReport:Bias' :: Bias -> Maybe MetricsSource
$sel:postTrainingReport:Bias' :: Bias -> Maybe MetricsSource
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"PostTrainingReport" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MetricsSource
postTrainingReport,
            (Key
"PreTrainingReport" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MetricsSource
preTrainingReport,
            (Key
"Report" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MetricsSource
report
          ]
      )