This tutorial covers the use of Oracle Data Miner to perform data mining against Oracle Database 11g Release 2. In this lesson, you examine and solve a data mining business problem by using the Oracle Data Miner graphical user interface (GUI). The Oracle Data Miner GUI is included as an extension of Oracle SQL Developer, version 3.0.
Oracle SQL Developer is a free graphical tool for database development. With SQL Developer, you can browse database objects, run SQL statements and SQL scripts, and edit and debug PL/SQL statements. Starting with SQL Developer, version 3.0, you can also access the Oracle Data Miner GUI, which provides a tightly integrated interface to Oracle Data Mining features.
Approximately 30 mins.
Data mining is the process of extracting useful information from masses of data by extracting patterns and trends from the data. Data mining can be used to solve many kinds of business problems, including:
The phases of solving a business problem using Oracle Data Mining are as follows:
Problem Definition and Business Goals
When performing data mining, the business problem must be well-defined and stated in terms of data mining functionality. For example, retail businesses, telephone companies, financial institutions, and other types of enterprises are interested in customer “churn” – that is, the act of a previously loyal customer in switching to a rival vendor.
The statement “I want to use data mining to solve my churn problem” is much too vague. From a business point of view, the reality is that it is much more difficult and costly to try to win a defected customer back than to prevent a disaffected customer from leaving; furthermore, you may not be interested in retaining a low-value customer. Thus, from a data mining point of view, the problem is to predict which customers are likely to churn with high probability, and also to predict which of those are potentially high-value customers.
Data Acquisition and Preparation
A general rule of thumb in data mining is to gather as much information as possible about each individual, then let the data mining operations indicate any filtering of the data that might be beneficial. In particular, you should not eliminate some attribute because you think that it might not be important – let ODM’s algorithms make that decision. Moreover, since the goal is to build a profile of behavior that can be applied to any individual, you should eliminate specific identifiers such as name, street address, telephone number, etc. (however, attributes that indicate a general location without identifying a specific individual, such as Postal Code, may be helpful.)
It is generally agreed that the data gathering and preparation phase consumes more than 50% of the time and effort of a data mining project.
Building and Evaluation of Models
The Workflow creation process of Oracle Data Miner automates many of the difficult tasks during the building and testing of models. It’s difficult to know in advance which algorithms will best solve the business problem, so normally several models are created and tested.
No model is perfect, and the search for the best predictive model is not necessarily a question of determining the model with the highest accuracy, but rather a question of determining the types of errors that are tolerable in view of the business goals.
Deployment
Oracle Data Mining produces actionable results, but the results are not useful unless they can be placed into the correct hands quickly. The Oracle Data Miner user interface provides several options for publishing the results.
This lesson focuses on a business problem that can be solved by applying Classification models. In our scenario, ABC Company wants to identify customers who are most likely to purchase insurance.
Note: For the purposes of this tutorial, the "Data and Acquisition" phase has already been completed, and the sample data set contains all required data fields. Therefore, this lesson focuses primarliy on the "Building and Evaluation of Models" phase.
Before starting this tutorial, you should:
1. |
Have access to or have Installed Oracle Database 11g Enterprise Edition, Release 2 (11.2.0.1) with Data Mining Option.
|
---|---|
2. |
Have access to or have installed Oracle SQL Developer, version 3.0, or later. Note: SQL Developer does not have an installer. To install SQL Developer, just unzip the free SQL Developer download to any directory on your PC.
|
3 . |
Have set up Oracle Data Miner 11g Release 2 for use within Oracle SQL Developer. Note: If you have not already set up Oracle Data Miner, complete the following lesson: Setting Up Oracle Data Miner 11g Release 2.
|
Before you create a Data Miner Project and build a Data Miner workflow, it is helpful to examine some of the Data Miner interface components within SQL Developer. You can then structure your working environment to provide simplified access to the necesary Data Miner features.
Identifying SQL Developer and Data Miner Interface Components
After setting up Oracle Data Miner for use within SQL Developer, different interface elements may be displayed, including both SQL Developer and Data Miner components.
In the following example, several display elements are open, including the:
Notes:
In order to simplify the interface for Data Mining development, you can dismiss the SQL Developer specific interface elements by clicking on the respective Close [x] icons for each tab or window.
For example, close both of the SQL Developer tabs mentioned above:
1.
2.
Now, the SQL Developer interface should look like this:
Before creating your first project, ensure that the Workflow Jobs tab is also open. To do this, select View > Data Miner > Workflow Jobs.
Note: You can re-open the SQL Developer Connections tab (and other interface elements) at any time by using the View menu.
Create a Data Miner Project
Before you begin working on a Data Miner Workflow, you must create a Data Miner Project, which serves as a container for one or more Workflows.
In the tutorial Setting Up Oracle Data Miner 11g Release 2, you learned how to create a database account and SQL Developer connection for a data mining user named dmuser. This user has access to the sample data that you will be mining.
Note: If you have not yet set up Oracle Data Miner, or have not created the data mining user, you must first complete the tasks presented in the tutorial Setting Up Oracle Data Miner 11g Release 2,
To create a Data Miner Project, perform the following steps:
1. |
In the Data Miner tab, right-click the data mining user connection that you previously created, and select New Project, as shown here:
|
---|---|
2. |
In the Create Project window, enter a project name (in this example ABC Insurance) and then click OK. Note: You may optionally enter a comment that describes the intentions for this project. This description can be modified at any time. Result: The new project appears below the data mining user connection node.
|
A Data Miner Workflow is a collection of connected nodes that describe a data mining processes.
A workflow:
What Does a Data Miner Workflow Contain?
Visually, the workflow window serves as a canvas on which you build the graphical representation of a data mining process flow, like the one shown here:
Notes:
As you will learn, any node may be added to a workflow by simply dragging and dropping it onto the workflow area. Each node contains a set of default properties. You modify the properties as desired until you are ready to move onto the next step in the process.
Sample Data Mining Scenario
In this topic, you will create a data mining process that predicts which existing customers are most likely to purchase insurance.
To accomplish this goal, you build a workflow that enables you to:
To create the workflow for this process, perform the following steps.
1. |
Right-click your project (ABC Insurance) and select New Workflow from the menu. Result: The Create Workflow window appears.
|
---|---|
2. |
In the Create Workflow window, enter Targeting Best Customers as the name and click OK. Result:
|
3. |
The first element of any workflow is the source data. Here, you add a Data Source node to the workflow, and select the CUST_INSUR_LTV_SAMPLE table as the data source. A. In the Component Palette, click the Data category. A list of data nodes appear, as shown here: B. Drag and drop the Data Source node onto the Workflow pane. Result: A Data Source node appears in the Workflow pane and the Define Data Source wizard opens. Notes:
|
4 . |
In Step 1 of the wizard: A. Select CUST_INSUR_LTV_SAMPLE from the Available Tables/Views list, as shown here: Note: You may use the two tabs in the bottom pane in the wizard to view and examine the selected table. The Columns tab displays information about the table structure, and the Data tab shows a subset of data from the selected table or view. B. Click Next to continue.
|
5 . |
In Step 2 of the wizard, you may remove individual columns that you don't need in your data source. In our case, we'll keep all of the attributes that are defined in the table. At the bottom of the wizard window, click Finish. Result: As shown below, the data source node name is updated with the selected table name, and the properties associated with the node are displayed in the Property Inspector, located below the Component Palette pane. Notes:
|
You can use an Explore Data node to examine the source data. Although this is an optional step, Oracle Data Miner provides this tool to enable you to verify if the selected data meets the criteria to solve the stated business problem.
Follow these steps:
|
As stated in the Overview section of this tutorial, classification models are used to predict individual behavior. In this scenario, you want to predict which customers are most likely to buy insurance. Therefore, you will specify a classification model.
By default, Oracle Data Miner selects all of the supported algorithms for a Classification model. Here, you define a Classification node that uses all algorithms for the model. In the following topic, you will run and examine each of the models.
To create the default Classification models, follow these steps:
1. |
A. First, click on Models in the Component Palette to display the available list: B. Then, drag the Classification node from the paleltte to the Workflow pane, like this: C. Drop the node onto the workflow. After a moment, a "Class Build" node appears in the workflow: Notes:
|
---|---|
2. |
First, connect the data source node to the classification build node using the same technique described previously. Result: the Edit Classification window appears. Notes:
|
3 . |
In the Edit Classification window: A. Select BUY_INSURANCE as the Target attribute. B. Select CUSTOMER_ID as the Case Id attribute. Notes:
|
4 . |
Optionally, you can modify specific settings for each of the algorithms by using the Advanced button. A. Click Advanced at the bottom of the Edit Classification window to display the Advanced Settings window, as shown here: Notes:
B. Select the Support Vector Machine algorithm and click the Algorithm Settings tab. C. Then, In the Kernel Function option, select Linear, as shown here: Note: We want to change the value of this Support Vector Machine (SVM) algorithm setting from the system determined value to Linear in order to make the model results easier to interpret. D. Feel free to view any of the tabs for each algorithm, however do not modify any of the other default settings. E. When you are done browsing, click OK to save the SVM algorithm setting and close the Advanced Settings window.
|
5 . |
Finally, click OK in the Edit Classification window to save your changes. Result: The classification build node is ready to run. Note: In the Models tab of the Properties Inspector, you can see the current status for each of the selected algorithms, as shown below:
|
6 . |
Save the workflow by clicking the Save All icon in main toolbar.
|
In this topic, you build the selected models against the source data. This operation is also called “training” a model, and the model is said to “learn” from the training data.
A common data mining practice is to build (or train) your model against part of the source data, and then to test the model against the remaining portion of your data. By default, Oracle Data Miner this approach.
Before building the models, select Class Build node and choose the Test tab in the Property Inspector. Then, change the split to 50, as shown here:
With this setting, Oracle Data Miner will split the build data in a 50/50 fashion.
To build the models, run the Classification Build node.
1 . |
Right-click the classification build node and select Run from the pop-up menu. Notes:
When the build is complete, the status column displays a green check mark. In the workflow pane, the border of the build node changes from a green gear turning to a green check mark, like this:
|
---|---|
2 . |
Once the build process is complete, you can view several pieces of information about the build using the property inspectory. A. Select the classification build node in the workflow, and then choose the Models tab in the Property Inspector. Notes:
|
After you build/train the selected models, you can view and evaluate the results for all of the models in a comparative format. Here, you compare the relative results of all four classification models.
Follow these steps:
1 . |
Right-click the classification build node and select Compare Test Results from the menu. Results: A Class Build display tab opens, showing a graphical comparison of the four models, as shown here: Notes:
|
---|---|
2 . |
Select the Lift tab. Notes:
Using this example:
|
3 . |
Next, select the Performance Matrix tab. Note: The Performance Matrix shows that the GLM and DT models have a higher Correct Prediction percentage than the other models, at over 80% each.
|
4 . |
Compare the details for the GLM and DT models. First, select the GLM model to view the Target Value Details for this model. Recall that the "Target Value" for each of the models is the BUY_INSURANCE attribute. Note: The GLM model indicates a 92.6% correct prediction outcome for customers that don't buy insurance, but only a 47.3% correct prediction outcome for customers that do buy insurance. Next, select the DT model. Notes: The DT model indicates an 82.5% correct prediction outcome for customers that don't buy insurance, and an 80.2% correct prediction outcome for customers that do buy insurance.
|
5 . |
After considering the initial analysis, you decide to investigate the Decision Tree model more closely. First, dismiss the Class Build - Compare Models tab, as shown here:
|
Using the analysis performed in the past topic, the Decision Tree model is selected for further analysis.
Follow these steps to examine the Decision Tree model.
1 . |
Back in the workflow canvas, right-click the Class Build node again, and select View Models > CLAS_DT_2_2 (Note: The exact name of your Decision Tree model may be different). Result: A window opens that displays a graphical presentation of the Decision Tree.
|
---|---|
2 . |
The interface provides several methods of viewing navigation:
For example, set the the primary viewer window for the decision tree to 100% zoom. This provides a more narrow view than 75%, but the content within the view is somewhat larger.
|
3 . |
First, navigate to and select Node 2 and click on it to select it. Notes:
Notes:
|
4 . |
Next, select Node 6, at the bottom level in the tree. Notes:
|
5 . |
Dismiss the Decision Tree display tab as shown here:
|
In this topic, you apply the Decision Tree model and then create a table to display the results. You "apply" a model in order to make predictions - in this case to predict which customers are likely to buy insurance.
To apply a model, you perform the following steps:
Follow these steps to apply the model and display the results:
1. |
In the workflow, select the Class Build node. Then, using the Models tab of the Property Inspector, deselect all of the models except for the DT model. To deselect a model, click the large green arrow in the model's Output column. This action adds a small red "x" to the column, indicating that the model will not be used in the next build. When you finish, the Models tab of the Property Inspector should look like this: Note: Now, only the DT model will be passed to subsequent nodes.
|
---|---|
2. |
Next, create a new Data Source node in the workflow. Note: Even though we are using the same table as the "Apply" data source, you must still add a second data source node to the workflow. A. From the Data list in the Component Palette, drag and drop the Data Source node to the workflow canvas, like this: B. In the Define Data Source wizard, select the CUST_INSUR_LTV_SAMPLE table, and then click FINISH. Result: A new data souce node appears on the workflow canvas. C. Select the new data source node, and using the Details tab of the Property Inspector, change the Node Name to CUST_INSUR_LTV_APPLY, like this: Result: The new table name is reflected in the workflow.
|
3 . |
Next, open the Evaluate and Apply list in the Components Palette, like this:
|
4 . |
A. Drag and drop the Apply node to the workflow canvas, like this: Result: An Apply node is added to the workflow with a yellow exclamation mark in its border. This, of course, indicates that more information is required before this node may be run. B. Using the Details tab of the Property Inspectory, rename the Apply node to Apply Model.
|
5 . |
Using the techniques described previously, connect the Class Build node to the Apply Model node, like this:
|
6 . |
Then, connect the CUST_INSUR_LTV_APPLY node to the Apply Model node: Notes:
|
7 . |
Before you execute the apply model node, consider the resulting output. By default, an apply node creates two columns of information for each customer:
However, you really want to know this information for each customer, so that you can readily associate the preditive information with a given customer. To get this information, you need to add a third column to the apply output: CUSTOMER_ID. Follow these instructions to add the customer id to the output: A. Right-click the APPLY MODEL node and select Edit. Result: The Edit Apply Details window appears. Notice that the Prediction and Probability columns are defined automatically in the Apply Columns tab. B. In the Edit Apply Details window, select the Data Columns tab, and then click the green "+" sign, like this: C.In the Edit Output Data Column Dialog:
Result: the CUSTOMER_ID column is added to the Data Columns tab. D. Finally, click OK in the Edit Apply Details window to save the change.
|
8 . |
Now, you are ready to execute the Apply node. Right-click the Apply Model node and select Run from the menu. Result:
|
9 . |
Optionally, you can create a database table to store the model prediction results (the "Apply" results). The table may be used for any number of reasons. For example, an application could read the predictions from that table, and suggest an appropriate response, like sending the customer a letter, offering the customer a discount, or some other appropriate action. To create a table of model prediction results, perform the following: A. Using the Data list in the Component Palette, drag the Create Table or View node to the workflow canvas, like this: Result: an OUTPUT node is created. B. Connect the Apply Model node to the OUTPUT node. C. Specify a name for the table that will be created (otherwise, Data Miner will create a default name):
D. Lastly, right-click the DT_PREDICTIONS node and select Run from the menu. Result: When the process is complete, the workflow document is automatically saved, and all nodes contain a green check mark in the border, like this: Note: After you run the OUTPUT node (DT_PREDICTIONS), the table is created in your schema.
|
10 . |
A. To view the results, right-click the DT_PREDICTIONS Table node and select View Data from the Menu. Result: A new tab opens with the contents of the table. Notes:
B. Click Apply Sort to view the results: Notes:
C. When you are done viewing the results, dismiss the tab for the DT_PREDICTIONS table, and click Save All.
|
In this lesson, you examined and solved a "Classification" prediction data mining business problem by using the Oracle Data Miner graphical user interface, which is included as an extension to SQL Developer, version 3.0.
In this tutorial, you have learned how to:
To learn more about Oracle Data Mining:
Curriculum Developer: Brian Pottle
Technical Contributors: Charlie Berger, Mark Kelly, Margaret Taft, Kathy Talyor
![]() |
About
Oracle |Oracle and Sun | ![]() |