Chapter 1

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 36

Welcome

A I F U N D A M E N TA L S

Nemanja Radojkovic
Senior Data Scientist
About me
MSc in Signal Processing and Control Systems Design.

5 years of applying AI to solve real-world business problems across a range of industries.

Specialties: predictive control, text mining and computer vision.

AI FUNDAMENTALS
What is all the AI fuss about?
Just top 3 AI-related news on Friday, September 6th 2019:

AI FUNDAMENTALS
AI = Arti cial Intelligence

AI FUNDAMENTALS
The Beginnings
Alan Turing John McCarthy

Organized the rst AI conference in 1956.


Helped crack the Enigma machine in WWII
Created the Lisp programming language.
Created the "Turing test"

AI FUNDAMENTALS
AI FUNDAMENTALS
The revolution

AI FUNDAMENTALS
Alpha Go by Google

AI FUNDAMENTALS
Autonomous cars

AI FUNDAMENTALS
Art

AI FUNDAMENTALS
What is Intelligence?
Intelligence is:

... the ability to reason, plan, solve problems, think abstractly, comprehend complex ideas, learn
quickly and learn from experience.

1 Source: http://www1.udel.edu/educ/gottfredson/reprints/1997mainstream.pdf

AI FUNDAMENTALS
What is AI?
General AI (aka "strong AI")
Still only science- ction

Narrow AI (aka "weak AI")


99% of AI

One-trick horse

a.k.a. Machine Learning

AI FUNDAMENTALS
AI FUNDAMENTALS
Machine Learning + Python = Perfect match
simple and beautiful

exible
dynamically typed and allowing both
object-oriented and functional programming

versatile
used for crunching data, making websites,
programming toys...

the most popular language among Data


Scientists and Data Engineers.

AI FUNDAMENTALS
To in nity and
beyond!
A I F U N D A M E N TA L S
All models are wrong
but some are useful
A I F U N D A M E N TA L S

Nemanja Radojkovic
Senior Data Scientist
What is a model?
A simpli ed representation of a process or a system

Complexity and accuracy requirements de ned by the application

AI FUNDAMENTALS
How do we build one?
1. De ne the problem

2. Collect the data

3. Con gure & t the model

4. Use it!

AI FUNDAMENTALS
De ne the problem
Poor problem de nition = highway to disaster

Key questions

1. What is the pain point

2. How do we create value by solving this problem? (value proposition)

3. How do we know if we've succeeded or failed?

AI FUNDAMENTALS
Con gure the model
1. Specify the technical problem

2. Select the model type

3. Select the speci c algorithm

Example

model = DecisionTreeClassifier()

AI FUNDAMENTALS
Fit the model
Fitting = mathematical optimization

Ingredients

1. Optimization algorithm

2. Cost function

3. Data

Common Python syntax

model.fit(inputs, outputs)

AI FUNDAMENTALS
Parameters and hyperparameters
1. Model parameters
learned at the tting time, fast, automated

2. Hyperparameters
de ned prior to tting, slow and costly
optimization process

AI FUNDAMENTALS
Reality check

Danger: Over tting

AI FUNDAMENTALS
Performance evaluation
Holdout train/test splitting

X_train, X_test, y_train, y_test = train_test_split(inputs, outputs, test_size=0.4)

Model tting

model.fit(X_train, y_train)

Model testing and evaluation

y_predicted = model.predict(X_test)
accuracy = accuracy_score(y_test , y_predicted)

AI FUNDAMENTALS
Let's dive in!
A I F U N D A M E N TA L S
Three avors of
Machine Learning
A I F U N D A M E N TA L S

Nemanja Radojkovic
Senior Data Scientist
Supervised Learning
Most used avor of Machine Learning

Applications
Performance prediction

Purchase behavior modeling

Risk modeling

AI FUNDAMENTALS
Regression vs. Classi cation
Regression Classi cation

AI FUNDAMENTALS
Supervised algorithms
Regression (quantities) Classi cation (categories)

from sklearn.linear_model \ from sklearn.linear_model \


import (LinearRegression, import LogisticRegression
Lasso,
Ridge) from sklearn.naive_bayes \
import GaussianNB
from statsmodels.tsa.arima_model \
import ARIMA from sklearn.tree \
import DecisionTreeClassifier

from sklearn.ensemble \
import RandomForestClassifier

AI FUNDAMENTALS
Unsupervised Learning
Unlabeled data.

No labels => No supervision.

Only input relationships examined.

AI FUNDAMENTALS
Unsupervised learning: Clustering
   

   

Clustering ? Classi cation!

Classi cation = Model learns existing groups.

Clustering = Model discovers groups on its own.

AI FUNDAMENTALS
Unsupervised learning: Anomaly detection

AI FUNDAMENTALS
Unsupervised learning: Dimensionality reduction
 

AI FUNDAMENTALS
Unsupervised algorithms
Clustering Dimensionality reduction

# K-Means clustering # Principal Component Analysis


from sklearn.cluster import KMeans from sklearn.decomposition import PCA

# Mean-shift clustering # Manifold learning


from sklearn.cluster import MeanShift from sklearn.manifold import Isomap

# DBSCAN
Anomaly detection
from sklearn.cluster import DBSCAN

# Isolation forests
from sklearn.ensemble \
import IsolationForest

AI FUNDAMENTALS
Reinforcement learning
 

"Learning by doing"

"Reward and punishment"

AI FUNDAMENTALS
Recap time!
A I F U N D A M E N TA L S

You might also like