in source/lib/blueprints/byom/model_monitor.py [0:0]
def _add_model_bias_explainability_extra_attributes(self):
# create paramaters/conditions
# create bias specific paramaters
if self.monitoring_type == "ModelBias":
self.base_config = pf.create_bias_config_parameter(self)
self.model_predicted_label_config = pf.create_model_predicted_label_config_parameter(self)
self.model_predicted_label_config_provided = cf.create_attribute_provided_condition(
self, "PredictedLabelConfigProvided", self.model_predicted_label_config
)
# update baseline attributes
self.baseline_attributes.update(
dict(
model_predicted_label_config=core.Fn.condition_if(
self.model_predicted_label_config_provided.logical_id,
self.model_predicted_label_config.value_as_string,
core.Aws.NO_VALUE,
).to_string(),
bias_config=self.base_config.value_as_string,
)
)
if self.monitoring_type == "ModelExplainability":
self.shap_config = pf.create_shap_config_parameter(self)
self.model_scores = pf.create_model_scores_parameter(self)
self.model_scores_provided = cf.create_attribute_provided_condition(
self, "ModelScoresProvided", self.model_scores
)
# update baseline attributes
self.baseline_attributes.update(
dict(
shap_config=self.shap_config.value_as_string,
model_scores=core.Fn.condition_if(
self.model_scores_provided.logical_id,
self.model_scores.value_as_string,
core.Aws.NO_VALUE,
).to_string(),
)
)
# common parameters
self.features_attribute = pf.create_features_attribute_parameter(self)
self.features_attribute_provided = cf.create_attribute_provided_condition(
self, "FeaturesAttributeProvided", self.features_attribute
)
# update monitor attributes
self.monitor_attributes.update(
dict(
features_attribute=core.Fn.condition_if(
self.features_attribute_provided.logical_id,
self.features_attribute.value_as_string,
core.Aws.NO_VALUE,
).to_string(),
)
)