Reference > Functions reference > Miscellaneous functions > ComputeModel


Returns a JSON object containing the result of the Core ML model evaluation.


For general models:ComputeModel ( modelName ; parameterName1 ; value1 )

For vision models:

ComputeModel ( modelName ; "image" ; value1 ; "threshold" ; returnAtLeastOne )


modelName - the name of the model to evaluate. This value must match the name of a previously loaded model.

parameterName1 - the name of an input parameter as defined by the model’s designer. You must know the name of each of these parameters before using the model.

value1 - the value of a model input parameter.

image (vision models only) - the type of data the model will evaluate.

threshold (vision models only) (optional) - a value used that limits the number of results returned by vision models by excluding results that are less than the specified value. This value must be between 0.0 and 1.0.

returnAtLeastOne (vision models only) - a true (non-zero) or false (zero) value. If all results are excluded by the value of threshold and:

if returnAtLeastOne is true, the result with the highest confidence is returned

if returnAtLeastOne is false or not specified, an empty string is returned

Data type returned 


Originated in version 



The object returned is either an array of name-value pairs or a single name-value pair, depending on the definition of the model that’s evaluated.


A Core ML model must be loaded first with the Configure Machine Learning Model script step before ComputeModel can be used.

An input parameter must be followed by its respective value, and multiple input parameter-value pairs can be used.

If a result contains two matches with the same confidence, only the first value is returned.

Example 1 

Assuming that a model named MobileNet has been loaded and a container field named myImageField is on the current layout (or otherwise available to the calculation):

ComputeModel ( "MobileNet"; "image"; myImageField )


evauluates the image in myImageField using the given model and returns the following JSON string:


[{"classification":"grand piano, grand","confidence":0.9980730414390564},

{"classification":"upright, upright piano","confidence":0.0019267344614490867},

{"classification":"pool table, billiard table, snooker table","confidence":8.3467860179098352e-08},

{"classification":"dining table, board","confidence":2.6059957747293083e-08},

lines omitted for brevity

{{"classification":"puffer, pufferfish, blowfish, globefish","confidence":5.1951665669627816e-18}]

Example 2 

Using the same model, container field, and image from Example 1, the following calculation:


ComputeModel("MobileNet"; "image"; myImageField; "threshold"; 1.0; "returnAtLeastOne"; 1)


returns the JSON string:


[{"classification":"grand piano, grand","confidence":0.9980730414390564}]


Passing threshold a value of 1.0 excludes all the results. But because returnAtLeastOne is set to a non-zero value, the result with the highest confidence is returned.

Related topics 

Configure Machine Learning Model script step

Functions reference (category list)

Functions reference (alphabetical list)

About functions

About formulas