{-# 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.ClarifyShapBaselineConfig
-- 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.ClarifyShapBaselineConfig 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 configuration for the
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/clarify-feature-attribute-shap-baselines.html SHAP baseline>
-- (also called the background or reference dataset) of the Kernal SHAP
-- algorithm.
--
-- -   The number of records in the baseline data determines the size of
--     the synthetic dataset, which has an impact on latency of
--     explainability requests. For more information, see the __Synthetic
--     data__ of
--     <https://docs.aws.amazon.com/sagemaker/latest/dg/clarify-online-explainability-create-endpoint.html Configure and create an endpoint>.
--
-- -   @ShapBaseline@ and @ShapBaselineUri@ are mutually exclusive
--     parameters. One or the either is required to configure a SHAP
--     baseline.
--
-- /See:/ 'newClarifyShapBaselineConfig' smart constructor.
data ClarifyShapBaselineConfig = ClarifyShapBaselineConfig'
  { -- | The MIME type of the baseline data. Choose from @\'text\/csv\'@ or
    -- @\'application\/jsonlines\'@. Defaults to @\'text\/csv\'@.
    ClarifyShapBaselineConfig -> Maybe Text
mimeType :: Prelude.Maybe Prelude.Text,
    -- | The inline SHAP baseline data in string format. @ShapBaseline@ can have
    -- one or multiple records to be used as the baseline dataset. The format
    -- of the SHAP baseline file should be the same format as the training
    -- dataset. For example, if the training dataset is in CSV format and each
    -- record contains four features, and all features are numerical, then the
    -- format of the baseline data should also share these characteristics. For
    -- natural language processing (NLP) of text columns, the baseline value
    -- should be the value used to replace the unit of text specified by the
    -- @Granularity@ of the @TextConfig@ parameter. The size limit for
    -- @ShapBasline@ is 4 KB. Use the @ShapBaselineUri@ parameter if you want
    -- to provide more than 4 KB of baseline data.
    ClarifyShapBaselineConfig -> Maybe Text
shapBaseline :: Prelude.Maybe Prelude.Text,
    -- | The uniform resource identifier (URI) of the S3 bucket where the SHAP
    -- baseline file is stored. The format of the SHAP baseline file should be
    -- the same format as the format of the training dataset. For example, if
    -- the training dataset is in CSV format, and each record in the training
    -- dataset has four features, and all features are numerical, then the
    -- baseline file should also have this same format. Each record should
    -- contain only the features. If you are using a virtual private cloud
    -- (VPC), the @ShapBaselineUri@ should be accessible to the VPC. For more
    -- information about setting up endpoints with Amazon Virtual Private
    -- Cloud, see
    -- <https://docs.aws.amazon.com/sagemaker/latest/dg/infrastructure-give-access.html Give SageMaker access to Resources in your Amazon Virtual Private Cloud>.
    ClarifyShapBaselineConfig -> Maybe Text
shapBaselineUri :: Prelude.Maybe Prelude.Text
  }
  deriving (ClarifyShapBaselineConfig -> ClarifyShapBaselineConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ClarifyShapBaselineConfig -> ClarifyShapBaselineConfig -> Bool
$c/= :: ClarifyShapBaselineConfig -> ClarifyShapBaselineConfig -> Bool
== :: ClarifyShapBaselineConfig -> ClarifyShapBaselineConfig -> Bool
$c== :: ClarifyShapBaselineConfig -> ClarifyShapBaselineConfig -> Bool
Prelude.Eq, ReadPrec [ClarifyShapBaselineConfig]
ReadPrec ClarifyShapBaselineConfig
Int -> ReadS ClarifyShapBaselineConfig
ReadS [ClarifyShapBaselineConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ClarifyShapBaselineConfig]
$creadListPrec :: ReadPrec [ClarifyShapBaselineConfig]
readPrec :: ReadPrec ClarifyShapBaselineConfig
$creadPrec :: ReadPrec ClarifyShapBaselineConfig
readList :: ReadS [ClarifyShapBaselineConfig]
$creadList :: ReadS [ClarifyShapBaselineConfig]
readsPrec :: Int -> ReadS ClarifyShapBaselineConfig
$creadsPrec :: Int -> ReadS ClarifyShapBaselineConfig
Prelude.Read, Int -> ClarifyShapBaselineConfig -> ShowS
[ClarifyShapBaselineConfig] -> ShowS
ClarifyShapBaselineConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ClarifyShapBaselineConfig] -> ShowS
$cshowList :: [ClarifyShapBaselineConfig] -> ShowS
show :: ClarifyShapBaselineConfig -> String
$cshow :: ClarifyShapBaselineConfig -> String
showsPrec :: Int -> ClarifyShapBaselineConfig -> ShowS
$cshowsPrec :: Int -> ClarifyShapBaselineConfig -> ShowS
Prelude.Show, forall x.
Rep ClarifyShapBaselineConfig x -> ClarifyShapBaselineConfig
forall x.
ClarifyShapBaselineConfig -> Rep ClarifyShapBaselineConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ClarifyShapBaselineConfig x -> ClarifyShapBaselineConfig
$cfrom :: forall x.
ClarifyShapBaselineConfig -> Rep ClarifyShapBaselineConfig x
Prelude.Generic)

-- |
-- Create a value of 'ClarifyShapBaselineConfig' 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:
--
-- 'mimeType', 'clarifyShapBaselineConfig_mimeType' - The MIME type of the baseline data. Choose from @\'text\/csv\'@ or
-- @\'application\/jsonlines\'@. Defaults to @\'text\/csv\'@.
--
-- 'shapBaseline', 'clarifyShapBaselineConfig_shapBaseline' - The inline SHAP baseline data in string format. @ShapBaseline@ can have
-- one or multiple records to be used as the baseline dataset. The format
-- of the SHAP baseline file should be the same format as the training
-- dataset. For example, if the training dataset is in CSV format and each
-- record contains four features, and all features are numerical, then the
-- format of the baseline data should also share these characteristics. For
-- natural language processing (NLP) of text columns, the baseline value
-- should be the value used to replace the unit of text specified by the
-- @Granularity@ of the @TextConfig@ parameter. The size limit for
-- @ShapBasline@ is 4 KB. Use the @ShapBaselineUri@ parameter if you want
-- to provide more than 4 KB of baseline data.
--
-- 'shapBaselineUri', 'clarifyShapBaselineConfig_shapBaselineUri' - The uniform resource identifier (URI) of the S3 bucket where the SHAP
-- baseline file is stored. The format of the SHAP baseline file should be
-- the same format as the format of the training dataset. For example, if
-- the training dataset is in CSV format, and each record in the training
-- dataset has four features, and all features are numerical, then the
-- baseline file should also have this same format. Each record should
-- contain only the features. If you are using a virtual private cloud
-- (VPC), the @ShapBaselineUri@ should be accessible to the VPC. For more
-- information about setting up endpoints with Amazon Virtual Private
-- Cloud, see
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/infrastructure-give-access.html Give SageMaker access to Resources in your Amazon Virtual Private Cloud>.
newClarifyShapBaselineConfig ::
  ClarifyShapBaselineConfig
newClarifyShapBaselineConfig :: ClarifyShapBaselineConfig
newClarifyShapBaselineConfig =
  ClarifyShapBaselineConfig'
    { $sel:mimeType:ClarifyShapBaselineConfig' :: Maybe Text
mimeType =
        forall a. Maybe a
Prelude.Nothing,
      $sel:shapBaseline:ClarifyShapBaselineConfig' :: Maybe Text
shapBaseline = forall a. Maybe a
Prelude.Nothing,
      $sel:shapBaselineUri:ClarifyShapBaselineConfig' :: Maybe Text
shapBaselineUri = forall a. Maybe a
Prelude.Nothing
    }

-- | The MIME type of the baseline data. Choose from @\'text\/csv\'@ or
-- @\'application\/jsonlines\'@. Defaults to @\'text\/csv\'@.
clarifyShapBaselineConfig_mimeType :: Lens.Lens' ClarifyShapBaselineConfig (Prelude.Maybe Prelude.Text)
clarifyShapBaselineConfig_mimeType :: Lens' ClarifyShapBaselineConfig (Maybe Text)
clarifyShapBaselineConfig_mimeType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClarifyShapBaselineConfig' {Maybe Text
mimeType :: Maybe Text
$sel:mimeType:ClarifyShapBaselineConfig' :: ClarifyShapBaselineConfig -> Maybe Text
mimeType} -> Maybe Text
mimeType) (\s :: ClarifyShapBaselineConfig
s@ClarifyShapBaselineConfig' {} Maybe Text
a -> ClarifyShapBaselineConfig
s {$sel:mimeType:ClarifyShapBaselineConfig' :: Maybe Text
mimeType = Maybe Text
a} :: ClarifyShapBaselineConfig)

-- | The inline SHAP baseline data in string format. @ShapBaseline@ can have
-- one or multiple records to be used as the baseline dataset. The format
-- of the SHAP baseline file should be the same format as the training
-- dataset. For example, if the training dataset is in CSV format and each
-- record contains four features, and all features are numerical, then the
-- format of the baseline data should also share these characteristics. For
-- natural language processing (NLP) of text columns, the baseline value
-- should be the value used to replace the unit of text specified by the
-- @Granularity@ of the @TextConfig@ parameter. The size limit for
-- @ShapBasline@ is 4 KB. Use the @ShapBaselineUri@ parameter if you want
-- to provide more than 4 KB of baseline data.
clarifyShapBaselineConfig_shapBaseline :: Lens.Lens' ClarifyShapBaselineConfig (Prelude.Maybe Prelude.Text)
clarifyShapBaselineConfig_shapBaseline :: Lens' ClarifyShapBaselineConfig (Maybe Text)
clarifyShapBaselineConfig_shapBaseline = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClarifyShapBaselineConfig' {Maybe Text
shapBaseline :: Maybe Text
$sel:shapBaseline:ClarifyShapBaselineConfig' :: ClarifyShapBaselineConfig -> Maybe Text
shapBaseline} -> Maybe Text
shapBaseline) (\s :: ClarifyShapBaselineConfig
s@ClarifyShapBaselineConfig' {} Maybe Text
a -> ClarifyShapBaselineConfig
s {$sel:shapBaseline:ClarifyShapBaselineConfig' :: Maybe Text
shapBaseline = Maybe Text
a} :: ClarifyShapBaselineConfig)

-- | The uniform resource identifier (URI) of the S3 bucket where the SHAP
-- baseline file is stored. The format of the SHAP baseline file should be
-- the same format as the format of the training dataset. For example, if
-- the training dataset is in CSV format, and each record in the training
-- dataset has four features, and all features are numerical, then the
-- baseline file should also have this same format. Each record should
-- contain only the features. If you are using a virtual private cloud
-- (VPC), the @ShapBaselineUri@ should be accessible to the VPC. For more
-- information about setting up endpoints with Amazon Virtual Private
-- Cloud, see
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/infrastructure-give-access.html Give SageMaker access to Resources in your Amazon Virtual Private Cloud>.
clarifyShapBaselineConfig_shapBaselineUri :: Lens.Lens' ClarifyShapBaselineConfig (Prelude.Maybe Prelude.Text)
clarifyShapBaselineConfig_shapBaselineUri :: Lens' ClarifyShapBaselineConfig (Maybe Text)
clarifyShapBaselineConfig_shapBaselineUri = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClarifyShapBaselineConfig' {Maybe Text
shapBaselineUri :: Maybe Text
$sel:shapBaselineUri:ClarifyShapBaselineConfig' :: ClarifyShapBaselineConfig -> Maybe Text
shapBaselineUri} -> Maybe Text
shapBaselineUri) (\s :: ClarifyShapBaselineConfig
s@ClarifyShapBaselineConfig' {} Maybe Text
a -> ClarifyShapBaselineConfig
s {$sel:shapBaselineUri:ClarifyShapBaselineConfig' :: Maybe Text
shapBaselineUri = Maybe Text
a} :: ClarifyShapBaselineConfig)

instance Data.FromJSON ClarifyShapBaselineConfig where
  parseJSON :: Value -> Parser ClarifyShapBaselineConfig
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ClarifyShapBaselineConfig"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> ClarifyShapBaselineConfig
ClarifyShapBaselineConfig'
            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
"MimeType")
            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
"ShapBaseline")
            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
"ShapBaselineUri")
      )

instance Prelude.Hashable ClarifyShapBaselineConfig where
  hashWithSalt :: Int -> ClarifyShapBaselineConfig -> Int
hashWithSalt Int
_salt ClarifyShapBaselineConfig' {Maybe Text
shapBaselineUri :: Maybe Text
shapBaseline :: Maybe Text
mimeType :: Maybe Text
$sel:shapBaselineUri:ClarifyShapBaselineConfig' :: ClarifyShapBaselineConfig -> Maybe Text
$sel:shapBaseline:ClarifyShapBaselineConfig' :: ClarifyShapBaselineConfig -> Maybe Text
$sel:mimeType:ClarifyShapBaselineConfig' :: ClarifyShapBaselineConfig -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
mimeType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
shapBaseline
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
shapBaselineUri

instance Prelude.NFData ClarifyShapBaselineConfig where
  rnf :: ClarifyShapBaselineConfig -> ()
rnf ClarifyShapBaselineConfig' {Maybe Text
shapBaselineUri :: Maybe Text
shapBaseline :: Maybe Text
mimeType :: Maybe Text
$sel:shapBaselineUri:ClarifyShapBaselineConfig' :: ClarifyShapBaselineConfig -> Maybe Text
$sel:shapBaseline:ClarifyShapBaselineConfig' :: ClarifyShapBaselineConfig -> Maybe Text
$sel:mimeType:ClarifyShapBaselineConfig' :: ClarifyShapBaselineConfig -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
mimeType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
shapBaseline
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
shapBaselineUri

instance Data.ToJSON ClarifyShapBaselineConfig where
  toJSON :: ClarifyShapBaselineConfig -> Value
toJSON ClarifyShapBaselineConfig' {Maybe Text
shapBaselineUri :: Maybe Text
shapBaseline :: Maybe Text
mimeType :: Maybe Text
$sel:shapBaselineUri:ClarifyShapBaselineConfig' :: ClarifyShapBaselineConfig -> Maybe Text
$sel:shapBaseline:ClarifyShapBaselineConfig' :: ClarifyShapBaselineConfig -> Maybe Text
$sel:mimeType:ClarifyShapBaselineConfig' :: ClarifyShapBaselineConfig -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"MimeType" 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 Text
mimeType,
            (Key
"ShapBaseline" 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 Text
shapBaseline,
            (Key
"ShapBaselineUri" 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 Text
shapBaselineUri
          ]
      )