Introduction to Algorithms / Algorithms I Lecturer: Michael Dinitz Topic: Intro to Learning Theory Date: 12/8/16

Similar documents
An Algorithms-based Intro to Machine Learning

Online Learning, Mistake Bounds, Perceptron Algorithm

1 Learning Linear Separators

Computational Learning Theory

A Course in Machine Learning

Computational Learning Theory

1 Learning Linear Separators

COS 511: Theoretical Machine Learning. Lecturer: Rob Schapire Lecture #5 Scribe: Allen(Zhelun) Wu February 19, ). Then: Pr[err D (h A ) > ɛ] δ

Web-Mining Agents Computational Learning Theory

Part of the slides are adapted from Ziko Kolter

2 Upper-bound of Generalization Error of AdaBoost

Machine Learning, Midterm Exam: Spring 2008 SOLUTIONS. Q Topic Max. Score Score. 1 Short answer questions 20.

Introduction to Machine Learning

1 Overview. 2 Learning from Experts. 2.1 Defining a meaningful benchmark. AM 221: Advanced Optimization Spring 2016

Computational Learning Theory. Definitions

Weighted Majority and the Online Learning Approach

Computational Learning Theory - Hilary Term : Introduction to the PAC Learning Framework

Algorithms, Games, and Networks January 17, Lecture 2

6.045: Automata, Computability, and Complexity (GITCS) Class 17 Nancy Lynch

1 Maintaining a Dictionary

Hypothesis testing I. - In particular, we are talking about statistical hypotheses. [get everyone s finger length!] n =

Computational Learning Theory: PAC Model

1 The Probably Approximately Correct (PAC) Model

Lecture 5: Efficient PAC Learning. 1 Consistent Learning: a Bound on Sample Complexity

Lecture 8. Instructor: Haipeng Luo

Introduction to Statistical Learning Theory

Classification: The PAC Learning Framework

Lecture 25 of 42. PAC Learning, VC Dimension, and Mistake Bounds

COMPUTATIONAL LEARNING THEORY

Lecture 7: Passive Learning

1 Review of The Learning Setting

Lecture 8: Decision-making under total uncertainty: the multiplicative weight algorithm. Lecturer: Sanjeev Arora

CS 6375: Machine Learning Computational Learning Theory

Introduction to Computational Learning Theory

Quadratic Equations Part I

0.1 Motivating example: weighted majority algorithm

Lecture 5. 1 Review (Pairwise Independence and Derandomization)

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Matroids and Greedy Algorithms Date: 10/31/16

An analogy from Calculus: limits

Introduction to Bayesian Learning. Machine Learning Fall 2018

CS340 Machine learning Lecture 4 Learning theory. Some slides are borrowed from Sebastian Thrun and Stuart Russell

CS261: A Second Course in Algorithms Lecture #18: Five Essential Tools for the Analysis of Randomized Algorithms

Introduction to Machine Learning

Online Learning with Experts & Multiplicative Weights Algorithms

Computational Learning Theory

12 Statistical Justifications; the Bias-Variance Decomposition

LECTURE 15: SIMPLE LINEAR REGRESSION I

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: NP-Completeness I Date: 11/13/18

PAC Learning. prof. dr Arno Siebes. Algorithmic Data Analysis Group Department of Information and Computing Sciences Universiteit Utrecht

Final Review Sheet. B = (1, 1 + 3x, 1 + x 2 ) then 2 + 3x + 6x 2

10.1 The Formal Model

Descriptive Statistics (And a little bit on rounding and significant digits)

ICML '97 and AAAI '97 Tutorials

1 Active Learning Foundations of Machine Learning and Data Science. Lecturer: Maria-Florina Balcan Lecture 20 & 21: November 16 & 18, 2015

Hybrid Machine Learning Algorithms

On the efficient approximability of constraint satisfaction problems

Foundations of Machine Learning and Data Science. Lecturer: Avrim Blum Lecture 9: October 7, 2015

( )( b + c) = ab + ac, but it can also be ( )( a) = ba + ca. Let s use the distributive property on a couple of

(x 1 +x 2 )(x 1 x 2 )+(x 2 +x 3 )(x 2 x 3 )+(x 3 +x 1 )(x 3 x 1 ).

Nondeterministic finite automata

TTIC An Introduction to the Theory of Machine Learning. Learning from noisy data, intro to SQ model

Lecture 4: Constructing the Integers, Rationals and Reals

Exam Question 10: Differential Equations. June 19, Applied Mathematics: Lecture 6. Brendan Williamson. Introduction.

CS261: A Second Course in Algorithms Lecture #11: Online Learning and the Multiplicative Weights Algorithm

NP-Completeness I. Lecture Overview Introduction: Reduction and Expressiveness

Polynomial time Prediction Strategy with almost Optimal Mistake Probability

Classification: The rest of the story

Does Unlabeled Data Help?

One sided tests. An example of a two sided alternative is what we ve been using for our two sample tests:

Lecture Learning infinite hypothesis class via VC-dimension and Rademacher complexity;

IFT Lecture 7 Elements of statistical learning theory

b + O(n d ) where a 1, b > 1, then O(n d log n) if a = b d d ) if a < b d O(n log b a ) if a > b d

One-to-one functions and onto functions

CS Communication Complexity: Applications and New Directions

SVAN 2016 Mini Course: Stochastic Convex Optimization Methods in Machine Learning

Notes 11: OLS Theorems ECO 231W - Undergraduate Econometrics

Lecture 2 Machine Learning Review

Computational Learning Theory

Dan Roth 461C, 3401 Walnut

Week 2: Defining Computation

appstats27.notebook April 06, 2017

CS 301. Lecture 18 Decidable languages. Stephen Checkoway. April 2, 2018

Computational learning theory. PAC learning. VC dimension.

Bayesian Learning. Artificial Intelligence Programming. 15-0: Learning vs. Deduction

The Boosting Approach to. Machine Learning. Maria-Florina Balcan 10/31/2016

(Refer Slide Time: 0:21)

Discrete Structures Proofwriting Checklist

CS 124 Math Review Section January 29, 2018

Regression, part II. I. What does it all mean? A) Notice that so far all we ve done is math.

Learning Theory: Basic Guarantees

Boosting: Foundations and Algorithms. Rob Schapire

Chapter 27 Summary Inferences for Regression

Math101, Sections 2 and 3, Spring 2008 Review Sheet for Exam #2:

Hypothesis Testing and Computational Learning Theory. EECS 349 Machine Learning With slides from Bryan Pardo, Tom Mitchell

CS 6820 Fall 2014 Lectures, October 3-20, 2014

Uncertainty. Michael Peters December 27, 2013

Generalization, Overfitting, and Model Selection

Administration. CSCI567 Machine Learning (Fall 2018) Outline. Outline. HW5 is available, due on 11/18. Practice final will also be available soon.

CSCI-567: Machine Learning (Spring 2019)

THE VAPNIK- CHERVONENKIS DIMENSION and LEARNABILITY

Transcription:

600.463 Introduction to Algorithms / Algorithms I Lecturer: Michael Dinitz Topic: Intro to Learning Theory Date: 12/8/16 25.1 Introduction Today we re going to talk about machine learning, but from an algorithms point of view. Machine learning is a pretty broad and interdisciplinary field, including ideas from AI, statistics, and theoretical computer science. All of these are important ingredients, but we re going to focus on machine learning from a TCS point of view. This means in particular that we re going to focus on provable guarantees and we ll try to make our analyses as worst-case as possible, as opposed to more AI or stats-based points of view where the focus is on making probabilistic assumptions and then designing algorithms that seem to work well (either provably or in practice). 25.2 Concept Learning The following basic problem arises often in machine learning: there is some unknown set, and we are given a sample of some elements and told whether or not each element is in the set (i.e. we are given labeled data). From this data, we want to produce a good prediction rule (a hypothesis) for future data. The paradigmatic example of this problem is spam categorization. We want a computer program to help us decide which emails are spam and which are important. We can assume that each email is represented by n features (e.g., return address, keywords, size, etc.). Then we are given a sample S of emails which have already been labeled as spam or not spam, and are asked to provide a rule to use in the future. For example, our input set S might look like the following. sales size Mr. bad spelling known-sender spam? Y N Y Y N Y N N N Y Y N N Y N N N Y Y N N N Y N N N Y N Y N Y N N Y N Y N N Y N N N N Y N Y N Y Given this data, a reasonable hypothesis might be predict spam if unknown-sender AND (size OR sales). In general, when we are given this kind of question there are two big questions, which are related but distinct. First, how can we automatically generate good hypotheses from the data? It might be a nontrivial computational problem even to find a hypothesis that works on S! Second, how 1

confident are we that our hypothesis will do well in the future? This is some kind of confidence bound or sample complexity bound for a given learning algorithm, how much data do we need to see before we can make a guarantee about the future? Let s begin to formalize this. We are given a sample set S = {(x 1, y 1 ),... (x m, y m )}, where the examples x i are drawn from some distribution D and the labels y i are produced by some (unknown) target function f, i.e. y i = f(x i ) for each i [m]. Our algorithm does some kind of optimization over S to produce a hypothesis h, and the goal is to do well on the same distribution D. In other words, we want to create an h so that Pr x D [h(x) f(x)] ɛ. We call ɛ the error of h (with respect to D). 25.2.1 Decision Lists Let s do an example: learning a decision list. A decision list is a function which is essentially one long if/elseif chain, where the first if which is satisfied determines what to return. So, for example, if x is a binary vector then a decision list might be something like if x 1 = 1 then return 0; otherwise if x 4 = 1 then return 1; otherwise if x 2 = 0 return 1; otherwise return 0. The important features of this are that it doesn t branch (i.e. it s a chain and not a tree), and each if condition looks at just one coordinate. So suppose that our target function f is a decision list (maybe we have some good reason external to the formalization to suspect that it might be a DL). In order to learn f, we need to do two things. First, we obviously need a way of finding a consistent decision list for our sample S (note that one must exist since we are assuming that f is a DL). But now since we re doing machine learning, we need to also make a second guarantee: we want to say that whatever DL we find for S is actually a good DL for the whole distribution D. In other words, we want to make a guarantee about the future. We can do this by proving that if S is reasonable, then Pr[exists consistent DL h with err(h) > ɛ] < δ. Thus the h that we find, since it will be consistent with S, will have error at most ɛ with probability at least 1 δ. This is known as the PAC model, for probably approximately correct, and is due to Valiant in a seminal paper A theory of the learnable. In general, we have the following definition. This isn t totally formal or correct, but will suffice for this class. Definition 25.2.1 Let X be a collection of instances (for example, X = {0, 1} n ). A concept is a boolean function h : X {0, 1} (e.g. a decision list), and a concept class H is a collection of concepts (e.g the set of all decision lists). Let m : R 2 R. We say that H is PAC-learnable with sample complexity m(ɛ, δ) there is an algorithm A where the following properties hold for every concept f H: 1. The input of A is 0 < ɛ < 1/2 and 0 < δ < 1/2 and a set S = {(x 1, y 1 ),..., (x m(ɛ,δ), y m(ɛ,δ) )} where y i = f(x i ) for all i. 2

2. A outputs a concept h such that h has error at most ɛ. More formally, for any distribution D over X, if S was obtained by choosing each x i independently from D then [ ] Pr Pr [h(x) f(x)] ɛ 1 δ. S x D Let s prove that decision lists are PAC-learnable with reasonable sample complexity. First, we need an algorithm that generates a DL consistent with S (assuming that one exists). This is reasonably straightforward. We start out with the full list, and find an if-then rule consistent with the data and satisfied by at least one example. This can be done efficiently since there are at most 4n possible if conditions, so we can just check each one. We then put this condition at the bottom of the list so far, and cross off the examples it covered. We repeat until no examples remain. If this algorithm fails, i.e. if at some point we cannot find a consistent if rule, then this clearly means that there is no DL consistent with the remaining data and thus no DL consistent with the original data. Since we are assuming that f is a DL, this can t happen. So now we have a hypothesis DL. Why do we expect it to do well in the future? Consider some DL h with error more than ɛ that we re worried about. Suppose that S has size m. Since each example in S is drawn from distribution D and h has error larger than ɛ with respect to D, the probability that h is consistent with S is at most (1 ɛ) m. Now let H be the total number of decision lists. Then the union bound implies that Pr[some DL h with err(h) > ɛ is consistent with S] H(1 ɛ) m. We want this value to be at most δ. So if we set m to be at least 1 ɛ (ln(h) + ln(1/δ)), then this is satisfied, since then H(1 ɛ) m He ɛm He ln(h) ln(1/δ) δ In our case we know that H n! 4 n since for each feature there are 4 possible rules, and no feature will appear twice in a DL. So the number of samples we need in order to have a DL with error at most ɛ with probability at least 1 δ is only Θ( 1 ɛ (n ln n + ln(1/δ))). 25.2.2 Occam s Razor One really nice thing about this analysis is that it didn t actually use anything special about decision lists. All we needed was the number of decision lists to be reasonably small, in this case approximately n!. So this analysis would work for any class of functions where there aren t too many possible functions to choose from! We just need the number of examples to be essentially ln H, which is a huge improvement over a bound like H. Less formally, we proved that if there aren t too many different rules to choose from, then it s unlikely that one will fool us just by chance. This leads to a nice formalization of the classical Occam s razor. William of Occam, in approximately 1320 AD, made the claim that in general, we should prefer simpler explanations to more complicated ones. While this intuitively makes sense, why should we follow it? What s the benefit of simplicity? 3

Suppose that simple means that the description is at most s bits long. Then there can be at most 2 s simple explanations. Thus our analysis implies that if we see at least 1 ɛ (s ln(2) + ln(1/δ)) examples, it is unlikely that one will fool us just by chance. Of course, we don t have any guarantee that there will be a consistent simple explanation, but if there is one then we can be pretty confident in it. Thus we should prefer simple explanations to complicated ones. 25.2.3 Followup work There have been 1000s of paper using this general framework and making various kinds of improvements. For example, one very interesting direction (at least to me) is replacing the ln(h) with something like effective number of degrees of freedom. For example, consider linear separators. There are an infinite number of linear separators (so H is infinite), but only a small number of really distinct ones given S. This can be formalized, and other more refined analyses can be done. 25.3 Online Learning What if we don t want to assume that there is some fixed distribution D? Then clearly we can no longer talk about past performance predicting anything in the future. Is there anything at all that we can say? A statistics-based view would probably say that we re dead in the water if the adversary controls the examples we see and the future, then we can t make any statistically-based guarantees. But from an algorithmic point of view, we can actually make some very interesting claims. The main idea is something called regret bounds, and the idea is to show that our algorithm does nearly as well as the best predictor in some large class of predictors. We ll illustrate this using the classic setting of using expert advice. Suppose that we want to predict whether the stock market will go up or down tomorrow. There are many experts who will tell us what they think will happen, but obviously they might disagree with each other. But we want to use their advice to make a prediction. Then the next day we will find out what happens, each expert will make another prediction for the day after, and we will repeat this (either forever or for some number of rounds). How can we do this, and what kind of guarantees can we make? The basic question that we ll consider is whether we can do nearly as well as the best expert in hindsight. In other words, we will look at how well each expert does over all time (in this simplified setting, the number of mistakes that they make), and we will try to design an algorithm which does nearly as well as the best of them. Note that this is seems extremely difficult to do we don t know anything about these n experts, and the adversary can control what happens at every time point? So one expert might be good for a while and then become terrible, and another expert might start off terrible but get better, etc. Nevertheless, we ll want to guarantee that we do almost as well as the best single expert. 25.3.1 Perfect expert Let s start with a simpler setting: suppose that we know one of the experts is perfect (never makes a mistake), we just don t know which one. Is there a strategy which will let us identify this always-correct expert without making too many mistakes? 4

Let s do the following: each day, we take a majority vote of the experts and use that as our prediction. Then we eliminate any experts that were wrong. It is easy to see that this algorithm will only make at most log n mistakes. This is because every time it makes a mistake, that means that at least half of the remaining experts made the incorrect prediction, so we will eliminate at least half of the remaining experts. Since we started with n experts, we can only eliminate at least half of the remaining experts log n times before we are left with one expert. And since we are assuming that there is a perfect expert, this one will never be eliminated. This gives a mistake bound of log n. 25.3.2 No perfect expert If there is no perfect expert then making a mistake doesn t completely disqualify an expert, so we don t want to completely eliminate experts who make a mistake. Instead, we ll give each expert a weight, and decrease the weight of experts who make mistakes. This idea gives the Weighted Majority algorithm: 1. Initialize all experts to weight 1. 2. Predict based on weighted majority vote. 3. Penalize mistakes by cutting weights in half. To analyze this, let M be the number of mistakes that we have made so far, let m be the number of mistakes that the best expert has made so far, and let W be the total weight (which starts at n and decreases throughout the algorithm). When we make a mistake, that means that at least half of the current weight gets decreased by half, so W drops by at least 25%. So after we ve made M mistakes, W is at most n(3/4) m. On the other hand, the weight of the best expert is exactly (1/2) m. Thus (1/2) m n(3/4) M (4/3) M n2 m M log 4/3 (n2 m ) = (m + log n)/ log(4/3) 2.4(m + log n) It turns out that with improved settings/tweaks, can get M 1.07m + 8 ln n. This is a pretty good result the number of mistakes that we make is linear (with a reasonably small constant) in the number of mistakes made by the best expert. But what if the best expert is still wrong 20% of the time? Then our algorithm is only doing slightly better than random guessing! (Even if we ignore the log n part, a mistake bound of 2.4m would mean that we make mistakes 48% of the time). It turns out that we can do a bit better by using randomness. In particular, we will interpret weights as probabilities: instead of deterministically taking the weighted majority vote, we will randomly choose an expert according to its weight and then do whatever the expert does. Intuitively, this smoothes out the worst case if the weighted vote is close to balanced, then the adversary 5

won t be able to force us to make a mistake. This is known as the Randomized Weighted Majority algorithm. We will also change the penalty for being wrong: instead of removing 1/2 the weight of experts who make a mistake, we will instead remove an ɛ fraction of their weight on a mistake. Note that we can always go back to setting ɛ = 1/2 if we want. Theorem 25.3.1 The expected number of mistakes M made by the randomized weighted majority algorithm is at most (1 + ɛ/2)m + 1 ɛ ln n. Proof: Suppose that at time t there is an F t fraction of the weight on experts who make a mistake. Then since we always remove an ɛ fraction of the weight from experts who make mistakes, the total weight after time 1 is F 1 n(1 ɛ)+(1 F 1 )n = n(1 F 1 +F 1 ɛf 1 ) = n(1 ɛf 1 ). Similarly, the total weight after time 2 is n(1 ɛf 1 )(1 ɛf 2 ). In general, the total weight after t steps is n t i=1 (1 ɛf t). Let W t be the total weight after t time steps. Then taking logs, we get that ln(w t ) = ln n + ln n ɛ t ln(1 ɛf 1 ) i=1 t F t, where we used the fact that ln(1 x) < x. Now note that by linearity of expectations, t i=1 F t is exactly M, the expected number of mistakes that we make! Thus we have that i=1 ln W t ln n ɛm If the best expert makes m mistakes, then its weight at time t will be (1 ɛ) m. Thus ln W t m ln(1 ɛ), and thus ln n ɛm m ln(1 ɛ). Solving for M, we get that M 1 ɛ (ln n m ln(1 ɛ)) (1 + ɛ/2)m + 1 ɛ ln n By setting ɛ to be small, we can achieve a mistake bound that is almost the same as the optimal expert plus something logarithmic in n! This is a very useful tool to have. For example, we can think of each expert as a different algorithm, and this lets us guarantee that we do almost as well as the best in hindsight. It can even be used for seemingly far-removed applications, such as designing extremely fast approximate max-flow algorithms (due to Garg and Konemann) and fast algorithms for approximately solving LPs. In both of those settings, we essentially have an expert for each constraint and its weight is how much it is violated. Following high-weight experts corresponds to satisfying those constraints. There are also many extensions to the basic setting. For example, it is easy to extend to essentially arbitrary payoff functions, rather than just yes/no decisions. And with that extension, we can generalize to the so-called bandit setting where we only find out the payoff of the expert that we actually choose the payoffs of the other experts are unknown. We can also handle sleeping experts, in which at every time only a subset of the experts actually make a prediction and we need 6

to compare to the best coalition of experts (this can be formalized, but we won t do it here). We can also handle things like movement costs, where there is a cost associated with switching the expert that we choose. This is an active area of research with many applications, and there are many, many more extensions. I, for example, have written a few papers that use experts algorithms to maximize the throughput of a wireless network. 25.4 Final notes There are many other models of machine learning in which we can actually design algorithms with provable guarantees. For example, in active learning we are given a huge unlabeled sample S and the algorithm can decide which examples to actually label. Similarly, we could allow the algorithm to construct its own examples and ask for them to be labeled (these are called membership queries ). 7