2.4 Data Mining SQL Scoring Functions
Understand the different data mining SQL scoring functions.
The Data Mining SQL language functions use Oracle Data Mining to score data. The functions can apply a mining model schema object to the data, or they can dynamically mine the data by executing an analytic clause. SQL functions are available for all the data mining algorithms that support the scoring operation. All Data Mining SQL functions, as listed in the following table can operate on R Mining Model with the corresponding mining function. However, the functions are not limited to the ones listed here.
Table 2-4 Data Mining SQL Functions
The following example shows a query that returns the results of the CLUSTER_ID
function. The query applies the model em_sh_clus_sample
, which finds groups of customers that share certain characteristics. The query returns the identifiers of the clusters and the number of customers in each cluster.
Example 2-9 CLUSTER_ID Function
-- -List the clusters into which the customers in this -- -data set have been grouped. -- SELECT CLUSTER_ID(em_sh_clus_sample USING *) AS clus, COUNT(*) AS cnt FROM mining_data_apply_v GROUP BY CLUSTER_ID(em_sh_clus_sample USING *) ORDER BY cnt DESC; SQL> -- List the clusters into which the customers in this SQL> -- data set have been grouped. SQL> -- SQL> SELECT CLUSTER_ID(em_sh_clus_sample USING *) AS clus, COUNT(*) AS cnt 2 FROM mining_data_apply_v 3 GROUP BY CLUSTER_ID(em_sh_clus_sample USING *) 4 ORDER BY cnt DESC; CLUS CNT ---------- ---------- 9 311 3 294 7 215 12 201 17 123 16 114 14 86 19 64 15 56 18 36
Related Topics