Post on 29-Sep-2020
Intro to Machine Learning for Oracle Professionals
Heli Helskyaho
@helifromfinland
Copyright © Miracle Finland Oy
Graduated from University of Helsinki (Master of Science, computer science), currently a doctoral student, researcher and lecturer (databases, Big Data, Multi-model Databases, methods and tools for utilizing semi-structured data for decision making) at University of Helsinki
Worked with Oracle products since 1993, worked for IT since 1990 Data and Database! CEO for Miracle Finland Oy Oracle ACE Director, Oracle Groundbreaker Ambassador Listed as one of the TOP 100 influences on IT sector in Finland (2015, 2016, 2017, 2018, 2019) Public speaker and an author Author of the book Oracle SQL Developer Data Modeler for Database Design Mastery (Oracle Press,
2015), co-author for Real World SQL and PL/SQL: Advice from the Experts (Oracle Press, 2016)
Introduction, Heli
Copyright © Miracle Finland Oy
Copyright © Miracle Finland Oy
What is machine learning?
An important part of Artificial Intelligence (AI)
Machine learning (ML) teaches computers to learn from experience(algorithms)
Arthur Samuel, 1959: “field of study that gives computers the ability to learn without being explicitly programmed“
A systematic study of algorithms and systems that improve theirknowledge or performance with experience
Copyright © Miracle Finland Oy
Why ML? Why now?
More and more data (volume)
Different data models and formats (variety)
Loading in progress while data exploration going on (velocity)
Not all data is reliable (veracity)
We do not know what we are looking for (value, viability, variability)
Must support also non-technical users (journalists, investors, politicians,…) (visualization)
All must be done efficiently and fast and as much as possibly by machines
-> MACHINE LEARNING?
Copyright © Miracle Finland Oy
It is now possible to use machine learning
Improved technology (GPU, TPU,…)
The price for storage solutions
Existing data sets
Pre-trained models
Research!
…
Why ML? Why now?
Copyright © Miracle Finland Oy
An environment that NEEDS ML and is finally able to really use it
Why ML? Why now?
Copyright © Miracle Finland Oy
You have data!
ML cannot be performed without data
Rules and equations are
Complex (image recognition)
Constantly changing (fraud detection)
The nature of the data changes and the program must adapt (today’sspam is tomorrow’s ham) (predicting shopping trends)
When to use ML?
Copyright © Miracle Finland Oy
Spam filters
Log filters (and alarms)
Data analytics
Image recognition
Speech recognition
Medical diagnosis
Robotics
…
Real life use cases for ML
Copyright © Miracle Finland Oy
Searches for patterns and trends
Sometimes useful, sometimes not
Predicts future outcomes
Sometimes correct, sometimes not
Learns new skills
Learning takes long, did it really learn what we wanted?
…
Approximation! A sophisticated guess!
Copyright © Miracle Finland Oy
Unsupervised learning
Supervised learning
Reinforcement learning
Machine learning
Copyright © Miracle Finland Oy
Learning from unlabeled input data by finding hidden patterns or intrinsic structures in that data
Unsupervised learning
Copyright © Miracle Finland Oy
don’t have a specific goal
the target variable is unknown
are not sure what information the data contains
want to reduce the features of your data as a preprocessing for supervised learning, dimentionality reduction
Used typically when you
Copyright © Miracle Finland Oy
Clustering
Copyright © Miracle Finland Oy
Anomaly detection
Copyright © Miracle Finland Oy
The target is known
Training a model on known input and output data to predict future outputs (remember that uncertainty is always involved)
Testing the model on known input and output data to compare the prediction to the known output
Supervised learning
Copyright © Miracle Finland Oy
Classification
Copyright © Miracle Finland Oy
are two methods of pattern identification
The difference lies in the fact that
classification uses predefined classes in which objects are assigned
clustering identifies similarities between objects, which it groups according to those characteristics in common and which differentiate them from other groups of objects. These groups are called "clusters". The number of clusters is a hyperparameter.
Classification and clustering
Copyright © Miracle Finland Oy
Regression
Copyright © Miracle Finland Oy
What is deep learning?
https://towardsdatascience.com/why-deep-learning-is-needed-over-traditional-machine-learning-1b6a99177063
Copyright © Miracle Finland Oy
Computer vision (Face recognition,…)
Speech recognition
Text recognition, text processing,…
…
Needs a LOT of data and resources
Datasets, pre-trained models, transfer learning,…
Deep Learning (DL)
Copyright © Miracle Finland Oy
Convolutional Neural Networks (CNN, orConvNet)
Input
Filter
0
Pooling layers
Neural Network
Output0 (cat)1 (dog)
Output
…
…
…
Convolutional layers
Flattening
1
Copyright © Miracle Finland Oy
Inputs weights bias activation function output
X1
X2
(X1*w1)+(x2*w2)+b
∑ixiwi+b
Neurons
YW1
b
f(x)W2
Copyright © Miracle Finland Oy
Number of epochs? (One epoch is when an entire dataset is passed both forward and backward through the neural network once)
Batch size? (One epoch is divided into several smaller batches) Number of Hidden Layers and units? How many neurons in each layer? Weights? Bias? Activation function? Learning rate/step size: gradient descent? Optimizer? …
Model design, hyperparameters
Copyright © Miracle Finland Oy
The process for neural network to learn
Backpropagation/backward propagation
Layer(data
transformation)
Layer(data
transformarion)
Predictions Y’ True Targets Y
LossFunction
Loss Score
Optimizer
Weights
Weights
Input X
Weight update
Bias
Bias update
Copyright © Miracle Finland Oy
Text, voice,…
Natural Language Processing
Automatic speech recognition
Text to Speech
Machine Translation
Resume/summary of a text, …
Concerns: ”no need to learn to read anymore”
Use cases for deep learning?
https://deepai.org/machine-learning-model/text-generator
Copyright © Miracle Finland Oy
Translate
Copyright © Miracle Finland Oy
Recommender systems
produce suggestions/recommendations to assist their users in decision-making processes
Collaborative filtering (CF) recommender systems: recommendations based on decisions of other users with similar tastes
Content-based recommender systems: recommendations based on similarities of new items to those that the user liked in the past
Hybrid recommender systems: multiple approaches together
Use cases for deep learning?
Copyright © Miracle Finland Oy
Amazon
Copyright © Miracle Finland Oy
Netflix
Copyright © Miracle Finland Oy
Visual recognizion problems, Computer vision:
Image classification
Object recognizion
Object detection
Image captioning
Action classification
Object/image segmentation (separate the object from its background)
…
Use cases for deep learning?
https://towardsdatascience.com/everything-you-ever-wanted-to-know-about-computer-vision-heres-a-look-why-it-s-so-awesome-e8a58dfb641e
https://www.pyimagesearch.com/2020/06/01/opencv-social-distancing-detector/
Copyright © Miracle Finland Oy
The computer creates its own data
https://www.youtube.com/watch?v=VMp6pq6_QjI
What if data is not available?
Copyright © Miracle Finland Oy
310 000 attempts later: starting to be confident
Copyright © Miracle Finland Oy
Reinforcement learning (RL)
https://towardsdatascience.com/introduction-to-various-reinforcement-learning-algorithms-i-q-learning-sarsa-dqn-ddpg-72a5e0cb6287
Copyright © Miracle Finland Oy
Very good with games
AlphaGo, AlphaGo Zero
https://deepmind.com/blog/article/alphago-zero-starting-scratch
BUT is it good with everything else?
Needs a lots of try and error…learns slower than humans…
How about teaching the car to park on a real parking lot? Maybe not…
Reinforcement learning (RL)
Copyright © Miracle Finland Oy
A lot!
Let’s see some examples…
What does Oracle offer for ML?
Copyright © Miracle Finland Oy
Oracle technologies for machine learning
Copyright © Miracle Finland Oy
Not part of the free offerings (but can be used with the credits)
There is also a desktop version: Oracle Analytics Desktop
Excellent tool for understanding the data and preparing it for ML
Oracle Analytics Cloud
Copyright © Miracle Finland Oy
Oracle Analytics Cloud (OAC)
Copyright © Miracle Finland Oy
Plenty of data source candidates
Copyright © Miracle Finland Oy
Project, data set, data flow, sequence
Copyright © Miracle Finland Oy
Prepare, Visualize, Narrate
Copyright © Miracle Finland Oy
OAC recommends enrichments and transformations to the data
augmented data enrichment sensitive data detection, geographic, or demographic enrichments
transformations dividing the name column into firstname and lastname columns
removing the social security number from the dataset
…
You can add your own transformations or enrichments
-> Preparation scripts
Prepare
Copyright © Miracle Finland Oy
Explain
Copyright © Miracle Finland Oy
Oracle Analytics Cloud
Copyright © Miracle Finland Oy
Create data flows
Copyright © Miracle Finland Oy
Save the result to a database
Copyright © Miracle Finland Oy
Visualize
Copyright © Miracle Finland Oy
Narrate
Copyright © Miracle Finland Oy
Use the ML models created with OML4SQL
Copyright © Miracle Finland Oy
Comes with the database
Free to use
OML4SQL
Copyright © Miracle Finland Oy
DBMS_PREDICTIVE_ANALYTICS
Routines for performing predictive analytics
DBMS_DATA_MINING_TRANSFORMING
Routines for transforming the data for mining models
DBMS_DATA_MINING
Routines for creating and managing mining models
OML4SQL
Copyright © Miracle Finland Oy
Can be used with any tool that can call PL/SQL packages
BEGIN
DBMS_PREDICTIVE_ANALYTICS.EXPLAIN(
data_table_name => 'beer_training_data',
explain_column_name => 'overall',
result_table_name => 'beer_explain');
END;
/
OML4SQL
Copyright © Miracle Finland Oy
SQL Developer, GUI
Copyright © Miracle Finland Oy
OCI Data Science
Copyright © Miracle Finland Oy
Project
Copyright © Miracle Finland Oy
Notebook session
Copyright © Miracle Finland Oy
Notebook session
Copyright © Miracle Finland Oy
Notebook session
Copyright © Miracle Finland Oy
Notebook
Copyright © Miracle Finland Oy
Python library included into the Oracle Cloud Infrastructure Data Science service
offers a friendly user interface with objects and methods that describe the steps involved in the lifecycle of machine learning models
Oracle Accelerated Data Science (ADS) SDK
Copyright © Miracle Finland Oy
Exploratory data analysis
Automatic data visualization
Feature selection
Feature engineering
Algorithm selection
Feature encoding
Hyperparameter tuning
Model evaluation
Model interpretation and explainablility…
ADS, Oracle AutoML engine
Copyright © Miracle Finland Oy
ML is here now and it is the future
Oracle offers several tools for ML
Those tools can be used separately or together
Knowing Oracle technology gives you a headstart
It is all about good quality data
SQL, PL/SQL, R, Python, …
No excuses! Start learning, now!
Conclusions
THANK YOU!QUESTIONS?
Email: heli@miracleoy.fi
Twitter: @HeliFromFinland
Blog: Helifromfinland.com