Evaluate a trained model
Generally available; Added in 8.3.0
Body
Required
-
An array of objects to pass to the model for inference. The objects should contain a fields matching your configured trained model input. Typically, for NLP models, the field name is
text_field
. Currently, for NLP models, only a single value is allowed. -
Hide inference_config attributes Show inference_config attributes object
-
Hide classification attributes Show classification attributes object
-
Specifies the number of top class predictions to return. Defaults to 0.
-
Specifies the maximum number of feature importance values per document.
-
Specifies the type of the predicted field to write. Acceptable values are: string, number, boolean. When boolean is provided 1.0 is transformed to true and 0.0 to false.
-
The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value.
-
Specifies the field to which the top classes are written. Defaults to top_classes.
-
-
Hide text_classification attributes Show text_classification attributes object
-
Specifies the number of top class predictions to return. Defaults to 0.
-
The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value.
-
Classification labels to apply other than the stored labels. Must have the same deminsions as the default configured labels
-
-
Hide zero_shot_classification attributes Show zero_shot_classification attributes object
-
The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value.
-
Update the configured multi label option. Indicates if more than one true label exists. Defaults to the configured value.
-
The labels to predict.
-
Hide fill_mask attributes Show fill_mask attributes object
-
Specifies the number of top class predictions to return. Defaults to 0.
-
The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value.
-
-
Hide ner attributes Show ner attributes object
-
The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value.
-
Hide pass_through attributes Show pass_through attributes object
-
The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value.
-
Hide text_embedding attributes Show text_embedding attributes object
-
The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value.
-
Hide text_expansion attributes Show text_expansion attributes object
-
The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value.
-
Hide question_answering attributes Show question_answering attributes object
-
The question to answer given the inference context
-
Specifies the number of top class predictions to return. Defaults to 0.
-
The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value.
-
The maximum answer length to consider for extraction
-
Responses
-
Hide response attribute Show response attribute object
-
Hide inference_results attributes Show inference_results attributes object
-
If the model is trained for named entity recognition (NER) tasks, the response contains the recognized entities.
-
Indicates whether the input text was truncated to meet the model's maximum sequence length limit. This property is present only when it is true.
predicted_value
number | string | boolean | null | array[number | string | boolean | null] | array[number | string | boolean | null | array] If the model is trained for a text classification or zero shot classification task, the response is the predicted class. For named entity recognition (NER) tasks, it contains the annotated text output. For fill mask tasks, it contains the top prediction for replacing the mask token. For text embedding tasks, it contains the raw numerical text embedding values. For regression models, its a numerical value For classification models, it may be an integer, double, boolean or string depending on prediction type
-
For fill mask tasks, the response contains the input text sequence with the mask token replaced by the predicted value. Additionally
-
Specifies a probability for the predicted value.
-
Specifies a confidence score for the predicted value.
-
For fill mask, text classification, and zero shot classification tasks, the response contains a list of top class entries.
-
If the request failed, the response contains the reason for the failure.
-
The feature importance for the inference results. Relevant only for classification or regression models
-
-
curl \
--request POST 'http://api.example.com/_ml/trained_models/{model_id}/_infer' \
--header "Authorization: $API_KEY" \
--header "Content-Type: application/json" \
--data '"{\n \"docs\":[{\"text\": \"The fool doth think he is wise, but the wise man knows himself to be a fool.\"}]\n}"'
{
"docs":[{"text": "The fool doth think he is wise, but the wise man knows himself to be a fool."}]
}