0% found this document useful (0 votes)
7 views48 pages

ML 1

AA

Uploaded by

Rana Khizar
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)
7 views48 pages

ML 1

AA

Uploaded by

Rana Khizar
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/ 48

INTRODUCTION TO

MACHINE LEARNING
Course Introduction
▪ This course introduces principles, algorithms, and applications of machine learning from the
point of view of modeling and prediction. It includes formulation of learning problems and
concepts of representation, over-fitting, and generalization. These concepts are exercised in
supervised learning and reinforcement learning, with applications to images and to temporal
sequences.
▪ Recommended prerequisites include: computer programming with Python, basic linear
algebra including matrix manipulation, and multivariate calculus including gradients.
▪ “Learning is any process by which a system improves performance from
experience.” - Herbert Simon
▪ Definition by Tom Mitchell (1998): Machine Learning is the study of algorithms that
• improve their performance P
• at some task T
• with experience E.
A well-defined learning task is given by <P,T,E>.
▪ Human expertise does not exist (navigating on Mars)
▪ Humans can’t explain their expertise (speech recognition)
▪ Models must be customized (personalized medicine)
▪ Models are based on huge amounts of data (genomics)

▪ Learning isn’t always useful:


▪ There is no need to “learn” to calculate payroll
▪ Recognizing patterns:
– Facial identities or facial expressions
– Handwritten or spoken words
– Medical images
▪ Generating patterns:
– Generating images or motion sequences
▪ Recognizing anomalies:
– Unusual credit card transactions
– Unusual patterns of sensor readings in a nuclear power plant
▪ Prediction:
– Future stock prices or currency exchange rates
▪ Web search
▪ Computational biology
▪ Finance
▪ E-commerce
▪ Space exploration
▪ Robotics
▪ Information extraction
▪ Social networks
▪ Debugging software
▪ [Your favorite area]
Improve on task T, with respect to performance metric P, based on experience E
▪ Supervised (inductive) learning
– Given: training data + desired outputs (labels)
▪ Unsupervised learning
– Given: training data (without desired outputs)
▪ Semi-supervised learning
– Given: training data + a few desired outputs
▪ Reinforcement learning
– Rewards from sequence of actions
▪ Given a sequence of states and actions with (delayed) rewards, output a policy
– Policy is a mapping from states à actions that tells you what to do in a given state
▪ Examples:
– Credit assignment problem
– Game playing
– Robot in a maze
– Balance a pole on your hand
▪ Choose the training experience
▪ Choose exactly what is to be learned – i.e. the target function
▪ Choose how to represent the target function
▪ Choose a learning algorithm to infer the target function from the experience
▪ We generally assume that the training and test examples are independently drawn
from the same overall distribution of data
– We call this “i.i.d” which stands for “independent and identically distributed”
▪ If examples are not independent, requires collective classification
▪ If test distribution is different, requires transfer learning
▪ Tens of thousands of machine learning algorithms
– Hundreds new every year
▪ Every ML algorithm has three components:
– Representation
– Optimization
– Evaluation
▪ Numerical functions
– Linear regression
– Neural networks
– Support vector machines
▪ Symbolic functions
–Decision trees
– Rules in propositional logic
– Rules in first-order predicate logic
▪ Instance-based functions
– Nearest-neighbor
– Case-based
▪ Probabilistic Graphical Models
– Naïve Bayes
– Bayesian networks
– Hidden-Markov Models (HMMs)
– Probabilistic Context Free Grammars (PCFGs)
– Markov networks
▪ Gradient descent
– Perceptron
– Backpropagation
▪ Dynamic Programming
– HMM Learning
– PCFG Learning
▪ Divide and Conquer
– Decision tree induction
– Rule learning
▪ Evolutionary Computation
– Genetic Algorithms (GAs)
– Genetic Programming (GP)
– Neuro-evolution
▪ Learning can be viewed as using direct or indirect experience to approximate a
chosen target function.
▪ Function approximation can be viewed as a search through a space of hypotheses
(representations of functions) for one that best fits a set of training data.
▪ Different learning methods assume different hypothesis spaces (representation
languages) and/or employ different search techniques.
▪ We will be using linear algebra in many places throughout this course to represent and
operate on information. Our purpose here is to check your understanding of a few key
concepts and skills you'll need.
▪ For the time being we'll be using Python lists to represent vectors and arrays. Once we start,
we'll be using the Python numpy module, but do not assume you know anything about
numpy below.
▪ In this section, we'll consider n-dimensional column vectors and m-dimensional row vectors

with the subscript indicating the i-th and j-th element within the vector, respectively. In both
cases, we'll represent column and row vectors for now as Python lists, so will also be explicit
about whether a vector is a row vector or a column vector i.e. we’ll be using c for column vector
and r for row vector.
▪ You should be familiar with vector dot products of vectors. For example, given two column
vectors a and b, we might be interested in the dot product a⋅b of those two vectors.
2-D ARRAYS AND MATRICES
▪ For now, we'll represent two-dimensional arrays (or matrices) in Python as a list of lists, i.e., a
list of rows.

▪ Thus the matrix above is an n x m dimensional matrix and will have a Python representation
as [[1,2,3],[-2,3,7]]
▪ In the related problems ahead, when asked for the "Python value" of a given matrix
multiplication or other operation, enter a Python list if the result is a vector; enter a Python
list of lists (list of rows) if the result is a two-dimensional matrix (having more than one rows
or columns); enter a single number if the result is a scalar; and if the expression does not
result in a valid vector or matrix, enter the Python value None.
2-D ARRAYS AND MATRICES
▪ In addition to M as defined above, assume we have a vector
2-D ARRAYS AND MATRICES
2-D ARRAYS AND MATRICES
DIFFERENTIAL CALCULUS
(GRADIENTS)
▪ Let f be a function that takes a vector as input and returns the
scalar value 1⋅v1​+2⋅v2​+3⋅v3​+⋯+n⋅vn
▪ Given two lists of numbers, write a procedure that returns a list of the element-wise sum of
the number in those two lists. In the following, no imports should be used.
▪ Given two column vectors (each represented as a list of numbers), write a procedure dot that
returns the (scalar) dot product of two input vectors, each represented as a list of numbers.
▪ Write a function add_n that takes a single numeric argument n, and returns a
function. The returned function should take a vector v as an argument and return a
new vector with the value for n added to each element of vector v. For example,
add_n(10)([1, 5, 3]) should return [11, 15, 13].

You might also like