File

Transcription

File
13/01/15&
13/01/15&
Agenda&
&
Moving&beyond&Oracle&Data&Miner.&
&What&the&Oracle&DBA&and&Developer&
•  Oracle&Data&Miner&&&&&What&Next?&
&
•  Oracle&Data&Mining&SQL&&&PL/SQL&Func.ons&
needs&to&know&
•  ODM&for&the&Developer&&(not&only&for&the&Data&Scien.st)&
&
•  ODM&for&the&DBA&
Brendan Tierney
•  A&match&made&in&Heaven.&ORE&and&ODM&
•  Everyone&is&talking&about&it&!!!&What&is&in&our&future?&
&&&www.oraly.cs.com
&t&:&@brendan.erney
&e&:&[email protected]&
&
&
&&
&&&www.oraly.cs.com
Brendan&Tierney&
&&
•  ODM&for&the&Developer&&(not&only&for&the&Data&Scien.st)&
eBook&&&Print&available&
Oracle&version&5&up&to&11g&
Oracle&Reports&(RPT),&ReportWriter&I,&RPT,&…&
Forms&2.3…&
Oracle&Data&Miner&since&2005&
&t&:&@brendan.erney
&
•  Oracle&Data&Mining&SQL&&&PL/SQL&Func.ons&
•  ODM&for&the&DBA&
•  A&match&made&in&Heaven.&ORE&and&ODM&
!  Data&Warehousing&since&1997&
!  Data&Mining&since&1998&
!  Analy.cs&since&1993&
&&&www.oraly.cs.com
&
•  Oracle&Data&Miner&&&&&What&Next?&
Data&Miner&/&Data&Scien.st&
BI&&&Data&Architect&
DBA&
Trainer&
Lecturer&
!  Working&with&Oracle&products&since&1992/1993&
! 
! 
! 
! 
&e&:&[email protected]&
Agenda&
!  Currently:&
! 
! 
! 
! 
! 
&t&:&@brendan.erney
&e&:&[email protected]&
•  Everyone&is&talking&about&it&!!!&&What&is&in&our&future?&
&
&
&&
&&&www.oraly.cs.com
1&
&t&:&@brendan.erney
&e&:&[email protected]&
&
&
&&
2&
13/01/15&
13/01/15&
Scheduling&ODM&Jobs&
Comprehensive&Advanced&Analy.cs&Pla_orm&
! 
&&&www.oraly.cs.com
&t&:&@brendan.erney
&e&:&[email protected]&
&
&
&&
But!&
! 
Scheduling&the&ODMr&workflow&does&require&the&ODM&
Repository&installed&in&Produc.on&
! 
Migra.on&of&all&ODMr&Repository&objects&between&Test/Dev&&
and&&Produc.on&
&&&www.oraly.cs.com
&t&:&@brendan.erney
&e&:&[email protected]&
&
&
&&
Typical&Data&Mining&Process&
•  Building&&&upda.ng&models&
•  Do&I&have&to&do&this&all&the&.me?&
" Answer:&&&Yes&and&No&
Could&all&of&this&be&
dynamic?&
Prescrip.ve&analy.cs?&
Historical&
Data&
&&&www.oraly.cs.com
&t&:&@brendan.erney
&e&:&[email protected]&
&
&
&&
&&&www.oraly.cs.com
3&
&t&:&@brendan.erney
Model&
&e&:&[email protected]&
New&
Data&
&
Can&DM&be&easily&
embedded&into&our&
Applica.ons?&
&
&&
4&
13/01/15&
13/01/15&
Agenda&
Oracle&Data&Mining&
•  Oracle&Data&Miner&&&&&What&Next?&
! 
PL/SQL&Package&
! 
!  DBMS_DATA_MINING&
!  DBMS_DATA_MINING_TRANSFORM&
!  DBMS_PREDICTIVE_ANALYTICS&
•  Oracle&Data&Mining&SQL&&&PL/SQL&Func.ons&
•  ODM&for&the&Developer&&(not&only&for&the&Data&Scien.st)&
•  ODM&for&the&DBA&
! 
12c&–&Predic.ve&Queries&
!  aka&&Dynamic&Queries&
!  Transi.ve&dynamic&Data&Mining&models&
!  Can&scale&to&many&100+&models&all&in&one&
statement&&
•  A&match&made&in&Heaven.&ORE&and&ODM&
•  Everyone&is&talking&about&it&!!!&&What&is&in&our&future?&
OTN&Technical&Ar.cle&&
&&&www.oraly.cs.com
&t&:&@brendan.erney
&e&:&[email protected]&
&
&
&&
&&&www.oraly.cs.com
InmDatabase&Data&Mining&Algorithms&
Technique)
Algorithms)
Applicability)
Classifica.on&
Logis.c&Regression&(GLM)&
Decision&Trees&
Naïve&Bayes&
Support&Vector&Machine&
Classical&Sta.s.cal&Technique&
Popular&/&Rules&/&Transparency&
Embedded&
Wide&/&Narrow&Data&/&Text&
Regression&
&
&
Mul.ple&Regression&
Support&Vector&Machine&
Classical&Sta.s.cal&Technique&
Wide&/&Narrow&Data&/&Text&
&
Anomaly&Detec.on&
&
&
One&Class&SVM&
Lack&Examples&
Ajribute&Importance&
&
&
Minimum&Descrip.ve&Length&
Ajribute&Reduc.on&
Iden.fy&Useful&Data&
Reduce&Data&Noise&
Associa.on&Rules&
&
&
Apriori&
Market&Basket&Analysis&
Link&Analysis&
Clustering&
Enhanced&KmMeans&
OmCluster&
Expecta.on&Maximiza.on&
Product&Grouping&
Text&Mining&
Gene&and&Protein&Analysis&
Feature&Extrac.on&
&&&www.oraly.cs.com
NonmNega.ve&Matrix&Factoriza.on&
Text&Analysis&
Principal&Components&Analysis&
Feature&Reduc.on&
Singular&Vector&Decomposi.on&
&t&:&@brendan.erney
&e&:&[email protected]&
&t&:&@brendan.erney
SQL&Func.ons&
–  PREDICTION&
–  PREDICTION_PROBABILITY&
– 
– 
– 
– 
– 
– 
– 
– 
– 
– 
– 
– 
– 
PREDICTION_BOUNDS&
PREDICTION_COST&
PREDICTION_DETAILS&
PREDICTION_SET&
CLUSTER_ID&
CLUSTER_DETAILS&
CLUSTER_DISTANCE&
CLUSTER_PROBABILITY&
CLUSTER_SET&
FEATURE_ID&
FEATURE_DETAILS&
FEATURE_SET&
FEATURE_VALUE&
&e&:&[email protected]&
&
&
&&
Predic.ve&Queries&
! 
Are&dynamic&Data&Mining&models&
•  Aser&they&are&built&and&used&they&are&no&long&available&to&use&or&inspect&
& !  Created&with&the&minimum&of&detail&
!  That&scales&automa.cally&
OnmthemFly&Models&=&Dynamic&Queries&=&Dynamic&Scoring&=&
•  Can&handle&when&new&data&values&get&created.&
•  New&models/predic.ons&based&on&these&
Predic.ve&Queries.&&&
!  Allows&you&to&do&predic.ons&quickly&
& !  You&are&not&concerned&with&
•  Parameter&setngs&
Yes&that&is&a&bit&confusing.&
•  What&data&mining&algorithm&is&used&
•  Tuning&of&data&mining&algorithms&
&& !  What&want&to&get&an&idea/feel&for&a&possible&predic.on&
•  On&the&fly&data&models&
•  Par..oned&models&
! 
&
&
&&
All&done&using&SQL&
&&&www.oraly.cs.com
5&
&t&:&@brendan.erney
&e&:&[email protected]&
&
&
&&
6&
13/01/15&
Sta.s.cal&Func.ons&in&Oracle&
13/01/15&
For&the&Developer&
! 
Data&Dic.onary&Views&
•  (DBA/ALL/USER)_DATA_MINING_MODELS&
•  (DBA/ALL/USER)_MINING_MODEL_ATTRIBUTES&
•  (DBA/ALL/USER)_MINING_MODEL_SETTINGS&
All&of&these&are&
FREE
&&
with&the&Database&
! 
PL/SQL&Packages&
•  DBMS_DATA_MINING&
•  DBMS_DATA_TRANSFORMATIONS&
These&are&osen&
forgojen&about&
! 
SQL&Func.ons&
•  PREDICTION&
•  PREDICTION_PROBABILITY&
&&&www.oraly.cs.com
&t&:&@brendan.erney
&e&:&[email protected]&
&
&
&&
&&&www.oraly.cs.com
Agenda&
&
&
&&
•  ALL_MINING_MODELS&
–  Describes&the&high&level&informa.on&about&the&data&mining&models&in&
the&database&
•  Oracle&Data&Mining&SQL&&&PL/SQL&Func.ons&
SELECT model_name,
mining_function,
algorithm,
build_duration,
model_size
FROM ALL_MINING_MODELS;
•  ODM&for&the&Developer&&(not&only&for&the&Data&Scien.st)&
•  ODM&for&the&DBA&
•  A&match&made&in&Heaven.&ORE&and&ODM&
MODEL_NAME
------------CLAS_SVM_1_30
CLAS_DT_1_30
CLAS_GLM_1_30
CLAS_NB_1_30
•  Everyone&is&talking&about&it&!!!&&What&is&in&our&future?&
&t&:&@brendan.erney
&e&:&[email protected]&
ODM&Data&Dic.onary&
•  Oracle&Data&Miner&&&&&What&Next?&
&&&www.oraly.cs.com
&t&:&@brendan.erney
&e&:&[email protected]&
&
&
&&
&&&www.oraly.cs.com
7&
MINING_FUNCTION
---------------CLASSIFICATION
CLASSIFICATION
CLASSIFICATION
CLASSIFICATION
&t&:&@brendan.erney
ALGORITHM
-------------------------SUPPORT_VECTOR_MACHINES
DECISION_TREE
GENERALIZED_LINEAR_MODEL
NAIVE_BAYES
BUILD_DURATION
-------------3
2
3
2
&e&:&[email protected]&
&
MODEL_SIZE
---------.1515
.0842
.0877
.0459
&
&&
8&
13/01/15&
13/01/15&
ODM&Data&Dic.onary&
•  ALL_MINING_MODEL_ATTRIBUTES&
How&do&we&build&an&ODM&model&using&SQL?&
–  Describes&the&ajributes&of&the&data&mining&models&
SELECT attribute_name,
attribute_type,
usage_type,
target
from all_mining_model_attributes
where model_name = 'CLAS_DT_1_30';
ATTRIBUTE_NAME
-----------------------------AGE
CUST_MARITAL_STATUS
EDUCATION
HOUSEHOLD_SIZE
OCCUPATION
YRS_RESIDENCE
Y_BOX_GAMES
AFFINITY_CARD
&
&&&www.oraly.cs.com
&t&:&@brendan.erney
ATTRIBUTE_T
----------NUMERICAL
CATEGORICAL
CATEGORICAL
CATEGORICAL
CATEGORICAL
NUMERICAL
NUMERICAL
CATEGORICAL
USAGE_TY
-------ACTIVE
ACTIVE
ACTIVE
ACTIVE
ACTIVE
ACTIVE
ACTIVE
ACTIVE
TAR
--NO
NO
NO
NO
NO
NO
NO
YES
&e&:&[email protected]&
&
&
&&
&&&www.oraly.cs.com
ODM&Data&Dic.onary&
&t&:&@brendan.erney
&
&&
–  Creates&a&mining&model&with&the&specified&name,&
mining&func.on,&and&case&table&(build&data).&
select setting_name,
setting_value,
setting_type
from all_mining_model_settings
where model_name = 'CLAS_DT_1_30';
&&&www.oraly.cs.com
&
•  DBMS_DATA_MINING.CREATE_MODEL&
–  Describes&the&setng&of&the&data&mining&models&
SETTING_VALUE
---------------------------ALGO_DECISION_TREE
ON
.05
20
TREE_IMPURITY_GINI
ODMR$15_42_50_762000JERWZYK
.1
7
10
&e&:&[email protected]&
Create&Model&
•  ALL_MINING_MODEL_SETTINGS&
SETTING_NAME
----------------------ALGO_NAME
PREP_AUTO
TREE_TERM_MINPCT_NODE
TREE_TERM_MINREC_SPLIT
TREE_IMPURITY_METRIC
CLAS_COST_TABLE_NAME
TREE_TERM_MINPCT_SPLIT
TREE_TERM_MAX_DEPTH
TREE_TERM_MINREC_NODE
&t&:&@brendan.erney
DBMS_DATA_MINING.CREATE_MODEL (
model_name
IN VARCHAR2,
mining_function
IN VARCHAR2,
data_table_name
IN VARCHAR2,
case_id_column_name IN VARCHAR2,
target_column_name
IN VARCHAR2 DEFAULT NULL,
settings_table_name IN VARCHAR2 DEFAULT NULL,
data_schema_name
IN VARCHAR2 DEFAULT NULL,
settings_schema_name IN VARCHAR2 DEFAULT NULL,
transform_list
IN DM_TRANSFORMS DEFAULT NULL;)
SETTING
------INPUT
INPUT
INPUT
INPUT
INPUT
INPUT
INPUT
INPUT
INPUT
&e&:&[email protected]&
&
&
&&
&&&www.oraly.cs.com
9&
&t&:&@brendan.erney
&e&:&[email protected]&
&
&
&&
10&
13/01/15&
Create&Model&m&Setngs&Table&
13/01/15&
Create&Model&&
-- Create the settings table
CREATE TABLE decision_tree_model_settings (
setting_name VARCHAR2(30),
setting_value VARCHAR2(30));
We&list&what&ODM&
algorithm&&&set&the&
parameters&
-- Populate the settings table
-- Specify DT. By default, Naive Bayes is used for classification.
-- Specify ADP. By default, ADP is not used.
SQL> describe all_mining_model_settings
Name
Null?
Type
--------------------- -------- ----------------OWNER
NOT NULL VARCHAR2(30)
MODEL_NAME
NOT NULL VARCHAR2(30)
SETTING_NAME
NOT NULL VARCHAR2(30)
SETTING_VALUE
SETTING_TYPE
VARCHAR2(4000)
VARCHAR2(7)
COLUMN setting_value FORMAT A25
SELECT setting_name,
BEGIN
INSERT INTO decision_tree_model_settings (setting_name, setting_value)
VALUES (dbms_data_mining.algo_name,dbms_data_mining.algo_decision_tree);
setting_value,
setting_type
FROM all_mining_model_settings
WHERE model_name in ‘DECISION_TREE_METHOD2';
INSERT INTO decision_tree_model_settings (setting_name, setting_value)
VALUES (dbms_data_mining.prep_auto,dbms_data_mining.prep_auto_on);
COMMIT;
END;
/
&&&www.oraly.cs.com
We&can&replace&the&
default&parameter&
setngs&&in&our&
Setngs&table&
Automa.cs&Data&
Prepara.on&needs&to&
be&turned&on.&
Automa.cally&used&in&
ODMr&(GUI&
&t&:&@brendan.erney
&e&:&[email protected]&
&
&
SETTING_NAME
-----------------------------ALGO_NAME
PREP_AUTO
TREE_TERM_MINPCT_NODE
TREE_TERM_MINREC_SPLIT
TREE_IMPURITY_METRIC
TREE_TERM_MINPCT_SPLIT
TREE_TERM_MAX_DEPTH
TREE_TERM_MINREC_NODE
&&
&&&www.oraly.cs.com
&t&:&@brendan.erney
SETTING_VALUE
------------------------ALGO_DECISION_TREE
ON
.05
20
TREE_IMPURITY_GINI
.1
7
10
&e&:&[email protected]&
SETTING
------INPUT
INPUT
DEFAULT
DEFAULT
DEFAULT
DEFAULT
DEFAULT
DEFAULT&
&
&
&&
&
&
&&
Create&Model&&
! 
BEGIN
DBMS_DATA_MINING.CREATE_MODEL(
model_name
=> ‘Decision_Tree_Method2',
mining_function
=> dbms_data_mining.classification,
data_table_name
=> 'mining_data_build_v',
case_id_column_name => 'cust_id',
target_column_name => 'affinity_card',
settings_table_name => ‘decision_tree_model_settings');
END;
/
&&&www.oraly.cs.com
&t&:&@brendan.erney
&e&:&[email protected]&
&
&
Our&ODM&Models&
SELECT model_name,
FROM
mining_function,
algorithm
user_mining_models;
MODEL_NAME
----------------------CLAS_DECISION_TREE
DECISION_TREE_METHOD2
&&
&&&www.oraly.cs.com
11&
MINING_FUNCTION
-------------------CLASSIFICATION
CLASSIFICATION
&t&:&@brendan.erney
ALGORITHM
-------------------DECISION_TREE&
DECISION_TREE
&e&:&[email protected]&
12&
13/01/15&
13/01/15&
Using&the&ODM&Model&–&Bulk&Processing&
!  DBMS_DATA_MINING.APPLY&
How&do&we&use&our&ODM&model&in&SQL?&
DBMS_DATA_MINING.APPLY (
model_name
IN
data_table_name
IN
case_id_column_name IN
result_table_name
IN
data_schema_name
IN
VARCHAR2,
VARCHAR2,
VARCHAR2,
VARCHAR2,
VARCHAR2 DEFAULT NULL);
&
! 
&&&www.oraly.cs.com
&t&:&@brendan.erney
&e&:&[email protected]&
&
&
&&
&&&www.oraly.cs.com
Using&the&ODM&Model&
! 
Results&are&sorted&in&a&table&
&t&:&@brendan.erney
&e&:&[email protected]&
&
&
&&
Using&the&ODM&Model&–&Bulk&Processing&
2&ways&
•  Bulk&Processing&
•  DBMS_DATA_MINING.APPLY&
! 
Results&table&format&
–  For&a&Classifica.on&algorithms&
case_id VARCHAR2/NUMBER
prediction NUMBER / VARCHAR2 -- depending a target data type
probability NUMBER
–  For&Regression&
–  Realm.me&use&
•  PREDICTION&&SQL&func.ons&
case_id VARCHAR2/NUMBER
prediction NUMBER
–  For&Clustering&
case_id VARCHAR2/NUMBER
cluster_id NUMBER
probability NUMBER
&&&www.oraly.cs.com
&t&:&@brendan.erney
&e&:&[email protected]&
&
&
&&
&&&www.oraly.cs.com
13&
&t&:&@brendan.erney
&e&:&[email protected]&
&
&
&&
14&
13/01/15&
Using&the&ODM&Model&–&Bulk&Processing&
! 
13/01/15&
Using&the&ODM&Model&–&Bulk&Processing&
Example&
–  Premprocessing&of&data&to&get&into&correct&format&
! 
select * from NEW_DATA_SCORED where rownum <=12;
•  Code&/&Views&
•  DBMS_DATA_MINING.TRANSFORM&
BEGIN
dbms_data_mining.apply(
model_name
data_table_name
case_id_column_name
result_table_name
END;
=>
=>
=>
=>
CUST_ID
PREDICTION PROBABILITY
---------- ---------- ----------103001
0
1
103001
1
0
103002
0 .956521739
103002
1 .043478261
103003
0 .673387097
103003
1 .326612903
103004
0 .673387097
103004
1 .326612903
103005
1 .767241379
103005
0 .232758621
103006
0
1
103006
1
0
'CLAS_DECISION_TREE',
'NEW_DATA_TO_SCORE',
'CUST_ID',
'NEW_DATA_SCORED');
–  Creates&a&results&table&called&NEW_DATA_SCORED&
&&&www.oraly.cs.com
&t&:&@brendan.erney
&e&:&[email protected]&
&
&
&&
&&&www.oraly.cs.com
Using&the&ODM&Model&–&Bulk&Processing&
! 
Bulk&Processing&
&t&:&@brendan.erney
&e&:&[email protected]&
&
&
&&
Using&the&ODM&Model&–&RealmTime&in&SQL&
Bulk&Processing&
! 
•  Original&Data&=&1500&cases&
SQL&Func.ons&
PREDICTION ( model_name, USING attribute_list);
SQL> desc NEW_DATA_SCORED
Name
Null?
------------------------------- -------CUST_ID
NOT NULL
PREDICTION
PROBABILITY
! 
PREDICTION_PROBABILITY ( model_name, USING attribute_list);
Type
------NUMBER
NUMBER
NUMBER
NEW_DATA_SCORED&=&3000&
&&&www.oraly.cs.com
&t&:&@brendan.erney
&e&:&[email protected]&
&
&
&&
&&&www.oraly.cs.com
15&
&t&:&@brendan.erney
&e&:&[email protected]&
&
&
&&
16&
13/01/15&
13/01/15&
Using&the&ODM&Model&–&RealmTime&in&SQL&
Using&the&ODM&Model&–&RealmTime&in&SQL&
Example&1&
Example&3&
–  Select&a&record&and&calculate&the&predicted&value&
–  The&func.on&will&return&the&predicted&value&with&the&highest&
probability&
–  Select&records&based&on&Predic.on&value&and&the&Probability&
–  From&what&Countries&do&the&customer&come&from&where&the&Predic.on&is&
0&(wont&take&up&offer)&and&the&Probability&of&this&occurring&being&1&
(100%)&
&
SELECT cust_id, PREDICTION(clas_decision_tree using *)
FROM
NEW_DATA_TO_SCORE
WHERE cust_id = 103001;
select country_name, count(*)
from
new_data_to_score
where PREDICTION(clas_decision_tree using *) = 0
and
PREDICTION_PROBABILITY (clas_decision_tree using *) = 1
group by country_name
order by count(*) asc;
CUST_ID
PREDICTION(CLAS_DECISION_TREEUSING*)
---------- -----------------------------------103001
0
&&&www.oraly.cs.com
&t&:&@brendan.erney
&e&:&[email protected]&
&
&
&&
&&&www.oraly.cs.com
Using&the&ODM&Model&–&RealmTime&in&SQL&
&t&:&@brendan.erney
&e&:&[email protected]&
&
&
&&
Using&the&ODM&Model&–&RealmTime&in&SQL&
Example&2&
–  Select&the&top&10&Customers&with&class&value&of&1&
–  Find&records&with&a&predicted&class&value&of&1&i.e.&the&highest&probability&(1)&
COUNTRY_NAME
COUNT(*)
---------------------------------------- ---------Brazil
1
China
1
Saudi Arabia
1
Australia
1
Turkey
1
New Zealand
1
Italy
5
Argentina
12
United States of America
293
SELECT cust_id
FROM NEW_DATA_TO_SCORE
WHERE PREDICTION(clas_decision_tree using *) = 1
AND rownum <=10;
CUST_ID
---------103005
103007
103010
103014
103016
103018
103020
103029
103031
103036
&&&www.oraly.cs.com
&t&:&@brendan.erney
&e&:&[email protected]&
&
&
&&
&&&www.oraly.cs.com
17&
&t&:&@brendan.erney
&e&:&[email protected]&
&
&
&&
18&
13/01/15&
Using&the&ODM&Model&–&RealmTime&in&SQL&
! 
Using&the&ODM&Model&–&RealmTime&in&SQL&
PREDICTION&Func.on&
! 
•  Example&4&
CUST_ID PRED_VALUE
---------- ---------100301
0
100302
0
100303
0
100304
0
100305
1
100306
0
100307
0
100308
0
100309
1
100310
0
&&&www.oraly.cs.com
&t&:&@brendan.erney
PRED_VALUE2 PRED_PROB2 PRED_VALUE3 PRED_PROB3 PRED_VALUE4 PRED_PROB4 PRED_VALUE PRED_PROB
----------- ---------- ----------- ---------- ----------- ---------- ---------- ---------0 .750623441
0 .532967033
1 .767241379
1 .767241379
&e&:&[email protected]&
&
&
&&
&&&www.oraly.cs.com
Using&the&ODM&Model&–&RealmTime&in&SQL&
! 
CUST_ID PRED_VALUE
---------- ---------100301
0
100302
0
100303
0
100304
0
100305
1
100306
0
100307
0
100308
0
100309
1
100310
0
&&&www.oraly.cs.com
&t&:&@brendan.erney
! 
&e&:&[email protected]&
&
&
&&
Example&5&
SELECT PREDICTION(clas_decision_tree using AGE) Pred_Value2,
prediction_probability (clas_decision_tree using AGE) Pred_Prob2,
PREDICTION(clas_decision_tree using AGE, HOUSEHOLD_SIZE) Pred_Value3,
prediction_probability (clas_decision_tree using AGE, HOUSEHOLD_SIZE) Pred_Prob3,
PREDICTION(clas_decision_tree using AGE, HOUSEHOLD_SIZE, EDUCATION) Pred_Value4,
prediction_probability (clas_decision_tree using AGE, HOUSEHOLD_SIZE, EDUCATION) Pred_Prob4,
PREDICTION(clas_decision_tree using *) Pred_Value,
prediction_probability (clas_decision_tree using *) Pred_Prob Pred_Prob4
FROM NEW_DATA_TO_SCORE
WHERE cust_id = 100305;
PRED_PROB
---------.956521739
.862433862
.862433862
.862433862
.767241379
1
.862433862
.862433862
.767241379
.673387097&
&e&:&[email protected]&
&t&:&@brendan.erney
Using&the&ODM&Model&–&RealmTime&in&SQL&
Example&4&
SELECT cust_id,
PREDICTION(clas_decision_tree using *) Pred_Value,
PREDICTION_PROBABILITY (clas_decision_tree using *) Pred_Prob
FROM NEW_DATA_TO_SCORE
WHERE rownum <=10
&
Example&5&
SELECT PREDICTION(clas_decision_tree using AGE) Pred_Value2,
prediction_probability (clas_decision_tree using AGE) Pred_Prob2,
PREDICTION(clas_decision_tree using AGE, HOUSEHOLD_SIZE) Pred_Value3,
prediction_probability (clas_decision_tree using AGE, HOUSEHOLD_SIZE) Pred_Prob3,
PREDICTION(clas_decision_tree using AGE, HOUSEHOLD_SIZE, EDUCATION) Pred_Value4,
prediction_probability (clas_decision_tree using AGE, HOUSEHOLD_SIZE, EDUCATION)
Pred_Prob4,
PREDICTION(clas_decision_tree using *) Pred_Value,
prediction_probability (clas_decision_tree using *) Pred_Prob Pred_Prob4
FROM NEW_DATA_TO_SCORE
WHERE cust_id = 100305;
SELECT cust_id,
PREDICTION(clas_decision_tree using *) Pred_Value
FROM NEW_DATA_TO_SCORE
WHERE rownum <=10
&
13/01/15&
PRED_VALUE2 PRED_PROB2 PRED_VALUE3 PRED_PROB3 PRED_VALUE4 PRED_PROB4 PRED_VALUE PRED_PROB
----------- ---------- ----------- ---------- ----------- ---------- ---------- ---------0 .750623441
0 .532967033
1 .767241379
1 .767241379
&
&
&&
&&&www.oraly.cs.com
19&
&t&:&@brendan.erney
&e&:&[email protected]&
&
&
&&
20&
13/01/15&
Using&the&ODM&Model&–&RealmTime&in&SQL&
! 
13/01/15&
Using&the&ODM&Model&–&RealmTime&in&SQL&
Example&5&
! 
Example&5&
SELECT PREDICTION(clas_decision_tree using AGE) Pred_Value2,
prediction_probability (clas_decision_tree using AGE) Pred_Prob2,
PREDICTION(clas_decision_tree using AGE, HOUSEHOLD_SIZE) Pred_Value3,
prediction_probability (clas_decision_tree using AGE, HOUSEHOLD_SIZE) Pred_Prob3,
PREDICTION(clas_decision_tree using AGE, HOUSEHOLD_SIZE, EDUCATION) Pred_Value4,
prediction_probability (clas_decision_tree using AGE, HOUSEHOLD_SIZE, EDUCATION) Pred_Prob4,
PREDICTION(clas_decision_tree using *) Pred_Value,
prediction_probability (clas_decision_tree using *) Pred_Prob Pred_Prob4
FROM NEW_DATA_TO_SCORE
WHERE cust_id = 100305;
SELECT PREDICTION(clas_decision_tree using AGE) Pred_Value2,
prediction_probability (clas_decision_tree using AGE) Pred_Prob2,
PREDICTION(clas_decision_tree using AGE, HOUSEHOLD_SIZE) Pred_Value3,
prediction_probability (clas_decision_tree using AGE, HOUSEHOLD_SIZE) Pred_Prob3,
PREDICTION(clas_decision_tree using AGE, HOUSEHOLD_SIZE, EDUCATION) Pred_Value4,
prediction_probability (clas_decision_tree using AGE, HOUSEHOLD_SIZE, EDUCATION) Pred_Prob4,
PREDICTION(clas_decision_tree using *) Pred_Value,
prediction_probability (clas_decision_tree using *) Pred_Prob Pred_Prob4
FROM NEW_DATA_TO_SCORE
WHERE cust_id = 100305;
PRED_VALUE2 PRED_PROB2 PRED_VALUE3 PRED_PROB3 PRED_VALUE4 PRED_PROB4 PRED_VALUE PRED_PROB
----------- ---------- ----------- ---------- ----------- ---------- ---------- ---------0 .750623441
0 .532967033
1 .767241379
1 .767241379
PRED_VALUE2 PRED_PROB2 PRED_VALUE3 PRED_PROB3 PRED_VALUE4 PRED_PROB4 PRED_VALUE PRED_PROB
----------- ---------- ----------- ---------- ----------- ---------- ---------- ---------0 .750623441
0 .532967033
1 .767241379
1 .767241379
&&&www.oraly.cs.com
&t&:&@brendan.erney
&e&:&[email protected]&
&
&
&&
&&&www.oraly.cs.com
Using&the&ODM&Model&–&RealmTime&in&SQL&
! 
! 
&
&
&
&&
Example&6&
Select PREDICTION_PROBABILITY (CLAS_DECISION_TREE, 0
USING 46 as AGE,
3 as HOUSEHOLD_SIZE,
‘Assoc-A’ as EDICATION,
‘M’ as CUST_GENDER,
‘MARRIED’ as CUST_MARITAL_STATUS,
‘Crafts’ as OCCUPATION)
Pred_Prob
from dual;
PRED_VALUE2 PRED_PROB2 PRED_VALUE3 PRED_PROB3 PRED_VALUE4 PRED_PROB4 PRED_VALUE PRED_PROB
----------- ---------- ----------- ---------- ----------- ---------- ---------- ---------0 .750623441
0 .532967033
1 .767241379
1 .767241379
&e&:&[email protected]&
&
•  Whatmif&Analysis&
SELECT PREDICTION(clas_decision_tree using AGE) Pred_Value2,
prediction_probability (clas_decision_tree using AGE) Pred_Prob2,
PREDICTION(clas_decision_tree using AGE, HOUSEHOLD_SIZE) Pred_Value3,
prediction_probability (clas_decision_tree using AGE, HOUSEHOLD_SIZE) Pred_Prob3,
PREDICTION(clas_decision_tree using AGE, HOUSEHOLD_SIZE, EDUCATION) Pred_Value4,
prediction_probability (clas_decision_tree using AGE, HOUSEHOLD_SIZE, EDUCATION) Pred_Prob4,
PREDICTION(clas_decision_tree using *) Pred_Value,
prediction_probability (clas_decision_tree using *) Pred_Prob Pred_Prob4
FROM NEW_DATA_TO_SCORE
WHERE cust_id = 100305;
&t&:&@brendan.erney
&e&:&[email protected]&
Using&the&ODM&Model&–&RealmTime&in&SQL&
Example&5&
&&&www.oraly.cs.com
&t&:&@brendan.erney
&&
&&&www.oraly.cs.com
21&
&t&:&@brendan.erney
&e&:&[email protected]&
&
&
&&
22&
13/01/15&
13/01/15&
OBIEE&Dashboard&
! 
&&&www.oraly.cs.com
! 
&t&:&@brendan.erney
&e&:&[email protected]&
&
&
&&
Oracle&HCM&
&&&www.oraly.cs.com
OBIEE&Dashboard&
! 
▪
▪
▪
&t&:&@brendan.erney
&e&:&[email protected]&
&
&
&&
&
The$models$are$first$class$objects$in$the$DB$
Just$like$calling$any$other$function$
They$are$fast$
&&&www.oraly.cs.com
23&
&e&:&[email protected]&
&
&&
Oracle&HCM&
▪
▪
&&&www.oraly.cs.com
&t&:&@brendan.erney
Built$a$model$on$550,000$records$in$2$minutes$
Scored$1.2M$records$in$52$seconds$$$(on$a$mid$spec$development$sever)$
33"lines"of"SQL"code"
to#build#and#implement#a#
Sentiment#Classifier##
in#Oracle$
▪ >80M$records$per$hour$$without$using$the$Parallel$Option
&t&:&@brendan.erney
&e&:&[email protected]&
&
&
&&
24&
13/01/15&
ODM&&&APEX&:&BI&Dashboard&
13/01/15&
Agenda&
•  Oracle&Data&Miner&&&&&What&Next?&
•  Oracle&Data&Mining&SQL&&&PL/SQL&Func.ons&
•  ODM&for&the&Developer&&(not&only&for&the&Data&Scien.st)&
•  ODM&for&the&DBA&
•  A&match&made&in&Heaven.&ORE&and&ODM&
•  Everyone&is&talking&about&it&!!!&&What&is&in&our&future?&
&&&www.oraly.cs.com
&t&:&@brendan.erney
&e&:&[email protected]&
&
&
&&
&&&www.oraly.cs.com
Agenda&
&t&:&@brendan.erney
&e&:&[email protected]&
&
&
&&
&
&&
Comprehensive&Advanced&Analy.cs&Pla_orm&
•  Oracle&Data&Miner&&&&&What&Next?&
•  Oracle&Data&Mining&SQL&&&PL/SQL&Func.ons&
•  ODM&for&the&Developer&&(not&only&for&the&Data&Scien.st)&
•  ODM&for&the&DBA&
•  A&match&made&in&Heaven.&ORE&and&ODM&
•  Everyone&is&talking&about&it&!!!&&What&is&in&our&future?&
&&&www.oraly.cs.com
&t&:&@brendan.erney
&e&:&[email protected]&
&
&
&&
&&&www.oraly.cs.com
25&
&t&:&@brendan.erney
&e&:&[email protected]&
&
26&
13/01/15&
Agenda&
13/01/15&
Oracle&Big&Data&SQL&
•  Oracle&Data&Miner&&&&&What&Next?&
•  Oracle&Data&Mining&SQL&&&PL/SQL&Func.ons&
•  ODM&for&the&Developer&&(not&only&for&the&Data&Scien.st)&
•  ODM&for&the&DBA&
•  A&match&made&in&Heaven.&ORE&and&ODM&
•  Everyone&is&talking&about&it&!!!&&What&is&in&our&future?&
&&&www.oraly.cs.com
&t&:&@brendan.erney
&e&:&[email protected]&
&
&
&&
&&&www.oraly.cs.com
&t&:&@brendan.erney
&e&:&[email protected]&
&
&
&&
Oracle&Big&Data&SQL&
&
Use&SQL&to&
&Query&ALL&your&Data&
&
&&&www.oraly.cs.com
&t&:&@brendan.erney
&e&:&[email protected]&
&
&
&&
&&&www.oraly.cs.com
27&
&t&:&@brendan.erney
&e&:&[email protected]&
&
&
&&
28&
13/01/15&
Oracle&Big&Data&SQL&
13/01/15&
Oracle&Big&Data&SQL&
Data&Mine&all&our&data&in&RDBMS&
SQL&
Data&Mine&all&our&data&in&RDBMS&
&
&
and&lots&more&
Use&SQL&to&
One&SQL&&to&rule&them&all,&One&&SQL&to&find&them,&
&Query&ALL&your&Data&
One&&SQL&to&bring&them&all&and&in&the&brightness&bind&them&
&
&
&
and&lots&more&
Use&SQL&to&
&Query&ALL&your&Data&
&
Sauron'–'Lord'of'the'Rings'
'
&&&www.oraly.cs.com
&t&:&@brendan.erney
&e&:&[email protected]&
&
&
&&
&&&www.oraly.cs.com
Oracle&Big&Data&SQL&
Data&Mine&all&our&data&in&RDBMS&
SQL&
&
&&
&
&Is&Just&SQL&
&
Sauron'–'Lord'of'the'Rings'
'
&e&:&[email protected]&
&
&&in&Oracle&&
&
&
Use&SQL&to&
One&Ring&to&rule&them&all,&One&Ring&to&find&them,&
&Query&ALL&your&Data&
One&Ring&to&bring&them&all&and&in&the&darkness&bind&them&
&
&
&t&:&@brendan.erney
&e&:&[email protected]&
Predic.ve&Analy.cs&/&Data&Mining&/&Data&Science&…&
and&lots&more&
&&&www.oraly.cs.com
&t&:&@brendan.erney
&
&
And&when&SQL&cannot&do&it&
&
&run&R&in&the&Database&&(ORE)&
&&
&&&www.oraly.cs.com
29&
&t&:&@brendan.erney
&e&:&[email protected]&
&
&
&&
30&
13/01/15&
&&&www.oraly.cs.com
&t&:&@brendan.erney
&e&:&[email protected]&
&
&
&&
&
&&
13/01/15&
&&&www.oraly.cs.com
&t&:&@brendan.erney
&e&:&[email protected]&
&
&
&&
&&
&
&&&&&&&&&&&&&&[email protected]&
&
&&&&&&&&&&&&&&&@brendan.erney&
&
&&&&&&&&&&&&&&www.oraly.cs.com&
&
&&&&&&&&&&&&&&&ie.linkedin.com/in/brendan.erney&
&&&www.oraly.cs.com
&t&:&@brendan.erney
&e&:&[email protected]&
&
31&
32&