{-# 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.Explainability
-- 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.Explainability 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 explainability metrics for a model.
--
-- /See:/ 'newExplainability' smart constructor.
data Explainability = Explainability'
  { -- | The explainability report for a model.
    Explainability -> Maybe MetricsSource
report :: Prelude.Maybe MetricsSource
  }
  deriving (Explainability -> Explainability -> Bool
(Explainability -> Explainability -> Bool)
-> (Explainability -> Explainability -> Bool) -> Eq Explainability
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Explainability -> Explainability -> Bool
$c/= :: Explainability -> Explainability -> Bool
== :: Explainability -> Explainability -> Bool
$c== :: Explainability -> Explainability -> Bool
Prelude.Eq, ReadPrec [Explainability]
ReadPrec Explainability
Int -> ReadS Explainability
ReadS [Explainability]
(Int -> ReadS Explainability)
-> ReadS [Explainability]
-> ReadPrec Explainability
-> ReadPrec [Explainability]
-> Read Explainability
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Explainability]
$creadListPrec :: ReadPrec [Explainability]
readPrec :: ReadPrec Explainability
$creadPrec :: ReadPrec Explainability
readList :: ReadS [Explainability]
$creadList :: ReadS [Explainability]
readsPrec :: Int -> ReadS Explainability
$creadsPrec :: Int -> ReadS Explainability
Prelude.Read, Int -> Explainability -> ShowS
[Explainability] -> ShowS
Explainability -> String
(Int -> Explainability -> ShowS)
-> (Explainability -> String)
-> ([Explainability] -> ShowS)
-> Show Explainability
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Explainability] -> ShowS
$cshowList :: [Explainability] -> ShowS
show :: Explainability -> String
$cshow :: Explainability -> String
showsPrec :: Int -> Explainability -> ShowS
$cshowsPrec :: Int -> Explainability -> ShowS
Prelude.Show, (forall x. Explainability -> Rep Explainability x)
-> (forall x. Rep Explainability x -> Explainability)
-> Generic Explainability
forall x. Rep Explainability x -> Explainability
forall x. Explainability -> Rep Explainability x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Explainability x -> Explainability
$cfrom :: forall x. Explainability -> Rep Explainability x
Prelude.Generic)

-- |
-- Create a value of 'Explainability' 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', 'explainability_report' - The explainability report for a model.
newExplainability ::
  Explainability
newExplainability :: Explainability
newExplainability =
  Explainability' :: Maybe MetricsSource -> Explainability
Explainability' {$sel:report:Explainability' :: Maybe MetricsSource
report = Maybe MetricsSource
forall a. Maybe a
Prelude.Nothing}

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

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

instance Prelude.NFData Explainability

instance Core.ToJSON Explainability where
  toJSON :: Explainability -> Value
toJSON Explainability' {Maybe MetricsSource
report :: Maybe MetricsSource
$sel:report:Explainability' :: Explainability -> 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]
      )