Skip to content

Commit 8887cfa

Browse files
authored
[ML] updating the infer trained model deployment docs (#80083)
the infer endpoint has changed its format. Also, the results format for the various tasks have changed. This updates the docs to match what is currently in 8.0.0.
1 parent 9233dc2 commit 8887cfa

File tree

1 file changed

+23
-16
lines changed

1 file changed

+23
-16
lines changed

docs/reference/ml/df-analytics/apis/infer-trained-model-deployment.asciidoc

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,11 @@ Controls the amount of time to wait for {infer} results. Defaults to 10 seconds.
4242
[[infer-trained-model-request-body]]
4343
== {api-request-body-title}
4444

45-
`input`::
46-
(Required,string)
47-
The input text for evaluation.
45+
`docs`::
46+
(Required, array)
47+
An array of objects to pass to the model for inference. The objects should
48+
contain a field matching your configured trained model input. Typically, the field
49+
name is `text_field`. Currently, only a single value is allowed.
4850

4951
////
5052
[[infer-trained-model-deployment-results]]
@@ -66,24 +68,24 @@ text classification task, the response is the score. For example:
6668
--------------------------------------------------
6769
POST _ml/trained_models/model2/deployment/_infer
6870
{
69-
"input": "The movie was awesome!!"
71+
"docs": [{"text_field": "The movie was awesome!!"}]
7072
}
7173
--------------------------------------------------
7274
// TEST[skip:TBD]
7375

74-
The API returns scores in this case, for example:
76+
The API returns the predicted label and the confidence.
7577

7678
[source,console-result]
7779
----
7880
{
79-
"positive" : 0.9998062667902223,
80-
"negative" : 1.9373320977752957E-4
81+
"predicted_value" : "POSITIVE",
82+
"prediction_probability" : 0.9998667964092964
8183
}
8284
----
8385
// NOTCONSOLE
8486

85-
For named entity recognition (NER) tasks, the response contains the recognized
86-
entities and their type. For example:
87+
For named entity recognition (NER) tasks, the response contains the annotated
88+
text output and the recognized entities.
8789

8890
[source,console]
8991
--------------------------------------------------
@@ -94,21 +96,26 @@ POST _ml/trained_models/model2/deployment/_infer
9496
--------------------------------------------------
9597
// TEST[skip:TBD]
9698

97-
The API returns scores in this case, for example:
99+
The API returns in this case:
98100

99101
[source,console-result]
100102
----
101103
{
104+
"predicted_value" : "Hi my name is [Josh](PER&Josh) and I live in [Berlin](LOC&Berlin)",
102105
"entities" : [
103106
{
104-
"label" : "person",
105-
"score" : 0.9988716330253505,
106-
"word" : "Josh"
107+
"entity" : "Josh",
108+
"class_name" : "PER",
109+
"class_probability" : 0.9977303419824,
110+
"start_pos" : 14,
111+
"end_pos" : 18
107112
},
108113
{
109-
"label" : "location",
110-
"score" : 0.9980872542990656,
111-
"word" : "Berlin"
114+
"entity" : "Berlin",
115+
"class_name" : "LOC",
116+
"class_probability" : 0.9992474323902818,
117+
"start_pos" : 33,
118+
"end_pos" : 39
112119
}
113120
]
114121
}

0 commit comments

Comments
 (0)