Predictive Analytics

The Predictive Analytics group of snippets contains these snippets:

To use a snippet, drag the snippet to SQL Worksheet or to a place in a PL/SQL program.


Note:

All of the snippets have one or more commented-out DROP statements, such as
--DROP TABLE mining_explain_result;

If you run a snippet more than once, remove the comment characters.

If you drag the Explain snippet to SQL Worksheet, you see

--Available in Oracle Enterprise DB 10.2 and later
--Ranks attributes in order of influence in explaining a target column.
--For more info go to: http://www.oracle.com/pls/db112/vbook_subject?subject=dma
--Remove comment on Drop command if you want to rerun this script
--DROP TABLE mining_explain_result;
--Perform EXPLAIN operation 
BEGIN 
    DBMS_PREDICTIVE_ANALYTICS.EXPLAIN( 
        data_table_name      => '"CUSTOMERS"', 
        explain_column_name  => '"CUST_GENDER"', 
        result_table_name    => 'mining_explain_result',
        data_schema_name => '"SH"'); 
END; 
/ 
--output first 10 rows from resulting table mining_explain_result
COLUMN ATTRIBUTE_NAME FORMAT A30
COLUMN ATTRIBUTE_SUBNAME FORMAT A30
COLUMN EXPLANATORY_VALUE FORMAT 0D999999
COLUMN RANK FORMAT 999999
select * from mining_explain_result where rownum < 10;

When you execute this code, you get these results (in Script Output)

anonymous block completed
ATTRIBUTE_NAME          ATTRIBUTE_SUBNAME              EXPLANATORY_VALUE   RANK
------------------------------ --------------------------------------------------
CUST_LAST_NAME                                         0.151359               1 
CUST_ID                                                0.015999               2 
CUST_MARITAL_STATUS                                    0.015043               3 
CUST_INCOME_LEVEL                                      0.002592               4 
CUST_CREDIT_LIMIT                                      0.000195               5 
CUST_EMAIL                                             0.000000               6 
CUST_TOTAL                                             0.000000               6 
CUST_TOTAL_ID                                          0.000000               6 
CUST_FIRST_NAME                                        0.000000               6 
 
 9 rows selected