Supported SQL Scoring Functions

Supported scoring functions for in-database scoring of machine learning models imported in the ONNX format are listed.

Machine Learning Technique Operator Supported Return Type
Embedding VECTOR_EMBEDDING always VECTOR(<dimensions , FLOAT32>)

The number of dimensions of the output vector of a VECTOR_EMBEDDING operator is defined by the embedding models.

Regression PREDICTION always Data type of the target. For regression, the data type is converted to BINARY_DOUBLE SQL type.
Classification PREDICTION always Data type of the target.
Classification PREDICTION_PROBABILITY always BINARY_DOUBLE
Classification PREDICTION_SET always Set of ( t, NUMBER , BINARY_DOUBLE ) where t is the data type of the target.
Clustering CLUSTER_ID

only if clusteringProbOutput is specified

NUMBER
Clustering CLUSTER_PROBABILITY only if clusteringProbOutput is specified BINARY_DOUBLE
Clustering CLUSTER_SET only if clusteringProbOutput is specified Set of ( NUMBER, BINARY_DOUBLE )
Clustering CLUSTER_DISTANCE only if clusteringDistanceOutput is specified BINARY_DOUBLE

Note:

You can define the outputs explicitly in the metadata or implicitly.

  • The metadata must explicitly specify how to find the result in the model output for some SQL scoring functions. For example, CLUSTER_PROBABILITY is supported only if clusteringProbOutput is specified in the metadata.

  • The system automatically assumes the output for a model with only one output if you don't specify it in the metadata.

  • If a scoring function does not comply according to the description provided, you will receive an ORA-40290 error when performing the scoring operation on your data. Additionally, any unsupported scoring functions will raise the ORA-40290 error.

To learn more about classification data types that are returned, see labels and classificationLabelOutput in JSON Metadata Parameters for ONNX Models.

Cost Matrix Clause

Specify a cost matrix directly within the PREDICTION and PREDICTION_SET scoring functions. To learn more about Cost Matrix, see Oracle Machine Learning for SQL Concepts.