266 Enhance Your Business Applications: Simple Integration of Advanced Data Mining Functions
--- When:
--- Used in every batch run
------------------------------------------------------------------------------
INSERT INTO ALLOCATED_CLUSTERS
SELECT PREMIUM_ID,
CALLER_ID,
IDMMX.DM_getClusterID( Result ),
IDMMX.DM_getClusScore( Result )
FROM SCORING_ENGINE;
Script to get the scoring results
Example C-4 shows the SQL script used to select the customers in the five
smallest clusters and to build a view.
Example: C-4 Script to generate a list of customers from the smallest five clusters
-------------------------------------------------------------------------------
--- purpose:
--- set up a view to generate a list of connections in
--- the 5 smallest clusters , i.e. outliers.
---
--- When: set up once, used many time in Business Objects
-------------------------------------------------------------------------------
Create view risky as
select scored.clus_id,
attr.caller_id,
attr.premium_id,
attr.sum_dur,
attr.no_calls,
attr.rel_dur,
attr.sum_cost,
attr.max_dur,
attr.var_dur,
attr.no_CLRS
from ALLOCATED_CLUSTERS scored,
connection_table attr
where scored.premium_id = attr.premium_id
and scored.caller_id = attr.caller_id
and scored.clus_id
in
Appendix C. SQL scripts for the fraud detection scenario 267
( select clus_id
from
(
select clus_id, count(*) , rank() over(order by count(*)) as top_N
from ALLOCATED_CLUSTERS
group by clus_id
) as temp
where top_n <= 5
);
268 Enhance Your Business Applications: Simple Integration of Advanced Data Mining Functions

Get Enhance Your Business Applications: Simple Integration of Advanced Data Mining Functions now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.