Class: AWSCDK::Sagemaker::CfnEndpointConfig::ClarifyInferenceConfigProperty
- Inherits:
-
Jsii::Struct
- Object
- Jsii::Struct
- AWSCDK::Sagemaker::CfnEndpointConfig::ClarifyInferenceConfigProperty
- Defined in:
- sagemaker/cfn_endpoint_config.rb
Overview
The inference configuration parameter for the model container.
Instance Attribute Summary collapse
-
#content_template ⇒ String?
readonly
A template string used to format a JSON record into an acceptable model container input.
-
#feature_headers ⇒ Array<String>?
readonly
The names of the features.
-
#feature_types ⇒ Array<String>?
readonly
A list of data types of the features (optional).
-
#features_attribute ⇒ String?
readonly
Provides the JMESPath expression to extract the features from a model container input in JSON Lines format.
-
#label_attribute ⇒ String?
readonly
A JMESPath expression used to locate the list of label headers in the model container output.
-
#label_headers ⇒ Array<String>?
readonly
For multiclass classification problems, the label headers are the names of the classes.
-
#label_index ⇒ Numeric?
readonly
A zero-based index used to extract a label header or list of label headers from model container output in CSV format.
-
#max_payload_in_mb ⇒ Numeric?
readonly
The maximum payload size (MB) allowed of a request from the explainer to the model container.
-
#max_record_count ⇒ Numeric?
readonly
The maximum number of records in a request that the model container can process when querying the model container for the predictions of a synthetic dataset .
-
#probability_attribute ⇒ String?
readonly
A JMESPath expression used to extract the probability (or score) from the model container output if the model container is in JSON Lines format.
-
#probability_index ⇒ Numeric?
readonly
A zero-based index used to extract a probability value (score) or list from model container output in CSV format.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(content_template: nil, feature_headers: nil, features_attribute: nil, feature_types: nil, label_attribute: nil, label_headers: nil, label_index: nil, max_payload_in_mb: nil, max_record_count: nil, probability_attribute: nil, probability_index: nil) ⇒ ClarifyInferenceConfigProperty
constructor
A new instance of ClarifyInferenceConfigProperty.
- #to_jsii ⇒ Object
Constructor Details
#initialize(content_template: nil, feature_headers: nil, features_attribute: nil, feature_types: nil, label_attribute: nil, label_headers: nil, label_index: nil, max_payload_in_mb: nil, max_record_count: nil, probability_attribute: nil, probability_index: nil) ⇒ ClarifyInferenceConfigProperty
Returns a new instance of ClarifyInferenceConfigProperty.
1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 |
# File 'sagemaker/cfn_endpoint_config.rb', line 1035 def initialize(content_template: nil, feature_headers: nil, features_attribute: nil, feature_types: nil, label_attribute: nil, label_headers: nil, label_index: nil, max_payload_in_mb: nil, max_record_count: nil, probability_attribute: nil, probability_index: nil) @content_template = content_template Jsii::Type.check_type(@content_template, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "contentTemplate") unless @content_template.nil? @feature_headers = feature_headers Jsii::Type.check_type(@feature_headers, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "featureHeaders") unless @feature_headers.nil? @features_attribute = features_attribute Jsii::Type.check_type(@features_attribute, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "featuresAttribute") unless @features_attribute.nil? @feature_types = feature_types Jsii::Type.check_type(@feature_types, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "featureTypes") unless @feature_types.nil? @label_attribute = label_attribute Jsii::Type.check_type(@label_attribute, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "labelAttribute") unless @label_attribute.nil? @label_headers = label_headers Jsii::Type.check_type(@label_headers, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "labelHeaders") unless @label_headers.nil? @label_index = label_index Jsii::Type.check_type(@label_index, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "labelIndex") unless @label_index.nil? @max_payload_in_mb = max_payload_in_mb Jsii::Type.check_type(@max_payload_in_mb, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "maxPayloadInMb") unless @max_payload_in_mb.nil? @max_record_count = max_record_count Jsii::Type.check_type(@max_record_count, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "maxRecordCount") unless @max_record_count.nil? @probability_attribute = probability_attribute Jsii::Type.check_type(@probability_attribute, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "probabilityAttribute") unless @probability_attribute.nil? @probability_index = probability_index Jsii::Type.check_type(@probability_index, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "probabilityIndex") unless @probability_index.nil? end |
Instance Attribute Details
#content_template ⇒ String? (readonly)
A template string used to format a JSON record into an acceptable model container input.
For example, a ContentTemplate string '{"myfeatures":$features}' will format a list of features [1,2,3] into the record string '{"myfeatures":[1,2,3]}' . Required only when the model container input is in JSON Lines format.
1066 1067 1068 |
# File 'sagemaker/cfn_endpoint_config.rb', line 1066 def content_template @content_template end |
#feature_headers ⇒ Array<String>? (readonly)
The names of the features.
If provided, these are included in the endpoint response payload to help readability of the InvokeEndpoint output. See the Response section under Invoke the endpoint in the Developer Guide for more information.
1073 1074 1075 |
# File 'sagemaker/cfn_endpoint_config.rb', line 1073 def feature_headers @feature_headers end |
#feature_types ⇒ Array<String>? (readonly)
A list of data types of the features (optional).
Applicable only to NLP explainability. If provided, FeatureTypes must have at least one 'text' string (for example, ['text'] ). If FeatureTypes is not provided, the explainer infers the feature types based on the baseline data. The feature types are included in the endpoint response payload. For additional information see the response section under Invoke the endpoint in the Developer Guide for more information.
1087 1088 1089 |
# File 'sagemaker/cfn_endpoint_config.rb', line 1087 def feature_types @feature_types end |
#features_attribute ⇒ String? (readonly)
Provides the JMESPath expression to extract the features from a model container input in JSON Lines format.
For example, if FeaturesAttribute is the JMESPath expression 'myfeatures' , it extracts a list of features [1,2,3] from request data '{"myfeatures":[1,2,3]}' .
1080 1081 1082 |
# File 'sagemaker/cfn_endpoint_config.rb', line 1080 def features_attribute @features_attribute end |
#label_attribute ⇒ String? (readonly)
A JMESPath expression used to locate the list of label headers in the model container output.
Example : If the model container output of a batch request is '{"labels":["cat","dog","fish"],"probability":[0.6,0.3,0.1]}' , then set LabelAttribute to 'labels' to extract the list of label headers ["cat","dog","fish"]
1094 1095 1096 |
# File 'sagemaker/cfn_endpoint_config.rb', line 1094 def label_attribute @label_attribute end |
#label_headers ⇒ Array<String>? (readonly)
For multiclass classification problems, the label headers are the names of the classes.
Otherwise, the label header is the name of the predicted label. These are used to help readability for the output of the InvokeEndpoint API. See the response section under Invoke the endpoint in the Developer Guide for more information. If there are no label headers in the model container output, provide them manually using this parameter.
1101 1102 1103 |
# File 'sagemaker/cfn_endpoint_config.rb', line 1101 def label_headers @label_headers end |
#label_index ⇒ Numeric? (readonly)
A zero-based index used to extract a label header or list of label headers from model container output in CSV format.
Example for a multiclass model: If the model container output consists of label headers followed by probabilities: '"[\'cat\',\'dog\',\'fish\']","[0.1,0.6,0.3]"' , set LabelIndex to 0 to select the label headers ['cat','dog','fish'] .
1108 1109 1110 |
# File 'sagemaker/cfn_endpoint_config.rb', line 1108 def label_index @label_index end |
#max_payload_in_mb ⇒ Numeric? (readonly)
The maximum payload size (MB) allowed of a request from the explainer to the model container.
Defaults to 6 MB.
1115 1116 1117 |
# File 'sagemaker/cfn_endpoint_config.rb', line 1115 def max_payload_in_mb @max_payload_in_mb end |
#max_record_count ⇒ Numeric? (readonly)
The maximum number of records in a request that the model container can process when querying the model container for the predictions of a synthetic dataset . A record is a unit of input data that inference can be made on, for example, a single line in CSV data. If MaxRecordCount is 1 , the model container expects one record per request. A value of 2 or greater means that the model expects batch requests, which can reduce overhead and speed up the inferencing process. If this parameter is not provided, the explainer will tune the record count per request according to the model container's capacity at runtime.
1120 1121 1122 |
# File 'sagemaker/cfn_endpoint_config.rb', line 1120 def max_record_count @max_record_count end |
#probability_attribute ⇒ String? (readonly)
A JMESPath expression used to extract the probability (or score) from the model container output if the model container is in JSON Lines format.
Example : If the model container output of a single request is '{"predicted_label":1,"probability":0.6}' , then set ProbabilityAttribute to 'probability' .
1127 1128 1129 |
# File 'sagemaker/cfn_endpoint_config.rb', line 1127 def probability_attribute @probability_attribute end |
#probability_index ⇒ Numeric? (readonly)
A zero-based index used to extract a probability value (score) or list from model container output in CSV format.
If this value is not provided, the entire model container output will be treated as a probability value (score) or list.
Example for a single class model: If the model container output consists of a string-formatted prediction label followed by its probability: '1,0.6' , set ProbabilityIndex to 1 to select the probability value 0.6 .
Example for a multiclass model: If the model container output consists of a string-formatted prediction label followed by its probability: '"[\'cat\',\'dog\',\'fish\']","[0.1,0.6,0.3]"' , set ProbabilityIndex to 1 to select the probability values [0.1,0.6,0.3] .
1138 1139 1140 |
# File 'sagemaker/cfn_endpoint_config.rb', line 1138 def probability_index @probability_index end |
Class Method Details
.jsii_properties ⇒ Object
1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 |
# File 'sagemaker/cfn_endpoint_config.rb', line 1140 def self.jsii_properties { :content_template => "contentTemplate", :feature_headers => "featureHeaders", :features_attribute => "featuresAttribute", :feature_types => "featureTypes", :label_attribute => "labelAttribute", :label_headers => "labelHeaders", :label_index => "labelIndex", :max_payload_in_mb => "maxPayloadInMb", :max_record_count => "maxRecordCount", :probability_attribute => "probabilityAttribute", :probability_index => "probabilityIndex", } end |
Instance Method Details
#to_jsii ⇒ Object
1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 |
# File 'sagemaker/cfn_endpoint_config.rb', line 1156 def to_jsii result = {} result.merge!({ "contentTemplate" => @content_template, "featureHeaders" => @feature_headers, "featuresAttribute" => @features_attribute, "featureTypes" => @feature_types, "labelAttribute" => @label_attribute, "labelHeaders" => @label_headers, "labelIndex" => @label_index, "maxPayloadInMb" => @max_payload_in_mb, "maxRecordCount" => @max_record_count, "probabilityAttribute" => @probability_attribute, "probabilityIndex" => @probability_index, }) result.compact end |