Evaluate a trained model
- POST /_ml/trained_models/{model_id}/_infer
Request body
-
docsstring to objectrequired -
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. -
inference_configobject -
The inference configuration updates to apply on the API call
-
classificationobject -
Classification configuration for inference.
-
num_top_feature_importance_valuesnumber · default: 0 -
Specifies the maximum number of feature importance values per document.
-
prediction_field_typestring -
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.
-
zero_shot_classificationobject -
Zeroshot classification configuration for inference.
Response
-
inference_resultsobjectrequired -
entitiesobject -
If the model is trained for named entity recognition (NER) tasks, the response contains the recognized entities.
-
is_truncatedboolean -
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_valueoneOfnullable -
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
-
predicted_value_sequencestring -
For fill mask tasks, the response contains the input text sequence with the mask token replaced by the predicted value. Additionally