@@ -161,15 +161,40 @@ curl -sk -X POST -H "Authorization: Bearer ${TOKEN}" \
161
161
-H "Content-Type: application/json" \
162
162
-d "{
163
163
\"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
+ }
168
170
}
169
171
}" \
170
172
https://${TRUSTYAI_ROUTE}/explainers/local/lime
171
173
----
172
174
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.
173
198
174
199
=== Results
175
200
@@ -211,3 +236,28 @@ The output will show the saliency scores and confidence for each input feature u
211
236
}
212
237
}
213
238
----
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