Skip Headers
Oracle® Database SQL Reference
10g Release 2 (10.2)

Part Number B14200-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
Feedback

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 datatype returned depends on the target value type used during the build of the model. For regression models, this function returns the expected value.

COST MODEL Specify COST MODEL to indicate that the scoring should be performed by taking into account the cost matrix that was associated with the model at build time. If no such cost matrix exists, then the database returns an error. The COST MODEL clause is relevant only for decision tree classification models.

If you omit the COST MODEL clause, 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