Skip to content

Commit 24ff71d

Browse files
committed
fix: Correct Clarify API docstrings by changing JSONPath to JMESPath
SageMaker Clarify API docstrings use term JSONPath, but actually the Clarify processing container expects JMESPath expression. The commit corrects the term to avoid customer confusion.
1 parent 32969da commit 24ff71d

File tree

4 files changed

+25
-21
lines changed

4 files changed

+25
-21
lines changed

src/sagemaker/clarify.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -332,9 +332,9 @@ def __init__(
332332
If this field is None, then the ``s3_output_path`` will be used
333333
to store the ``analysis_config`` output.
334334
label (str): Target attribute of the model required by bias metrics.
335-
Specified as column name or index for CSV dataset or as JSONPath for JSONLines.
335+
Specified as column name or index for CSV dataset or as JMESPath expression for JSONLines.
336336
*Required parameter* except for when the input dataset does not contain the label.
337-
features (List[str]): JSONPath for locating the feature columns for bias metrics if the
337+
features (List[str]): JMESPath expression to locate the feature columns for bias metrics if the
338338
dataset format is JSONLines.
339339
dataset_type (str): Format of the dataset. Valid values are ``"text/csv"`` for CSV,
340340
``"application/jsonlines"`` for JSONLines, and
@@ -717,11 +717,11 @@ def __init__(
717717
``label_headers=['cat','dog','fish']`` and infer the predicted label to be ``'fish'``.
718718
719719
Args:
720-
label (str or int): Index or JSONPath location in the model output for the prediction.
720+
label (str or int): Index or JMESPath expression to locate the prediction in the model output.
721721
In case, this is a predicted label of the same type as the label in the dataset,
722722
no further arguments need to be specified.
723-
probability (str or int): Index or JSONPath location in the model output
724-
for the predicted score(s).
723+
probability (str or int): Index or JMESPath expression to locate the predicted score(s)
724+
in the model output.
725725
probability_threshold (float): An optional value for binary prediction tasks in which
726726
the model returns a probability, to indicate the threshold to convert the
727727
prediction to a boolean value. Default is ``0.5``.
@@ -1646,7 +1646,7 @@ def run_explainability(
16461646
You can request multiple methods at once by passing in a list of
16471647
`~sagemaker.clarify.ExplainabilityConfig`.
16481648
model_scores (int or str or :class:`~sagemaker.clarify.ModelPredictedLabelConfig`):
1649-
Index or JSONPath to locate the predicted scores in the model output. This is not
1649+
Index or JMESPath expression to locate the predicted scores in the model output. This is not
16501650
required if the model output is a single score. Alternatively, it can be an instance
16511651
of :class:`~sagemaker.clarify.SageMakerClarifyProcessor`
16521652
to provide more parameters like ``label_headers``.
@@ -1775,7 +1775,7 @@ def run_bias_and_explainability(
17751775
str or
17761776
:class:`~sagemaker.clarify.ModelPredictedLabelConfig`
17771777
):
1778-
Index or JSONPath to locate the predicted scores in the model output. This is not
1778+
Index or JMESPath expression to locate the predicted scores in the model output. This is not
17791779
required if the model output is a single score. Alternatively, it can be an instance
17801780
of :class:`~sagemaker.clarify.SageMakerClarifyProcessor`
17811781
to provide more parameters like ``label_headers``.

src/sagemaker/model_monitor/clarify_model_monitoring.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,7 @@ def __init__(self, bias_config, headers=None, label=None):
843843
configurations.
844844
headers (list[str]): A list of column names in the input dataset.
845845
label (str): Target attribute for the model required by bias metrics.
846-
Specified as column name or index for CSV dataset, or as JSONPath for JSONLines.
846+
Specified as column name or index for CSV dataset, or as JMESPath expression for JSONLines.
847847
"""
848848
self.analysis_config = bias_config.get_config()
849849
if headers is not None:
@@ -889,7 +889,7 @@ def suggest_baseline(
889889
model_config (:class:`~sagemaker.clarify.ModelConfig`): Config of the model and its
890890
endpoint to be created.
891891
model_scores (int or str or :class:`~sagemaker.clarify.ModelPredictedLabelConfig`):
892-
Index or JSONPath to locate the predicted scores in the model output. This is not
892+
Index or JMESPath expression to locate the predicted scores in the model output. This is not
893893
required if the model output is a single score. Alternatively, it can be an instance
894894
of ModelPredictedLabelConfig to provide more parameters like label_headers.
895895
wait (bool): Whether the call should wait until the job completes (default: False).
@@ -1302,12 +1302,12 @@ def __init__(
13021302
Args:
13031303
analysis_config (BiasAnalysisConfig or ExplainabilityAnalysisConfig): analysis config
13041304
from configurations of the baselining job.
1305-
features_attribute (str): JSONpath to locate features in predictor request payload.
1305+
features_attribute (str): JMESPath expression to locate features in predictor request payload.
13061306
Only required when predictor content type is JSONlines.
1307-
inference_attribute (str): Index, header or JSONpath to locate predicted label in
1307+
inference_attribute (str): Index, header or JMESPath expression to locate predicted label in
13081308
predictor response payload.
1309-
probability_attribute (str): Index or JSONpath location in the model output for
1310-
probabilities or scores to be used for explainability.
1309+
probability_attribute (str): Index or JMESPath expression to locate probabilities or scores
1310+
in the model output for computing feature attribution.
13111311
probability_threshold_attribute (float): Value to indicate the threshold to select
13121312
the binary label in the case of binary classification. Default is 0.5.
13131313
"""

src/sagemaker/model_monitor/model_monitoring.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,12 +1061,13 @@ def _generate_env_map(
10611061
dataset_format (dict): The format of the baseline_dataset.
10621062
dataset_source_container_path (str): The path to the dataset source.
10631063
inference_attribute (str): Index or JSONpath to locate predicted label(s).
1064-
Only used for ModelQualityMonitor, ModelBiasMonitor, and ModelExplainabilityMonitor
1064+
Only used for ModelQualityMonitor.
10651065
probability_attribute (str or int): Index or JSONpath to locate probabilities.
1066-
Only used for ModelQualityMonitor, ModelBiasMonitor and ModelExplainabilityMonitor
1067-
ground_truth_attribute (str): Index or JSONpath to locate actual label(s).
1066+
Only used for ModelQualityMonitor.
1067+
ground_truth_attribute (str): Index to locate actual label(s).
1068+
Only used for ModelQualityMonitor.
10681069
probability_threshold_attribute (float): threshold to convert probabilities to binaries
1069-
Only used for ModelQualityMonitor, ModelBiasMonitor and ModelExplainabilityMonitor
1070+
Only used for ModelQualityMonitor.
10701071
10711072
Returns:
10721073
dict: Dictionary of environment keys and values.
@@ -2600,10 +2601,13 @@ def suggest_baseline(
26002601
problem_type (str): The type of problem of this model quality monitoring. Valid
26012602
values are "Regression", "BinaryClassification", "MulticlassClassification".
26022603
inference_attribute (str): Index or JSONpath to locate predicted label(s).
2604+
Only used for ModelQualityMonitor.
26032605
probability_attribute (str or int): Index or JSONpath to locate probabilities.
2604-
ground_truth_attribute (str): Index or JSONpath to locate actual label(s).
2606+
Only used for ModelQualityMonitor.
2607+
ground_truth_attribute (str): Index to locate actual label(s).
2608+
Only used for ModelQualityMonitor.
26052609
probability_threshold_attribute (float): threshold to convert probabilities to binaries
2606-
Only used for ModelQualityMonitor, ModelBiasMonitor and ModelExplainabilityMonitor
2610+
Only used for ModelQualityMonitor.
26072611
post_analytics_processor_script (str): The path to the record post-analytics processor
26082612
script. This can be a local path or an S3 uri.
26092613
output_s3_uri (str): Desired S3 destination Destination of the constraint_violations

src/sagemaker/workflow/clarify_check_step.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ class ModelExplainabilityCheckConfig(ClarifyCheckConfig):
132132
model_config (ModelConfig): Config of the model and its endpoint to be created.
133133
explainability_config (SHAPConfig): Config of the specific explainability method.
134134
Currently, only SHAP is supported.
135-
model_scores (str or int or ModelPredictedLabelConfig): Index or JSONPath location
136-
in the model output for the predicted scores to be explained (default: None).
135+
model_scores (str or int or ModelPredictedLabelConfig): Index or JMESPath expression
136+
to locate the predicted scores in the model output (default: None).
137137
This is not required if the model output is a single score. Alternatively,
138138
an instance of ModelPredictedLabelConfig can be provided
139139
but this field CANNOT be any type of the `PipelineVariable`.

0 commit comments

Comments
 (0)