Skip Headers
Oracle® Data Mining Concepts
11g Release 1 (11.1)

Part Number B28129-01
Go to Documentation Home
Go to Book List
Book List
Go to Table of Contents
Go to Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Go to next page
View PDF

2 Introducing Oracle Data Mining

This chapter introduces the basics you will need to start using Oracle Data Mining.

This chapter includes the following sections:

Data Mining in the Database Kernel

Oracle Data Mining provides comprehensive, state-of-the-art data mining functionality within Oracle Database.

Oracle Data Mining is implemented in the Oracle Database kernel, and mining models are first class database objects. Oracle Data Mining processes use built-in features of Oracle Database to maximize scalability and make efficient use of system resources.

Data mining within Oracle Database offers many advantages:

See Also:

"Oracle Data Mining and Oracle Database Analytics" for a summary of additional analytics available within Oracle Database

Data Mining Functions

A basic understanding of data mining functions and algorithms is required for using Oracle Data Mining. This section introduces the concept of data mining functions. Algorithms are introduced in the following section, "Data Mining Algorithms".

Each data mining function specifies a class of problems that can be modeled and solved. Data mining functions fall generally into two categories: supervised and unsupervised. Notions of supervised and unsupervised learning are derived from the science of machine learning, which has been called a sub-area of artificial intelligence.

Artificial intelligence refers to the implementation and study of systems that exhibit autonomous intelligence or behavior of their own. Machine learning deals with techniques that enable devices to learn from their own performance and modify their own functioning. Data mining applies machine learning concepts to data.

See Also:

Part II, "Mining Functions" for more details about data mining functions

Supervised Data Mining

Supervised learning is also known as directed learning. The learning process is directed by a previously known dependent attribute or target. Directed data mining attempts to explain the behavior of the target as a function of a set of independent attributes or predictors.

Supervised learning generally results in predictive models. This is in contrast to unsupervised learning where the goal is pattern detection.

The building of a supervised model involves training, a process whereby the software analyzes many cases where the target value is already known. In the training process, the model "learns" the logic for making the prediction. For example, a model that seeks to identify the customers who are likely to respond to a promotion must be trained by analyzing the characteristics of many customers who are known to have responded or not responded to a promotion in the past.

Build Data and Test Data for Supervised Learning

Separate data sets are required for building (training) and testing a predictive model. The build data (training data) and test data must have the same column structure. Typically, one large table or view is split into two data sets: one for building the model, and the other for testing the model.

The process of applying the model to test data helps to determine whether the model, built on one chosen sample, is generalizable to other data. In particular, it helps to avoid the phenomenon of overfitting, which can occur when the logic of the model fits the build data too well and therefore has little predictive power.

Apply Data for Supervised Learning

Apply data, also called scoring data, refers to the actual population to which a model is applied. For example, you might build a model that identifies the characteristics of customers who frequently buy a certain product. To obtain a list of people who are most likely to be your best customers when you introduce a related product, you might apply the model to your customer database. In this case, the scoring data consists of your customer database.

Most supervised learning can be applied to a population of interest. Scoring is the purpose of classification and regression models. Oracle Data Mining does not support the scoring process for attribute importance models. Models of this type are built on a population of interest to obtain information about that population; they cannot be applied to separate data. An attribute importance model returns and ranks the attributes that are most important in predicting a target value.

Unsupervised Data Mining

Unsupervised learning is non-directed. There is no distinction between dependent and independent attributes. There is no previously-known result to guide the algorithm in building the model.

Unsupervised learning can be used for descriptive purposes. For example, a clustering model that seeks to divide a customer base into segments based on similarities in age, gender, and spending habits uses descriptive data mining techniques. However, unsupervised learning does not imply descriptive models. Unsupervised models can also be used to make predictions.

Build Data for Unsupervised Learning

An unsupervised model returns information about the build data. A clustering model divides the data into clusters. A feature extraction model derives features from the build data. An association model returns rules about associations between items in the data. An anomaly detection model finds rare or unusual items in the data.

Apply Data for Unsupervised Learning

Although unsupervised data mining does not specify a target, unsupervised models can be applied to a population of interest. For example, clustering models can be applied to classify cases according to their cluster assignments, and anomaly detection models can be applied to rank outliers. Anomaly detection, although unsupervised, is typically used to predict whether a data point is typical among a set of cases.

Most unsupervised learning can be applied to a population of interest. Oracle Data Mining supports the scoring operation for clustering and feature extraction models. Oracle Data Mining does not support the scoring operation for association models. Models of this type are built on a population of interest to obtain information about that population; they cannot be applied to separate data. An association model returns rules that explain how items or events are associated with each other. The association rules are returned with statistics that can be used to rank them according to their probability.

Oracle Data Mining Functions

Oracle Data Mining supports the supervised data mining functions described in Table 2-1.

Table 2-1 Oracle Data Mining Supervised Functions

Function Description Sample Problem

Attribute Importance

Identifies the attributes that are most important in predicting a target attribute

Given customer response to an affinity card program, find the most significant predictors


Assigns items to discrete classes and predicts the class to which an item belongs

Given demographic data about a set of customers, predict customer response to an affinity card program


Approximates and forecasts continuous values

Given demographic and purchasing data about a set of customers, predict customers' age

Oracle Data Mining supports the unsupervised functions described in Table 2-2.

Table 2-2 Oracle Data Mining Unsupervised Functions

Function Description Sample Problem

Anomaly Detection (implemented through one-class classification)

Identifies items (outliers) that do not satisfy the characteristics of "normal" data

Given demographic data about a set of customers, identify customer purchasing behavior that is significantly different from the norm

Association Rules

Finds items that tend to co-occur in the data and specifies the rules that govern their co-occurrence

Find the items that tend to be purchased together and specify their relationship


Finds natural groupings in the data

Segment demographic data into clusters and rank the probability that an individual will belong to a given cluster

Feature Extraction

Creates new attributes (features) using linear combinations of the original attribute

Given demographic data about a set of customers, group the attributes into general characteristics of the customers

Data Mining Algorithms

An algorithm is a mathematical procedure for solving a specific kind of problem. Oracle Data Mining supports at least one algorithm for each data mining function. For some functions, you can choose among several algorithms. For example, Oracle Data Mining supports four classification algorithms.

Each data mining model is produced by a specific algorithm. Some data mining problems can best be solved by using more than one algorithm. This necessitates the development of more than one model. For example, you might first use a feature extraction model to create an optimized set of predictors, then a classification model to make a prediction on the results.


You can be successful at data mining without understanding the inner workings of each algorithm. However, it is important to understand the general characteristics of the algorithms and their suitability for different kinds of applications.

See Also:

Part III, "Algorithms" for more details about the algorithms supported by Oracle Data Mining.

Oracle Data Mining Supervised Algorithms

Oracle Data Mining supports the supervised data mining algorithms described in Table 2-3. The algorithm abbreviations are used throughout this manual.

Table 2-3 Oracle Data Mining Algorithms for Supervised Functions

Algorithm Function Description

Decision Tree (DT)


Decision trees extract predictive information in the form of human-understandable rules. The rules are if-then-else expressions; they explain the decisions that lead to the prediction.

Generalized Linear Models (GLM)

Classification and Regression

GLM implements logistic regression for classification of binary targets and linear regression for continuous targets. GLM classification supports confidence bounds for prediction probabilities. GLM regression supports confidence bounds for predictions.

Minimum Description Length (MDL)

Attribute Importance

MDL is an information theoretic model selection principle. MDL assumes that the simplest, most compact representation of data is the best and most probable explanation of the data.

Naive Bayes (NB)


Naive Bayes makes predictions using Bayes' Theorem, which derives the probability of a prediction from the underlying evidence, as observed in the data.

Support Vector Machines (SVM)

Classification and Regression

Distinct versions of SVM use different kernel functions to handle different types of data sets. Linear and Gaussian (nonlinear) kernels are supported.

SVM classification attempts to separate the target classes with the widest possible margin.

SVM regression tries to find a continuous function such that the maximum number of data points lie within an epsilon-wide tube around it.

Oracle Data Mining Unsupervised Algorithms

Oracle Data Mining supports the unsupervised data mining algorithms described in Table 2-4. The algorithm abbreviations are used throughout this manual.

Table 2-4 Oracle Data Mining Algorithms for Unsupervised Functions

Algorithm Function Description

Apriori (AP)


Apriori performs market basket analysis by discovering co-occurring items (frequent itemsets) within a set. Apriori finds rules with support greater than a specified minimum support and confidence greater than a specified minimum confidence.

k-Means (KM)


k-Means is a distance-based clustering algorithm that partitions the data into a predetermined number of clusters. Each cluster has a centroid (center of gravity). Cases (individuals within the population) that are in a cluster are close to the centroid.

Oracle Data Mining supports an enhanced version of k-Means. It goes beyond the classical implementation by defining a hierarchical parent-child relationship of clusters.

Non-Negative Matrix Factorization (NMF)

Feature Extraction

NMF generates new attributes using linear combinations of the original attributes. The coefficients of the linear combinations are non-negative. During model apply, an NMF model maps the original data into the new set of attributes (features) discovered by the model.

One Class Support Vector Machine (One- Class SVM)

One class classification (Anomaly Detection)

One-class SVM builds a profile of one class and when applied, flags cases that are somehow different from that profile. This allows for the detection of rare cases that are not necessarily related to each other.

Orthogonal Partitioning Clustering (O-Cluster or OC)


O-Cluster creates a hierarchical, grid-based clustering model. The algorithm creates clusters that define dense areas in the attribute space. A sensitivity parameter defines the baseline density level.

Data Preparation

Data for mining must exist within a single table or view. The information for each case (record) must be stored in a separate row.

A unique capability of Oracle Data Mining is its support for dimensioned data (for example, star schemas) through nested table transformations. Additionally, Oracle Data Mining can mine unstructured data.


Oracle Data Mining Application Developer's Guide to learn how to construct a table or view for data mining

Proper preparation of the data is a key factor in any data mining project. The data must be properly cleansed to eliminate inconsistencies and support the needs of the mining application. Additionally, most algorithms require some form of data transformation, such as binning or normalization.

The data mining development process may require several data sets. One data set is needed for building (training) the model; a separate data set may be used for scoring. Classification models should also have a test data set. Each of these data sets must be prepared in exactly the same way.


Oracle Data Mining supports automatic and embedded data transformation, which can significantly reduce the time and effort involved in developing a data mining model. In Automatic Data Preparation (ADP) mode, the model itself transforms the build data according to the requirements of the algorithm. The transformation instructions are embedded in the model and reused whenever the model is applied.

You can choose to add your own transformations to those performed automatically by Oracle Data Mining. These are embedded along with the automatic transformation instructions and reused with them whenever the model is applied. In this case, you only have to specify your transformations once — for the build data. The model itself will transform the data appropriately when it is applied.

Mining models are known as supermodels, because they contain the instructions for their own data preparation.

How Do I Use Oracle Data Mining?

Oracle Data Mining is an option to the Enterprise Edition of Oracle Database. It includes programmatic interfaces for SQL and Java and a spreadsheet add-in.

PL/SQL Packages

The Oracle Data Mining PL/SQL API is implemented in the following PL/SQL packages:

  • DBMS_DATA_MINING — Contains routines for building, testing, and applying data mining models.

  • DBMS_DATA_MINING_TRANSFORM — Contains routines for transforming the data sets prior to building or applying a model. Users are free to use these routines or any other SQL-based method for defining transformations. The routines in DBMS_DATA_MINING_TRANSFORM are simply provided as a convenience.

    Note that user-defined transformations are not required. Most transformations can be performed automatically by Oracle Data Mining.

  • DBMS_PREDICTIVE_ANALYTICS — Contains automated data mining routines for PREDICT, EXPLAIN, and PROFILE.

The following example shows the PL/SQL routine for creating an SVM classification model called my_model. The algorithm is specified in a settings table called my_settings. The algorithm must be specified as a setting because Naive Bayes, not SVM, is the default classifier.

CREATE TABLE my_settings(
  setting_name  VARCHAR2(30),
  setting_value VARCHAR2(4000));

    INSERT INTO my_settings VALUES

    model_name          => 'my_model',
    mining_function     => dbms_data_mining.classification,
    data_table_name     => 'build_data',
    case_id_column_name => 'cust_id',
    target_column_name  => 'affinity_card',
    settings_table_name => 'my_settings');

SQL Functions

The Data Mining functions are SQL language operators for the deployment of data mining models. They allow data mining to be easily incorporated into SQL queries, and thus into SQL-based applications.

The following example illustrates the Data Mining PREDICTION_PROBABILITY operator. The operator applies the classification model nb_sh_clas_sample to the data set mining_data_apply_v.

SELECT cust_id, prob
  FROM (SELECT cust_id,
          PREDICTION_PROBABILITY (nb_sh_clas_sample, 1 USING *) prob
          FROM  mining_data_apply_v
          WHERE cust_id < 100011)
  ORDER BY cust_id;

The SELECT statement returns ten customers, listed by customer ID, along with the likelihood that they will accept (1) an affinity card.

---------- ----------
    100001 .025622714
    100002 .090424232
    100003 .028064789
    100004 .048458859
    100005 .989335775
    100006 .000151844
    100007  .05749942
    100008 .108750373
    100009 .538512886
    100010 .186426058

Java API

The Oracle Data Mining Java API is an Oracle implementation of the JDM standard Java API for data mining (JSR-73). The Java API is layered on the PL/SQL API, and the two APIs are fully interoperable.

The following code fragment creates a Decision Tree model that models customer affinity card response patterns and applies this model to predict new customers' affinity card responses.

//Step-1: Create connection to a database with the Data Mining option
 OraConnectionFactory m_dmeConnFactory = new OraConnectionFactory();
 ConnectionSpec connSpec = m_dmeConnFactory.getConnectionSpec();
 connSpec.setName("<user name>");
 m_dmeConn = m_dmeConnFactory.getConnection(connSpec);
//Step-2: Create object factories
 PhysicalDataSetFactory m_pdsFactory =
 PhysicalAttributeFactory m_paFactory =
 TreeSettingsFactory m_treeFactory =
 ClassificationSettingsFactory m_clasFactory =
BuildTaskFactory m_buildFactory =
ClassificationApplySettingsFactory m_applySettingsFactory =
DataSetApplyTaskFactory m_dsApplyFactory =
ClassificationApplySettingsFactory m_applySettingsFactory =
//Step-3: Create and save model build task input objects 
//        (i.e., training data, build settings)
    //Create & save model input data specification (PhysicalDataSet)
    PhysicalDataSet buildData =
      m_pdsFactory.create("MINING_DATA_BUILD_V", false);
    PhysicalAttribute pa =
      m_paFactory.create("CUST_ID", AttributeDataType.integerType,
    m_dmeConn.saveObject("treeBuildData_jdm", buildData, true);
    //Create & save Mining Function Settings
    ClassificationSettings buildSettings = m_clasFactory.create();
    TreeSettings treeAlgo = m_treeFactory.create();
    m_dmeConn.saveObject("treeBuildSettings_jdm", buildSettings, true);

//Step-4: Create and save model build task
 BuildTask buildTask =
    m_buildFactory.create("treeBuildData_jdm", "treeBuildSettings_jdm",
 m_dmeConn.saveObject("treeBuildTask_jdm", buildTask, true);
//Step-5: Create and save model apply task input objects (i.e., apply settings)
  //Create & save PhysicalDataSpecification
    PhysicalDataSet applyData =
      m_pdsFactory.create("MINING_DATA_APPLY_V", false);
    PhysicalAttribute pa =
      m_paFactory.create("CUST_ID", AttributeDataType.integerType,
    m_dmeConn.saveObject("treeApplyData_jdm", applyData, true);
    //Create & save ClassificationApplySettings
    ClassificationApplySettings clasAS = m_applySettingsFactory.create();

//Step-6: Create and save model apply task with build task as dependent
    DataSetApplyTask applyTask =
      m_dsApplyFactory.create("treeApplyData_jdm", "treeModel_jdm",
    m_dmeConn.saveObject("treeApplyTask_jdm", applyTask, true);

//Step-7: Execute build task which executes build task and then after 
//        successful completion triggers the execution of its dependent 
//        task(s). In this example, there is only one dependent task.

Oracle Spreadsheet Add-In for Predictive Analytics

Predictive Analytics automates the data mining process with routines for PREDICT, EXPLAIN, and PROFILE. The Oracle Spreadsheet Add-In for Predictive Analytics implements these routines for Microsoft Excel.You can use the Spreadsheet Add-In to analyze Excel data or data that resides in an Oracle database.

You can download the Spreadsheet Add-In, including a readme file, from the Oracle Technology Network.

Where Do I Find Information About Oracle Data Mining?

Oracle Data Mining documentation is included in the Oracle Database online documentation library. Four manuals are dedicated to Oracle Data Mining. SQL and PL/SQL syntax for Oracle Data Mining is documented in Database manuals.

For your convenience, the Oracle Data Mining and related Oracle Database manuals are listed in Table 2-5. The links in this table will take you directly to the referenced documentation.

Table 2-5 Oracle Data Mining Documentation

Document Description

Oracle Data Mining Concepts

Overview of mining functions, algorithms, data preparation, predictive analytics, and other special features supported by Oracle Data Mining

Oracle Data Mining Application Developer's Guide

How to use the PL/SQL and Java APIs and the SQL operators for Data Mining

Oracle Data Mining Administrator's Guide

How to install and administer a database for Data Mining. How to install and use the demo programs

Oracle Data Mining Java API Reference

How to use the Oracle Data Mining Java API syntax (javadoc)

Oracle Database PL/SQL Packages and Types Reference

How to use the Oracle Data Mining PL/SQL syntax

Oracle Database SQL Language Reference

How to use the SQL Data Mining function (operator) syntax

Oracle Database Reference

How to query data dictionary views to obtain information about mining models, mining model attributes, and mining model settings

Oracle Data Mining Resources on the Oracle Technology Network

The Oracle Technology Network (OTN) is easily accessible and provides a wealth of information. You can visit the Oracle Data Mining home page at:

This site provides news and discussion forums as well as tools and educational materials for download. On this site, you will find:

Oracle Data Mining Publications

The following books, available on Amazon (, provide an excellent introduction to Oracle Data Mining. Both are based on Oracle Data Mining 10.2.

  • Java Data Mining: Strategy, Standard, and Practice, (The Morgan Kaufmann Series in Data Management Systems), by Mark F. Hornick, Erik Marcadé, and Sunil Venkayala

  • Oracle Data Mining: Mining Gold from Your Warehouse, (Oracle In-Focus series), by Dr. Carolyn Hamm

Oracle Data Mining and Oracle Database Analytics

As described in "Data Mining in the Database Kernel", the advantages of database analytics are considerable. When analytical capabilities are implemented where the data is stored, the data does not have to be exported to an external server for analysis. The results of analysis do not need to be imported; they reside in the database where they can be easily accessed, refreshed, and combined with other data.

Along with data mining and predictive analytics, Oracle Database supports a wide array of analytical features. Since these features are part of a common server it is possible to combine them efficiently. The results of analytical processing can be integrated with Oracle Business Intelligence tools such as Oracle Discover and Oracle Portal. Taken as a whole, these features make the Oracle Database a powerful platform for developing analytical applications.

The possibilities for combining different analytics are virtually limitless. Example 2-1 shows data mining and text processing within a single SQL query.

Example 2-1 Combine Oracle Data Mining and Oracle Text in a SQL Query

SELECT A.cust_name, A.contact_info
  FROM customers A
            'attrite' USING A.*) > 0.8
   AND A.cust_value > 90
   AND A.cust_id IN
       (SELECT B.cust_id
          FROM call_center B
         WHERE B.call_date BETWEEN '01-Jan-2005'
                               AND '30-Jun-2005'   
         AND CONTAINS(B.notes, 'Checking Plus', 1) > 0);

The query in Example 2-1 selects all customers who have a high propensity to attrite (> 80% chance), are valuable customers (customer value rating > 90), and have had a recent conversation with customer services regarding a Checking Plus account. The propensity to attrite information is computed using a Data Mining model called tree_model. The query uses the Oracle Text CONTAINS operator to search call center notes for references to Checking Plus accounts.

Some of the analytics supported by Oracle Database are described in Table 2-6. Use the links in the Documentation column to find the referenced documentation.

Table 2-6 Overview of Analytics in Oracle Database

Analytical Feature Description Documentation

Data Mining

Oracle Data Mining implements complex algorithms that sift through large volumes of data to find hidden information. Data Mining models discover patterns, predict probable outcomes, identify key predictors, and find other kinds of valuable information

Present document

Complex data transformations

Data transformation is a key aspect of analytical applications and ETL (extract, transform, and load). You can use SQL expressions to implement data transformations, or you can use the DBMS_DATA_MINING_TRANSFORM package.

DBMS_DATA_MINING_TRANSFORM is a flexible data transformation package that includes a variety of missing value and outlier treatments, as well as binning and normalization capabilities.

Oracle Database PL/SQL Packages and Types Reference

Statistical functions

Oracle Database provides a long list of SQL statistical functions with support for: hypothesis testing (such as t-test, F-test), correlation computation (such as pearson correlation), cross-tab statistics, and descriptive statistics (such as median and mode). The DBMS_STAT_FUNCS package adds distribution fitting procedures and a summary procedure that returns descriptive statistics for a column.

Oracle Database SQL Language Reference and Oracle Database PL/SQL Packages and Types Reference

Window and analytic SQL functions

Oracle Database supports analytic and windowing functions for computing cumulative, moving, and centered aggregates. With windowing aggregate functions, you can calculate moving and cumulative versions of SUM, AVERAGE, COUNT, MAX, MIN, and many more functions.

Oracle Database Data Warehousing Guide

Frequent Itemsets

The DBMS_FREQUENT_ITEMSET supports frequent itemset counting, a mechanism for counting how often multiple events occur together. DBMS_FREQUENT_ITEMSET is used as a building block for the Association algorithm used by Oracle Data Mining.

Oracle Database PL/SQL Packages and Types Reference

Image feature extraction

Oracle Intermedia supports the extraction of image features such as color histogram, texture, and positional color. Image features can be used to characterize and analyze images.

Oracle Multimedia User's Guide

Linear algebra

The UTL_NLA package exposes a subset of the popular BLAS and LAPACK (Version 3.0) libraries for operations on vectors and matrices represented as VARRAYs. This package includes procedures to solve systems of linear equations, invert matrices, and compute eigenvalues and eigenvectors.

Oracle Database PL/SQL Packages and Types Reference


Oracle OLAP supports multidimensional analysis and can be used to improve performance of multidimensional queries. Oracle OLAP provides functionality previously found only in specialized OLAP databases. Moving beyond drill-downs and roll-ups, Oracle OLAP also supports time-series analysis, modeling, and forecasting.

Oracle OLAP User's Guide

Spatial analytics

Oracle Spatial provides advanced spatial features to support high-end GIS and LBS solutions. Oracle Spatial's analysis and mining capabilities include functions for binning, detection of regional patterns, spatial correlation, colocation mining, and spatial clustering.

Oracle Spatial also includes support for topology and network data models and analytics. The topology data model of Oracle Spatial allows one to work with data about nodes, edges, and faces in a topology. It includes network analysis functions for computing shortest path, minimum cost spanning tree, nearest-neighbors analysis, traveling salesman problem, among others.

Oracle Spatial Developer's Guide

Text Mining

Oracle Text uses standard SQL to index, search, and analyze text and documents stored in the Oracle database, in files, and on the web. It also supports automatic classification and clustering of document collections. Many of these analytical features are layered on top of ODM functionality

Oracle Text Application Developer's Guide