2.3 Oracle Machine Learning Modeling, Transformations, and Convenience Functions

You can access PL/SQL interface to perform data modeling, transformations, and predictive analytics.

The following table displays the PL/SQL packages for Oracle Machine Learning. In Oracle Database releases prior to Release 21c, Oracle Machine Learning was named Oracle Data Mining.

Table 2-2 Oracle Machine Learning PL/SQL Packages

Package Name Description


Routines for creating and managing machine learning models


Routines for transforming the data for machine learning


Routines that perform predictive analytics


The DBMS_DATA_MINING package contains routines for creating machine learning models, for performing operations on the models, and for querying them.

The package includes routines for:

  • Creating, dropping, and performing other DDL operations on machine learning models

  • Obtaining detailed information about model attributes, rules, and other information internal to the model (model details)

  • Computing test metrics for classification models

  • Specifying costs for classification models

  • Exporting and importing models

  • Building models using Oracle Machine Learning native algorithms as well as algorithms written in R


The DBMS_DATA_MINING_TRANSFORM package contains routines that perform data transformations such as binning, normalization, and outlier treatment.

The package includes routines for:

  • Specifying transformations in a format that can be embedded in a machine learning model.

  • Specifying transformations as relational views (external to machine learning model objects).

  • Specifying distinct properties for columns in the build data. For example, you can specify that the column must be interpreted as unstructured text, or that the column must be excluded from Automatic Data Preparation. Transformation Methods in DBMS_DATA_MINING_TRANSFORM

Summarizes the methods for transforming data in DBMS_DATA_MINING_TRANSFORM package.

Table 2-3 DBMS_DATA_MINING_TRANSFORM Transformation Methods

Transformation Method Description

XFORM interface

CREATE, INSERT, and XFORM routines specify transformations in external views

STACK interface

CREATE, INSERT, and XFORM routines specify transformations for embedding in a model


Specifies transformations for embedding in a model

The statements in the following example create a Support Vector Machine (SVM) classification model called T_SVM_Clas_sample with an embedded transformation that causes the comments attribute to be treated as unstructured text data. The T_SVM_CLAS_SAMPLE model is created by oml4sql-classification-text-mining-svm.sql example.

Example 2-7 Sample Embedded Transformation

  xformlist dbms_data_mining_transform.TRANSFORM_LIST;
    xformlist, 'comments', null, 'comments', null, 'TEXT');
    model_name          => 'T_SVM_Clas_sample',
    mining_function     => dbms_data_mining.classification,
    data_table_name     => 'mining_build_text',
    case_id_column_name => 'cust_id',
    target_column_name  => 'affinity_card',
    settings_table_name => 't_svmc_sample_settings',
    xform_list => xformlist);


The DBMS_PREDICTIVE_ANALYTICS package contains routines that perform an automated form of machine learning known as predictive analytics. With predictive analytics, you do not need to be aware of model building or scoring. All machine learning activities are handled internally by the procedure.

The DBMS_PREDICTIVE_ANALYTICS package includes these routines:

  • EXPLAIN ranks attributes in order of influence in explaining a target column.

  • PREDICT predicts the value of a target column based on values in the input data.

  • PROFILE generates rules that describe the cases from the input data.

The EXPLAIN statement in the following example lists attributes in the view mining_data_build_v in order of their importance in predicting affinity_card.

Example 2-8 Sample EXPLAIN Statement

        data_table_name      => 'mining_data_build_v', 
        explain_column_name  => 'affinity_card', 
        result_table_name    => 'explain_results');