Skip to content

Commit 285d976

Browse files
authored
Merge pull request #25 from ruivieira/main
Update explainers payload schema
2 parents 30f9aa8 + f85a8d1 commit 285d976

File tree

1 file changed

+54
-4
lines changed

1 file changed

+54
-4
lines changed

docs/modules/ROOT/pages/saliency-explanations-on-odh.adoc

+54-4
Original file line numberDiff line numberDiff line change
@@ -161,15 +161,40 @@ curl -sk -X POST -H "Authorization: Bearer ${TOKEN}" \
161161
-H "Content-Type: application/json" \
162162
-d "{
163163
\"predictionId\": \"$INFERENCE_ID\",
164-
\"modelConfig\": {
165-
\"target\": \"modelmesh-serving.${NAMESPACE}.svc.cluster.local:8033\",
166-
\"name\": \"explainer-test\",
167-
\"version\": \"v1\"
164+
\"config\": {
165+
\"model\": {
166+
\"target\": \"modelmesh-serving.${NAMESPACE}.svc.cluster.local:8033\",
167+
\"name\": \"explainer-test\",
168+
\"version\": \"v1\"
169+
}
168170
}
169171
}" \
170172
https://${TRUSTYAI_ROUTE}/explainers/local/lime
171173
----
172174

175+
If the explainer needs to be configured, additional options can be added under `config.explainer`. For instance, to configure the number of samples used by LIME we can issue:
176+
177+
[source,shell]
178+
----
179+
curl -sk -X POST -H "Authorization: Bearer ${TOKEN}" \
180+
-H "Content-Type: application/json" \
181+
-d "{
182+
\"predictionId\": \"$INFERENCE_ID\",
183+
\"config\": {
184+
\"model\": { <1>
185+
\"target\": \"modelmesh-serving.${NAMESPACE}.svc.cluster.local:8033\",
186+
\"name\": \"explainer-test\",
187+
\"version\": \"v1\"
188+
},
189+
\"explainer\": { <2>
190+
\"n_samples\": 100
191+
}
192+
}
193+
}" \
194+
https://${TRUSTYAI_ROUTE}/explainers/local/lime
195+
----
196+
<1> The `model` field specifies configuration regarding the model to be used.
197+
<2> The `explainer` field specifies the configuration of the explainer itself. In this instance, the number of samples.
173198

174199
=== Results
175200

@@ -211,3 +236,28 @@ The output will show the saliency scores and confidence for each input feature u
211236
}
212237
}
213238
----
239+
240+
=== Request a SHAP Explanation
241+
242+
Requesting a SHAP explanation is done using a similar call, but replacing the endpoint with SHAP's. For instance
243+
244+
[source,shell]
245+
----
246+
curl -sk -X POST -H "Authorization: Bearer ${TOKEN}" \
247+
-H "Content-Type: application/json" \
248+
-d "{
249+
\"predictionId\": \"$INFERENCE_ID\",
250+
\"config\": {
251+
\"model\": {
252+
\"target\": \"modelmesh-serving.${NAMESPACE}.svc.cluster.local:8033\",
253+
\"name\": \"explainer-test\",
254+
\"version\": \"v1\"
255+
},
256+
\"explainer\": {
257+
\"n_samples\": 100
258+
}
259+
}
260+
}" \
261+
https://${TRUSTYAI_ROUTE}/explainers/local/shap <1>
262+
----
263+
<1> The endpoint now refers to SHAP, instead of LIME.

0 commit comments

Comments
 (0)