Quick Search:
 Oracle PL/SQL: PREDICTION Jump to:  
Category: >> Oracle PL/SQL >> PREDICTION  

<< lastnext >>

Snippet Name: PREDICTION

Description: PREDICTION 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.

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).

If you specify more predictors in the mining_attribute_clause than there are predictors used by the model, then the extra expressions are silently ignored.

If you specify fewer predictors than are used during the build, then the operation proceeds with the subset of predictors you specify and returns information on a best-effort basis. All types of models will return a result regardless of the number of predictors you specify in this clause.

If you specify a predictor with the same name as was used during the build but a different datatype, then the database implicitly converts to produce a predictor value of the same type as the original build.

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 can be found in the demo file $ORACLE_HOME/rdbms/demo/dmdtdemo.sql.

Also see:

Comment: (none)

Language: PL/SQL
Highlight Mode: PLSQL
Last Modified: March 07th, 2009

PREDICTION(<schema.model>, <cost_matrix_clause>
SELECT cust_gender, COUNT(*) AS cnt, ROUND(AVG(age)) AS avg_age
   FROM mining_data_apply_v
      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

   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org