Quick Search:
Oracle PL/SQL Code Library
Find Or Post Oracle Jobs
Oracle Discussion & Chat
 Oracle PL/SQL: PREDICTION_SET Jump to:  
Category: >> Oracle PL/SQL >> PREDICTION_SET Bookmark and Share

<< lastnext >>


Description: PREDICTION_SET is for use with classification models created using the DBMS_DATA_MINING package or with the Oracle Data Mining Java API. It is not valid with other types of models. It returns a varray of objects containing all classes in a multiclass classification scenario. The object fields are named PREDICTION, PROBABILITY, and COST. The datatype of the PREDICTION field depends on the target value type used during the build of the model. The other two fields are both Oracle NUMBER. The elements are returned in the order of best prediction to worst prediction.


For bestN, specify a positive integer to restrict the returned target classes to the N having the highest probability, or lowest cost if cost matrix clause is specified. If multiple classes are tied in the Nth value, then the database still returns only N values. If you want to filter only by cutoff, specify NULL for this parameter.

For cutoff, specify a NUMBER value to restrict the returned target classes to those with a probability greater than or equal to (or a cost less than or equal to if cost matrix clause is specified) to the specified cutoff value. You can filter solely by cutoff by specifying NULL for bestN.

When you specify values for both bestN and cutoff, you restrict the returned predictions to only those that are the bestN and have a probability (or cost when the cost_matrix_clause is specified) surpassing the threshold.

The cost_matrix_clause clause is relevant for all classification models. When you specify this clause, both bestN and cutoff are treated with respect to the prediction cost, not the prediction probability. The value of bestN restricts the result to the target classes having the N best (lowest) costs, and cutoff restricts the target classes to those with a cost less than or equal to the specified cutoff.

When you specify this clause, each object in the collection is a triplet of scalar values containing the prediction value (the datatype of which depends on the target value type used during model build), the prediction probability, and the prediction cost (both Oracle NUMBER).

If you omit this clause, then each object in the varray is a pair of scalars containing the prediction value and prediction probability.

Also see:

Comment: (none)

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

PREDICTION_SET(<schema.model>, <best N>, <cutoff>
<cost_matrix_clause> <mining_attribute_clause>)
SELECT T.cust_id, S.prediction, S.probability, S.cost
  FROM (SELECT cust_id,
               PREDICTION_SET(dt_sh_clas_sample COST MODEL USING *) pset
          FROM mining_data_apply_v
         WHERE cust_id < 100011) T,
       TABLE(T.pset) S
ORDER BY cust_id, S.prediction;
---------- ---------- ----------- -----
    100001          0      .96682   .27
    100001          1      .03318   .97
    100002          0      .74038  2.08
    100002          1      .25962   .74
    100003          0      .90909   .73
    100003          1      .09091   .91
    100004          0      .90909   .73
    100004          1      .09091   .91
    100005          0      .27236  5.82
    100005          1      .72764   .27
    100006          0     1.00000   .00
    100006          1      .00000  1.00
    100007          0      .90909   .73
    100007          1      .09091   .91
    100008          0      .90909   .73
    100008          1      .09091   .91
    100009          0      .27236  5.82
    100009          1      .72764   .27
    100010          0      .80808  1.54
    100010          1      .19192   .81
20 rows selected.

Oracle Magazine
and Oracle White Papers

SQL University.net courses meet the most demanding needs of the business world for advanced education in a cost-effective manner. SQL University.net courses are available immediately for IT professionals and can be taken without disruption of your workplace schedule or processes.

Compared to traditional travel-based training, SQL University.net saves time and valuable corporate resources, allowing companies to do more with less. That's our mission, and that's what we deliver.

Click here to find out more
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 72 users online    © 2009 psoug.org

Forgot your password?