{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.SageMaker.Types.Bias where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 bias report for a model
    Bias -> Maybe MetricsSource
report :: Prelude.Maybe MetricsSource
  }
  deriving (Bias -> Bias -> Bool
(Bias -> Bias -> Bool) -> (Bias -> Bias -> Bool) -> Eq Bias
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]
(Int -> ReadS Bias)
-> ReadS [Bias] -> ReadPrec Bias -> ReadPrec [Bias] -> Read 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
(Int -> Bias -> ShowS)
-> (Bias -> String) -> ([Bias] -> ShowS) -> Show Bias
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. Bias -> Rep Bias x)
-> (forall x. Rep Bias x -> Bias) -> Generic Bias
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:
--
-- 'report', 'bias_report' - The bias report for a model
newBias ::
  Bias
newBias :: Bias
newBias = Bias' :: Maybe MetricsSource -> Bias
Bias' {$sel:report:Bias' :: Maybe MetricsSource
report = Maybe MetricsSource
forall a. Maybe a
Prelude.Nothing}

-- | The bias report for a model
bias_report :: Lens.Lens' Bias (Prelude.Maybe MetricsSource)
bias_report :: (Maybe MetricsSource -> f (Maybe MetricsSource)) -> Bias -> f Bias
bias_report = (Bias -> Maybe MetricsSource)
-> (Bias -> Maybe MetricsSource -> Bias)
-> Lens Bias Bias (Maybe MetricsSource) (Maybe MetricsSource)
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 Core.FromJSON Bias where
  parseJSON :: Value -> Parser Bias
parseJSON =
    String -> (Object -> Parser Bias) -> Value -> Parser Bias
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Bias"
      (\Object
x -> Maybe MetricsSource -> Bias
Bias' (Maybe MetricsSource -> Bias)
-> Parser (Maybe MetricsSource) -> Parser Bias
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe MetricsSource)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Report"))

instance Prelude.Hashable Bias

instance Prelude.NFData Bias

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