Class: AWSCDK::Sagemaker::CfnEndpointConfig::ClarifyShapConfigProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
sagemaker/cfn_endpoint_config.rb

Overview

The configuration for SHAP analysis using SageMaker Clarify Explainer.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(shap_baseline_config:, number_of_samples: nil, seed: nil, text_config: nil, use_logit: nil) ⇒ ClarifyShapConfigProperty

Returns a new instance of ClarifyShapConfigProperty.

Parameters:



1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
# File 'sagemaker/cfn_endpoint_config.rb', line 1248

def initialize(shap_baseline_config:, number_of_samples: nil, seed: nil, text_config: nil, use_logit: nil)
  @shap_baseline_config = shap_baseline_config.is_a?(Hash) ? ::AWSCDK::Sagemaker::CfnEndpointConfig::ClarifyShapBaselineConfigProperty.new(**shap_baseline_config.transform_keys(&:to_sym)) : shap_baseline_config
  Jsii::Type.check_type(@shap_baseline_config, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19zYWdlbWFrZXIuQ2ZuRW5kcG9pbnRDb25maWcuQ2xhcmlmeVNoYXBCYXNlbGluZUNvbmZpZ1Byb3BlcnR5In1dfX0=")), "shapBaselineConfig")
  @number_of_samples = number_of_samples
  Jsii::Type.check_type(@number_of_samples, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "numberOfSamples") unless @number_of_samples.nil?
  @seed = seed
  Jsii::Type.check_type(@seed, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "seed") unless @seed.nil?
  @text_config = text_config.is_a?(Hash) ? ::AWSCDK::Sagemaker::CfnEndpointConfig::ClarifyTextConfigProperty.new(**text_config.transform_keys(&:to_sym)) : text_config
  Jsii::Type.check_type(@text_config, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19zYWdlbWFrZXIuQ2ZuRW5kcG9pbnRDb25maWcuQ2xhcmlmeVRleHRDb25maWdQcm9wZXJ0eSJ9XX19")), "textConfig") unless @text_config.nil?
  @use_logit = use_logit
  Jsii::Type.check_type(@use_logit, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "useLogit") unless @use_logit.nil?
end

Instance Attribute Details

#number_of_samplesNumeric? (readonly)

The number of samples to be used for analysis by the Kernal SHAP algorithm.

The number of samples determines the size of the synthetic dataset, which has an impact on latency of explainability requests. For more information, see the Synthetic data of Configure and create an endpoint .



1272
1273
1274
# File 'sagemaker/cfn_endpoint_config.rb', line 1272

def number_of_samples
  @number_of_samples
end

#seedNumeric? (readonly)

The starting value used to initialize the random number generator in the explainer.

Provide a value for this parameter to obtain a deterministic SHAP result.



1279
1280
1281
# File 'sagemaker/cfn_endpoint_config.rb', line 1279

def seed
  @seed
end

#shap_baseline_configAWSCDK::IResolvable, AWSCDK::Sagemaker::CfnEndpointConfig::ClarifyShapBaselineConfigProperty (readonly)

The configuration for the SHAP baseline of the Kernal SHAP algorithm.



1265
1266
1267
# File 'sagemaker/cfn_endpoint_config.rb', line 1265

def shap_baseline_config
  @shap_baseline_config
end

#text_configAWSCDK::IResolvable, ... (readonly)

A parameter that indicates if text features are treated as text and explanations are provided for individual units of text.

Required for natural language processing (NLP) explainability only.



1286
1287
1288
# File 'sagemaker/cfn_endpoint_config.rb', line 1286

def text_config
  @text_config
end

#use_logitBoolean, ... (readonly)

A Boolean toggle to indicate if you want to use the logit function (true) or log-odds units (false) for model predictions.

Defaults to false.



1293
1294
1295
# File 'sagemaker/cfn_endpoint_config.rb', line 1293

def use_logit
  @use_logit
end

Class Method Details

.jsii_propertiesObject



1295
1296
1297
1298
1299
1300
1301
1302
1303
# File 'sagemaker/cfn_endpoint_config.rb', line 1295

def self.jsii_properties
  {
    :shap_baseline_config => "shapBaselineConfig",
    :number_of_samples => "numberOfSamples",
    :seed => "seed",
    :text_config => "textConfig",
    :use_logit => "useLogit",
  }
end

Instance Method Details

#to_jsiiObject



1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
# File 'sagemaker/cfn_endpoint_config.rb', line 1305

def to_jsii
  result = {}
  result.merge!({
    "shapBaselineConfig" => @shap_baseline_config,
    "numberOfSamples" => @number_of_samples,
    "seed" => @seed,
    "textConfig" => @text_config,
    "useLogit" => @use_logit,
  })
  result.compact
end