ML 1
ML 1
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)
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].