Machine Learning in Autonomous Data Warehouse: One can use Oracle Autonomous Data Warehouse for machine learning. There are several ways to do this. This presentation explores these different but related options for performing machine learning. Each of these options enables people with different backgrounds to engage with building machine learning solutions on their data. At the end of the session, you will know which option will work best for you
This is from the Bay area Cloud Computing event https://www.meetup.com/All-Things-Cloud-Computing-Bay-Area/events/271017950/
Exploring the Future Potential of AI-Enabled Smartphone Processors
Machine Learning in Autonomous Data Warehouse
1. VP AIOps for the Autonomous Database
Sandesh Rao
Machine Learning in Autonomous Data
Warehouse
@sandeshr
https://www.linkedin.com/in/raosandesh/
https://www.slideshare.net/SandeshRao4
2. The following is intended to outline our general product direction. It is intended for information
purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any
material, code, or functionality, and should not be relied upon in making purchasing decisions. The
development, release, timing, and pricing of any features or functionality described for Oracle’s
products may change and remains at the sole discretion of Oracle Corporation.
Statements in this presentation relating to Oracle’s future plans, expectations, beliefs, intentions and
prospects are “forward-looking statements” and are subject to material risks and uncertainties. A
detailed discussion of these factors and other risks that affect our business is contained in Oracle’s
Securities and Exchange Commission (SEC) filings, including our most recent reports on Form 10-K and
Form 10-Q under the heading “Risk Factors.” These filings are available on the SEC’s website or on
Oracle’s website at http://www.oracle.com/investor. All information in this presentation is current as of
September 2019 and Oracle undertakes no duty to update any statement in light of new information or
future events.
Safe harbor statement
3. 1. Overview of ML and the Autonomous Database
2. Regression
3. Classification
4. Clustering
5. Anomaly detection
6. Workload prediction
7. Dynamic maintenance windows
8. Oracle Machine Learning examples
Agenda
5. Tasks Specific to Business and Innovation
• Architecture, planning, data modeling
• Data security and lifecycle management
• Application related tuning
• End-to-End service level management
Maintenance Tasks
• Configuration and tuning of systems, network, storage
• Database provisioning, patching
• Database backups, H/A, disaster recovery
• Database optimization
Traditionally DBAs are Responsible for:
Value Scale
Innovation
Maintenance
6. Tasks Specific to Business and Innovation
• Architecture, planning, data modeling
• Data security and lifecycle management
• Application related tuning
• End-to-End service level management
Maintenance Tasks
• Configuration and tuning of systems, network, storage
• Database provisioning, patching
• Database backups, H/A, disaster recovery
• Database optimization
Freedom from Drudgery for DBA: More Time to Innovate and Improve the Business
Autonomous Database Removes Generic Tasks
Value Scale
Innovation
Maintenance
7. Machine Learning
Solving data-driven
problems
Discovering insights
Making predictions
Data Security
Data classification,
Data life-cycle mgmt
Application Tuning
SQL tuning,
connection mgmt
The Evolution of the DBA/Database Developer Role
Data Engineer
Architecture,
“data wrangler”
8. Data extraction
Data wrangling
Deriving new attributes
(“feature engineering”)
…
…
…
Import predictions & insights
Translate and deploy ML models
Automate
You Are Probably Already Doing Most of This Work!
Database Developer to Data Scientist Journey
1 - https://www.infoworld.com/article/3228245/data-science/the-80-20-data-science-dilemma.html
Typically 80% of the work
Most data scientists spend only 20 percent of their time
on actual data analysis and 80 percent of their time
finding, cleaning, and reorganizing huge amounts of
data, which is an inefficient data strategy1
Eliminated or minimized with Oracle
Data Management platform becomes
combine/hybrid DM + machine learning platform
9. Albert Einstein
“If I had an hour to solve a
problem I'd spend 55
minutes thinking about the
problem and 5 minutes
thinking about solutions.”
10. Lots of Data needs to be crunched
• No time to manually sift through the data
Machine Learning has become accessible
• Anyone can be a Data Scientist
• Software and algorithms are available
• Frameworks allow for massive training with no coding
• CI/CD available for MLOps
Business use cases
- How to find value from the data
Why Machine Learning for us and why now?
11. Analytics Value vs. Maturity
Reports &
Dashboards
Data
Information
Predictions & Insights Appls with ML
Analytical Maturity
ValueofAnalytics
Diagnostic
Analysis &
Reports
Predictive /
Machine
Learning
“ML Enabled”
Applications
What Happened?
Why it Happened?
What WILL happen?
Automated ML Appls
13. ML Project Workflow
Set the business objectives
Gather compare and
clean data
Identify and extract features
(important columns) from imported data
This helps us identify the efficiency of
the algorithm
Take the input data which is also called the training
data and apply the algorithm to it
For the algorithm to function efficiently, it is
important to pick the right value for hyper parameters
(algorithm input parameters to the algorithm)
Once the training data in
the algorithm are
combined we get a model
1
2
3
4
5
14. Types of Machine Learning
Supervised Learning
Predict future outcomes with the help of
training data provided by human experts
Semi-Supervised Learning
Discover patterns within raw data and make
predictions, which are then reviewed by
human experts, who provide feedback which
is used to improve the model accuracy
Unsupervised Learning
Find patterns without any external input other
than the raw data
Reinforcement Learning
Take decisions based on past rewards for this
type of action
29. What is Workload
Automatically
check
workload for
past x mins
Decide if
workload is
abnormally
high
Highlight any
abnormal
workload
issues
Optionally run on
demand
Optionally snooze
checking of a
component
Calculated via machine learning
30. Adaptive Learning
Workload Process
Captures metrics for key
performance dimensions across 5 X
1 minute time windows
CAPTURE1
Using semi-supervised learning via
SME threshold rules, the following
models are retrained :
• Isolation Forest
• One-Class Support Vector Machine
• Local Outlier Factor
Model with highest confidence
becomes the primary, if confidence is
high enough
TRAIN2
Straight after capture, the primary model
is used to predict anomalies.
Where anomalies are identified, metrics
are compared to SME threshold rules to
identify the type of anomaly
PREDICT3
Every
5 Mins
Every
Week
Every
5 Mins
31. Prediction (Every 5 minutes)
5 X 1 min metrics captured for
each dimension & ASH report
captured for later analysis
Metrics evaluated by the primary model to
determine if there are anomalies
If there is no primary model
(i.e. <7 days of data or <=95% model confidence)
then SME rules are used for anomaly detection
Each anomaly is compared against
the SME rules to determine which
dimension it applies to
Any anomalies are raised
along with recently
captured ASH report
32. Resource usage prediction
Configurable threshold
boundary – notify Admin of
forecasts above here
Actual values
(Black)
Forecast values
(Blue line)
Upper & lower
forecast range
(light blue area)
Unusual values
(anomalies)
Future forecast
values
34. Identify Relevant Workload Metrics
• Ex: Average Active Sessions, CPU/Mem/IO Utilization
Time Series Decomposition
• Trend
• Seasonality
• Residual
Workload Seasonality Determination Locating Minimas
Optimum Window Identification and Validation
Model Generation and Training Flow
Maintenance Slot Identification
35. Maintenance window identification
START_TIME CNT
2018-04-11 15:00:00 290
2018-04-11 16:00:00 31120
2018-04-11 17:00:00 21530
2018-04-11 18:00:00 26240
2018-04-11 19:00:00 40520
2018-04-11 20:00:00 54270
2018-04-11 21:00:00 51460
2018-04-11 22:00:00 44310
2018-04-11 23:00:00 25690
START_TIME
2018-04-11 15:00:00 -0.226098
2018-04-11 16:00:00 -0.069821
2018-04-11 17:00:00 -0.350088
2018-04-11 18:00:00 -0.187483
2018-04-11 19:00:00 -0.513240
2018-04-11 20:00:00 0.019737
2018-04-11 21:00:00 0.059213
2018-04-11 22:00:00 -0.011312
2018-04-11 23:00:00 -0.179156
START_TIME
2018-04-11 15:00:00 5.669881
2018-04-11 16:00:00 10.345606
2018-04-11 17:00:00 9.977203
2018-04-11 18:00:00 10.175040
2018-04-11 19:00:00 10.609551
2018-04-11 20:00:00 10.901727
2018-04-11 21:00:00 10.848560
2018-04-11 22:00:00 10.698966
2018-04-11 23:00:00 10.153857
Current Date : 2018-05-12 15:00:00
Current Position in Seasonality : -0.22609829742533585
Best Maintenance Period in next Cycle : 2018-05-12 19:00:00
Worst Maintenance Period in next Cycle : 2018-05-13 08:00:00
Original observation data
1
Convolution filter & average
2
Calculate seasonality
3
Use seasonality to
predict best
maintenance window
4
37. Simple SQL Syntax—Statistical Comparisons (t-tests)
Compare AVE Purchase Amounts Men vs. Women Grouped_By INCOME_LEVEL
Statistical Functions
SELECT SUBSTR(cust_income_level, 1, 22) income_level,
AVG(DECODE(cust_gender, 'M', amount_sold, null)) sold_to_men,
AVG(DECODE(cust_gender, 'F', amount_sold, null)) sold_to_women,
STATS_T_TEST_INDEPU(cust_gender, amount_sold, 'STATISTIC', 'F') t_observed,
STATS_T_TEST_INDEPU(cust_gender, amount_sold) two_sided_p_value
FROM customers c, sales s
WHERE c.cust_id = s.cust_id
GROUP BY ROLLUP(cust_income_level)
ORDER BY income_level, sold_to_men, sold_to_women, t_observed;
STATS_T_TEST_INDEPU (SQL) Example;
P_Values < 05 show statistically
significantly differences in the amounts
purchased by men vs. women
38. Simple SQL Syntax—Attribute Importance - ML Model Build (PL/SQL)
OAA Model Build and Real-time SQL Apply Prediction
BEGIN
DBMS_DATA_MINING.CREATE_MODEL(
model_name => 'BUY_INSURANCE_AI',
mining_function => DBMS_DATA_MINING.ATTRIBUTE_IMPORTANCE,
data_table_name => 'CUST_INSUR_LTV',
case_id_column_name => 'cust_id',
target_column_name => 'BUY_INSURANCE',
settings_table_name => 'Att_Import_Mode_Settings');
END;
/
SELECT attribute_name, rank , attribute_value
FROM BUY_INSURANCE_AI
ORDER BY rank, attribute_name;
Model Results (SQL query)
ATTRIBUTE_NAME RANK ATTRIBUTE_VALUE
BANK_FUNDS 1 0.2161
MONEY_MONTLY_OVERDRAWN 2 0.1489
N_TRANS_ATM 3 0.1463
N_TRANS_TELLER 4 0.1156
T_AMOUNT_AUTOM_PAYMENTS 5 0.1095
A1A2A3A4 A5A6 A7
39. Key Features
Collaborative UI for data scientists
• Packaged with Autonomous Data
Warehouse Cloud
• Easy access to shared notebooks,
templates, permissions, scheduler, etc.
• SQL ML algorithms API
• Supports deployment of ML analytics
Machine Learning Notebook for Autonomous Data Warehouse Cloud
Oracle Machine Learning
43. Multiple Languages UIs Supported for End Users & Apps Development
Oracle Machine Leaning
Application DevelopersDBAs
R & Python Data Scientists “Citizen” Data ScientistsNotebook Users & DS Teams
New! New!
47. Define Problem Statement
Poorly Defined Better
Data Mining
Technique
Predict employees that leave
• Based on past employees that voluntarily left:
• Create New Attribute EmplTurnover à O/1
Predict customers that churn
• Based on past customers that have churned:
• Create New Attribute Churn à YES/NO
Target “best” customers
• Recency, Frequency Monetary (RFM) Analysis
• Specific Dollar Amount over Time Window:
• Who has spent $500+ in most recent 18 months
How can I make more $$? • What helps me sell soft drinks & coffee?
Which customers are likely to buy? • How much is each customer likely to spend?
Who are my “best customers”? • What descriptive “rules” describe “best customers”?
How can I combat fraud?
• Which transactions are the most anomalous?
• Then roll-up to physician, claimant, employee…
50. Create New Derived Attributes or “Engineered Features”
Feature Engineering
Source Attribute New Attribute/”Engineered Feature”
Date of Birth AGE
Address DISTANCE_TO_DESTINATION
COMMUTE_TIME
Call detail records (CDRs) #_DROPPED_CALLS
PERCENT_iNTERNATIONAL
Salary PERCENT_VS_PEERS
Purchases TOTALS_PER_CATEGORY (e.g. Food,
Clothing)
51. Create new derived attributes to tease more
information out of the data. For example:
• RECENCY, FREQUENCY, MONETARY
(RFM Analysis)
Create New Derived Attributes or “Engineered Features”
Feature Engineering
52. Data remains in Database
• Model building and scoring occur in-
database
• Leverage investment in Oracle IT
• Eliminate data duplication
- Eliminate separate analytical servers
Deliver enterprise-wide
“predictive” applications
Don’t move the Data
Traditional ML
Hours, Days or Weeks
Data Extraction
Data Prep &
Transformation
Data Mining
Model Building
Data Mining
Model “Scoring”
Data Prep. &
Transformation
Data Import
avings
Model “Scoring”
Embedded Data Prep
Data Preparation
Model Building
Oracle’s in-DB Machine Learning
Secs, Mins or Hours
ORACLE
AUTONOMOUS
DATABASE
53. Increasing sources of relevant data can
boost model accuracy
More Data Variety—Better Predictive Models
Model with 20 variables
Model with “Big Data” and
hundreds -- thousands of
input variables including:
• Demographic data
• Purchase POS transactional
data
• “Unstructured data”, text &
comments
• Spatial location data
• Long term vs. recent
historical behavior
• Web visits
• Sensor data
• etc.
Naïve Guess
or Random
100%
0% Population Size
Responders
Model with 75
variables
Model with 250
variables
100%
Engineered Features – Derived attributes/variable
that reflect domain knowledge—key to best models
54. First, Identify the Key Attributes That Most Influence the Target Attribute
Modeling and Machine Learning
Attribute Importance Model
55. Next, Build Predictive Models to Predict Customers who are Likely to Have Good_Credit
Modeling and Machine Learning
Split Data into Train and Test
Build and Test Classification Model
56. Test the ML model’s accuracy
• Randomly selected “hold out” sample
of data that was used to train the ML
model
• Compute Cumulative Gains, Lift,
Accuracy, etc.
• Review the attributes used in the model
and model coefficients
• Make sure the model makes sense
Next, Build Predictive Models to Predict Customers who are Likely to Have Good_Credit
Model Evaluation (Machine Learning)
Model Evaluation
57. Simple SQL Apply scripts run 100% inside the
Database for immediate ML model
deployment
Apply the Models to Predict “Best Customers”
Deployment
Model Apply/”Scoring”
60. Manage and Analyze All Your Data
Big Data SQL / R
SQL / R / Python
Object
Store
“Engineered Features”
– Derived attributes
that reflect domain
knowledge—key to
best models e.g.:
• Counts
• Totals
• Changes
over time
Boil down the Data Lake
Architecturally,
lots of options
and flexibility
61. In-Database Machine Learning
More Models
Better Models
Faster, More Secure
Less Cost
Ready to Deploy!
No Need To Extract and
Move Data
Data stays in Database
Zero time required.
No production impact.
Data Preparation and
Transformation
Accelerated with
Automatic Data Prep
No separate environment
required. Much faster data prep.
Data stays protected and secured.
Data Mining and
Model Building
SQL, R, Python
Oracle Data Miner UI
OML Notebooks
Oracle Data Miner and AutoML
greatly speed model building.
Less skill required. No coding.
No Need to Transform
Production Data
Embedded Data
Preparation
No need for second
production instance.
Model Scoring
Accelerated Via
Exadata Database Machine
Faster model validation
Easy to repeat model building as often as needed
62. • OAA (Oracle Data Mining + Oracle R Enterprise) and ORAAH combined
• OAA includes support for Partitioned Models, Transactional, Unstructured, Geo-spatial, Graph data. etc,
Oracle’s Machine Learning & Adv. Analytics Algorithms
CLASSIFICATION
• Naïve Bayes
• Logistic Regression (GLM)
• Decision Tree
• Random Forest
• Neural Network
• Support Vector Machine
• Explicit Semantic Analysis
CLUSTERING
• Hierarchical K-Means
• Hierarchical O-Cluster
• Expectation Maximization (EM)
ANOMALY DETECTION
• One-Class SVM
TIME SERIES
• State of the art forecasting using
Exponential Smoothing
• Includes all popular models
e.g. Holt-Winters with trends,
seasons, irregularity, missing data
REGRESSION
• Linear Model
• Generalized Linear Model
• Support Vector Machine (SVM)
• Stepwise Linear regression
• Neural Network
• LASSO *
ATTRIBUTE IMPORTANCE
• Minimum Description Length
• Principal Comp Analysis (PCA)
• Unsupervised Pair-wise KL Div
• CUR decomposition for row & AI
ASSOCIATION RULES
• A priori/ market basket
PREDICTIVE QUERIES
• Predict, cluster, detect, features
SQL ANALYTICS
• SQL Windows, SQL Patterns,
SQL Aggregates
FEATURE EXTRACTION
• Principal Comp Analysis (PCA)
• Non-negative Matrix Factorization
• Singular Value Decomposition (SVD)
• Explicit Semantic Analysis (ESA)
TEXT MINING SUPPORT
• Algorithms support text
• Tokenization and theme extraction
• Explicit Semantic Analysis (ESA) for
document similarity
STATISTICAL FUNCTIONS
• Basic statistics: min, max,
median, stdev, t-test, F-test,
Pearson’s, Chi-Sq, ANOVA, etc.
R PACKAGES
• CRAN R Algorithm Packages
through Embedded R Execution
• Spark MLlib algorithm integration
EXPORTABLE ML MODELS
• REST APIs for deployment
X
1
X
2
A
1
A
2
A
3
A
4
A
5
A
6
A
7
63. ANALYTICAL SQL
• SQL Windows
• SQL Aggregate functions
• LAG/LEAD functions
• SQL for Pattern Matching
• Additional approximate
query
processing: APPROX_COUNT
, APPROX_SUM,
APPROX_RANK
• Regular Expressions
• Linear regression
• ANOVA (Analysis of
variance)
• Test Distribution fit
(e.g. Normal distribution
test, Binomial test, Weibull
test, Uniform
test, Exponential
test, Poisson test, etc.)
• Statistical Aggregates (min,
max, mean, median, stdev,
mode, quantiles, plus x
sigma, minus x sigma, top n
outliers, bottom n outliers)
STATISTICAL FUNCTIONS
• Descriptive statistics
(e.g. median, stdev, mode, sum,
etc.)
• Hypothesis testing
(t-test, F-test, Kolmogorov-
Smirnov test, Mann Whitney
test, Wilcoxon Signed Ranks test
• Correlations analysis
(parametric and nonparametric
e.g.
Pearson’s test for
correlation, Spearman's rho
coefficient, Kendall's tau-b
correlation coefficient)
• Ranking functions
• Cross Tabulations with Chi-square
statistics|
Oracle’s Machine Learning & Adv. Analytics Algorithms
64. Algorithms Operate on Data
ML and AI are just “Algorithms”
Move the Algorithms; Not the Data!;
It Changes Everything!
65. Thank You
Any Questions ?
Sandesh Rao
VP AIOps for the Autonomous Database
@sandeshr
https://www.linkedin.com/in/raosandesh/
https://www.slideshare.net/SandeshRao4