Skip Headers
Oracle® Database SQL Language Reference
11g Release 2 (11.2)

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

Go to previous page
Previous
Go to next page
Next
View PDF

PREDICTION

Syntax

Description of prediction.gif follows
Description of the illustration prediction.gif

cost_matrix_clause::=

Description of cost_matrix_clause.gif follows
Description of the illustration cost_matrix_clause.gif

mining_attribute_clause::=

Description of mining_attribute_clause.gif follows
Description of the illustration mining_attribute_clause.gif

Purpose

This function is for use with models created by the DBMS_DATA_MINING package or with the Oracle Data Mining Java API. It returns the best prediction for the model. The data type returned depends on the target value type used during the build of the model. For regression models, this function returns the expected value.

cost_matrix_clause  The COST clause is relevant for all classification models.

If you omit the cost_matrix_clause clause, then the best prediction is the target class with the highest probability. If two or more classes are tied with the highest probability, the database chooses one class.

mining_attribute_clause This maps the predictors that were provided when the model was built. Specifying USING * maps to all to the columns and expressions that can be retrieved from the underlying inputs (tables, views, and so on).

See Also:

Example

The following example returns by gender the average age of customers who are likely to use an affinity card. The PREDICTION function takes into account only the cust_marital_status, education, and household_size predictors.

This example, and the prerequisite data mining operations, including the creation of the view, can be found in the demo file $ORACLE_HOME/rdbms/demo/dmdtdemo.sql. General information on data mining demo files is available in Oracle Data Mining Administrator's Guide. The example is presented here to illustrate the syntactic use of the function.

SELECT cust_gender, COUNT(*) AS cnt, ROUND(AVG(age)) AS avg_age
   FROM mining_data_apply_v
   WHERE PREDICTION(DT_SH_Clas_sample COST MODEL
      USING cust_marital_status, education, household_size) = 1
   GROUP BY cust_gender
   ORDER BY cust_gender;

C        CNT    AVG_AGE
- ---------- ----------
F        170         38
M        685         42