0% found this document useful (0 votes)
38 views47 pages

ML Introduction

This would be treated as a classification problem, since the possible outputs (Sunny, Cloudy, Rainy) are a small number of discrete categories rather than continuous values. The goal of classification is to predict which category or class an example belongs to.

Uploaded by

Its Moe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views47 pages

ML Introduction

This would be treated as a classification problem, since the possible outputs (Sunny, Cloudy, Rainy) are a small number of discrete categories rather than continuous values. The goal of classification is to predict which category or class an example belongs to.

Uploaded by

Its Moe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 47

Machine Learning

Introduction
Grading
• Attendance 5%
• Programming assignments – 20%
• Midterm exam- 25%
• Project – 20%
• Final exam – 30%
Prerequisites: Students entering the class are expected to have a knowledge of
probability and statistics, calculus, linear algebra, algorithm theory and
programming
Topics
• Introduction
• Linear Regression with One Variable
• Linear Regression with Multiple Variables
• Logistic Regression
• Regularization
• Neural Networks: Representation
• Neural Networks: Learning
• Advice for Applying Machine Learning
• Machine Learning System Design
• Support Vector Machines
• Unsupervised Learning
• Dimensionality Reduction
• Anomaly Detection
• Recommender Systems
• Large Scale Machine Learning
• Deep learning
• Recurrent Neural Networks
• Hidden Markov Models
Textbooks
• Andreas C. Müller and Sarah Guido. Introduction to Machine Learning
with Python: A Guide for Data Scientists.2016.
• Bishop C, Pattern Recognition and Machine Learning, 2007
• Mitchell T, Machine Learning, McGraw-Hill, 1997
• Sebastian Raschka. Python Machine Learning. 2015
• Rogers S and Girolami M. A first course in Machine Learning. CRC
Press, 2011
• Barber D, Bayesian Reasoning and Machine Learning, 2012
• Duda, Hart and Stork, Pattern Classification, Wiley-interscience
Machine Learning Libraries
Scikit learn: Python Machine Learning
Library
•Scikit-learn Homepage http://scikit-learn.org
•Scikit-learn User Guide http://scikit-learn.org/stable/user_guide.html
•Scikit-learn API reference http://scikit-learn.org/stable/modules/classes.html
•In Python, we typically import classes and functions we need like this:
from sklearn.model_selection import train_test_split
from sklearn.tree import DecisionTreeClassifier
SciPy Library: Scientific
Computing Tools
http://www.scipy.org/

• Provides a variety of useful scientific computing tools, including


statistical distirbutions, optimization of functions, linear algerba, and
a variety of specialized mathematical functions.
• With scikit-learn, it provides support for sparse matrices, a way to
store large tables that consist mostly of zeros.
• Example import: import scipy as sp
NumPy: Scientific Computing
Library
http://www.numpy.org
/

• Provides fundamental multi-dimensional arrays.


• Typically, data that is input to scikit-learn will be in the form of a
NumPy array.
• Example impport: import numpy as np
Pandas: Data Manipulation and
Analysis
http://pandas.pydata.org/

• Provides key data structures like DataFrame


• Also, support for reading/writing data in different formats
• Example import: import pandas as pd
Matplotlib and other plotting
libraries
http://matplotlib.org/

• We typically use matplotlib’s pyplot module:


import matplotlib.pyplot as plt
• We also sometimes use the seaborn visualization library (
http://seaborn.pydata.org/)
import seaborn as sn
• And sometimes the graphviz plotting library: import
graphviz
Machine Learning
(Online courses)
via Coursera via Coursera

via Udacity via edX

via edX via Coursera

via Coursera via Udacity


A Few Quotes
• “A breakthrough in machine learning would be worth
ten Microsofts”
(Bill Gates, Chairman, Microsoft)
• “Machine learning is the next Internet”
(Tony Tether, Director, DARPA)
• Machine learning is the hot new thing”
(John Hennessy, President, Stanford)
• “Web rankings today are mostly a matter of machine learning”
(Prabhakar Raghavan, Dir. Research, Yahoo)
• “Machine learning is going to result in a real revolution”
(Greg Papadopoulos, Former CTO, Sun)
• “Machine learning is today’s discontinuity”
(Jerry Yang, Founder, Yahoo)
• “Machine learning today is one of the hottest aspects of computer science”
(Steve Ballmer, CEO, Microsoft)
Traditional Programming

Data
Computer Output
Program
Machine Learning

Data
Computer Program
Output
Machine Learning definition
• Arthur Samuel (1959). Machine Learning: Field of study that
gives computers the ability to learn without being explicitly
programmed.

• Herbert Simon. Learning is any process by which a system


improves performance from experience.
• Machine Learning is concerned with computer
programs that automatically improve their
performance through experience.
Machine Learning definition
• Tom Mitchell (1998). A computer program is said to learn from
experience E with respect to some task T and some
performance measure P, if its performance on T, as measured
by P, improves with experience E.
Key types of Machine Learning
problems

Supervised machine learning: Learn to predict target values from labelled data/

• Classification (target values are discrete classes)


• Regression (target values are continuous values)

Unsupervised machine learining: Find structure in unlabeled data


• Find groups of similar instances in the data (clusterin)
• Finding unusual patterns (outlier detection)
Supervised learning Unsupervised learning

Training set: Training set:


Genes

Individuals

[Source: Su-In Lee, Dana Pe’er, Aimee Dudley, George Church, Daphne Koller]
Applications of clustering

Market segmentation Social network analysis

Image credit: NASA/JPL-Caltech/E. Churchwell (Univ. of Wisconsin, Madison)

Organize computing clusters Astronomical data analysis


Supervised or Unsupervised?
• Examine the statistics of two football teams, and predicting which
team will win tomorrow's match (given historical data of teams'
wins/losses to learn from).

• This can be addressed using supervised learning, in which


we learn from historical records to make win/loss
predictions.
Supervised or Unsupervised?
• In farming, given data on crop yields over the last 50 years, learn to
predict next year's crop yields.

• This can be addresses as a supervised learning problem,


where we learn from historical data (labeled with historical
crop yields) to predict future crop yields.
Supervised or Unsupervised?
• Take a collection of 1000 essays written on the Azerbaijan Economy, and
find a way to automatically group these essays into a small number of
groups of essays that are somehow "similar" or "related".

• This is an unsupervised learning/clustering problem.


Supervised or Unsupervised?
• Given data on how 1000 medical patients respond to an
experimental drug (such as effectiveness of the
treatment, side effects, etc.), discover whether there are
different categories or "types" of patients in terms of
how they respond to the drug, and if so what these
categories are.
• This can be addressed using an unsupervised learning, clustering,
algorithm, in which we group the 1000 patients into different
clusters based on their responses to the drug
Supervised or Unsupervised?
• Given 50 articles written by male authors, and 50 articles written by
female authors, learn to predict the gender of a new manuscript's
author (when the identity of this author is unknown).
• This can be addressed as a supervised learning,
classification, problem, where we learn from the labeled data
to predict gender.
Supervised or Unsupervised?
• Given a large dataset of medical records from patients suffering from
heart disease, try to learn whether there might be different clusters of
such patients for which we might tailor separate treatments.
• This can be addressed using an unsupervised learning,
clustering, algorithm, in which we group patients into
different clusters.
Housing price prediction.
400

300

Price ($)
200
in 1000’s
100

0
0 500 1000 1500 2000 2500

Size in feet2

Supervised Learning Regression: Predict continuous


“right answers” given valued output (price)
Classification or Regression?
• The amount of rain that falls in a day is usually measured in either
millimeters (mm) or inches. Suppose you use a learning algorithm to
predict how much rain will fall tomorrow. Would you treat this as a
classification or a regression problem?
• Regression is appropriate when we are trying to predict a continuous-
valued output, such as the amount of rainfall measured in inches or
mm.
Classification or Regression?
• Suppose you are working on stock market prediction, Typically tens of millions of shares of
Microsoft stock are traded (i.e., bought/sold) each day. You would like to predict the number of
Microsoft shares that will be traded tomorrow. Would you treat this as a classification or a
regression problem?

• Classification is appropriate when we are trying to predict one of a small number of discrete-
valued outputs. Even though the number of shares traded is technically discrete-valued (i.e., an
integer), it would be more natural to treat it as a continuous value
• Regression is appropriate when we are trying to predict a continuous-valued output, since as the
price of a stock (similar to the housing prices example in the lectures).
Classification or Regression?
• Suppose you are working on weather prediction, and your weather
station makes one of three predictions for each day's weather: Sunny,
Cloudy or Rainy. You'd like to use a learning algorithm to predict
tomorrow's weather. Would you treat this as a classification or a
regression problem?
• Classification is appropriate when we are trying to predict one of a
small number of discrete-valued outputs, such as whether it is Sunny
(which we might designate as class 0), Cloudy (say class 1) or Rainy
(class 2).
Representation
• Decision trees
• Sets of rules / Logic programs
• Instances
• Graphical models (Bayes/Markov nets)
• Neural networks
• Support vector machines
• Model ensembles
• Etc.
Evaluation
• Accuracy
• Precision and recall
• Squared error
• Likelihood
• Posterior probability
• Cost / Utility
• Margin
• Entropy
• K-L divergence
• Etc.
Optimization
• Combinatorial optimization
– E.g.: Greedy search
• Convex optimization
– E.g.: Gradient descent
• Constrained optimization
– E.g.: Linear programming
The machine learning framework

y = f(x)
output prediction feature
function
• Training: given a training set of examples, estimate the prediction
function f by minimizing the prediction error on the training set
• Testing: apply f to a never before seen test example x and output
the predicted value y = f(x)

Slide credit: L. Lazebnik

You might also like