Introduction to Statistical Machine Learning

41 downloads 460 Views 2MB Size Report
of statistical machine learning, which is concerned with the development of algorithms and ... Data Mining: searching through large volumes of data. • Computer ...
Introduction to Statistical Machine Learning

-1-

Marcus Hutter

Introduction to Statistical Machine Learning Marcus Hutter Canberra, ACT, 0200, Australia

Machine Learning Summer School MLSS-2008, 2 – 15 March, Kioloa

ANU

RSISE

NICTA

Introduction to Statistical Machine Learning

-2-

Marcus Hutter

Abstract This course provides a broad introduction to the methods and practice of statistical machine learning, which is concerned with the development of algorithms and techniques that learn from observed data by constructing stochastic models that can be used for making predictions and decisions. Topics covered include Bayesian inference and maximum likelihood modeling; regression, classification, density estimation, clustering, principal component analysis; parametric, semi-parametric, and non-parametric models; basis functions, neural networks, kernel methods, and graphical models; deterministic and stochastic optimization; overfitting, regularization, and validation.

Introduction to Statistical Machine Learning

-3-

Marcus Hutter

Table of Contents 1. Introduction / Overview / Preliminaries 2. Linear Methods for Regression 3. Nonlinear Methods for Regression 4. Model Assessment & Selection 5. Large Problems 6. Unsupervised Learning 7. Sequential & (Re)Active Settings 8. Summary

Intro/Overview/Preliminaries

1

-4-

Marcus Hutter

INTRO/OVERVIEW/PRELIMINARIES • What is Machine Learning? Why Learn? • Related Fields • Applications of Machine Learning • Supervised↔Unsupervised↔Reinforcement Learning • Dichotomies in Machine Learning • Mini-Introduction to Probabilities

Intro/Overview/Preliminaries

-5-

Marcus Hutter

What is Machine Learning? Machine Learning is concerned with the development of algorithms and techniques that allow computers to learn Learning in this context is the process of gaining understanding by constructing models of observed data with the intention to use them for prediction.

Related fields

• Artificial Intelligence: smart algorithms • Statistics: inference from a sample • Data Mining: searching through large volumes of data • Computer Science: efficient algorithms and complex models

Intro/Overview/Preliminaries

-6-

Marcus Hutter

Why ’Learn’ ? There is no need to “learn” to calculate payroll Learning is used when: • Human expertise does not exist (navigating on Mars), • Humans are unable to explain their expertise (speech recognition) • Solution changes in time (routing on a computer network) • Solution needs to be adapted to particular cases (user biometrics) Example: It is easier to write a program that learns to play checkers or backgammon well by self-play rather than converting the expertise of a master player to a program.

Intro/Overview/Preliminaries

-7-

Marcus Hutter

Handwritten Character Recognition an example of a difficult machine learning problem

Task: Learn general mapping from pixel images to digits from examples

Intro/Overview/Preliminaries

-8-

Marcus Hutter

Applications of Machine Learning machine learning has a wide spectrum of applications including: • natural language processing, • search engines, • medical diagnosis, • detecting credit card fraud, • stock market analysis, • bio-informatics, e.g. classifying DNA sequences, • speech and handwriting recognition, • object recognition in computer vision, • playing games – learning by self-play: Checkers, Backgammon. • robot locomotion.

Intro/Overview/Preliminaries

-9-

Marcus Hutter

Some Fundamental Types of Learning • Supervised Learning Classification Regression

• Reinforcement Learning Agents

• Unsupervised Learning Association Clustering Density Estimation

• Others SemiSupervised Learning Active Learning

Intro/Overview/Preliminaries

- 10 -

Supervised Learning • Prediction of future cases: Use the rule to predict the output for future inputs • Knowledge extraction: The rule is easy to understand • Compression: The rule is simpler than the data it explains • Outlier detection: Exceptions that are not covered by the rule, e.g., fraud

Marcus Hutter

Intro/Overview/Preliminaries

- 11 -

Classification Example: Credit scoring

Differentiating between low-risk and high-risk customers from their Income and Savings

Discriminant: IF income > θ1 AND savings > θ2 THEN low-risk ELSE high-risk

Marcus Hutter

Intro/Overview/Preliminaries

- 12 -

Marcus Hutter

Regression Example: Price y = f (x)+noise of a used car as function of age x

Intro/Overview/Preliminaries

- 13 -

Unsupervised Learning • Learning “what normally happens” • No output • Clustering: Grouping similar instances • Example applications: Customer segmentation in CRM Image compression: Color quantization Bioinformatics: Learning motifs

Marcus Hutter

Intro/Overview/Preliminaries

- 14 -

Reinforcement Learning • Learning a policy: A sequence of outputs • No supervised output but delayed reward • Credit assignment problem • Game playing • Robot in a maze • Multiple agents, partial observability, ...

Marcus Hutter

Intro/Overview/Preliminaries

- 15 -

Marcus Hutter

Dichotomies in Machine Learning scope of my lecture (machine) learning / statistical induction ⇔ prediction regression independent identically distributed online learning passive prediction parametric conceptual/mathematical exact/principled supervised learning

⇔ ⇔ ⇔ ⇔ ⇔ ⇔ ⇔ ⇔ ⇔ ⇔ ⇔

scope of other lectures logic/knowledge-based (GOFAI) decision ⇔ action classification sequential / non-iid offline/batch learning active learning non-parametric computational issues heuristic unsupervised ⇔ RL learning

Intro/Overview/Preliminaries

- 16 -

Marcus Hutter

Probability Basics Probability is used to describe uncertain events; the chance or belief that something is or will be true. Example: Fair Six-Sided Die: • Sample space: Ω = {1, 2, 3, 4, 5, 6} • Events: Even= {2, 4, 6}, Odd= {1, 3, 5}

⊆Ω

• Probability: P(6) = 16 , P(Even) = P(Odd) = • Outcome: 6 ∈ E.

1 2

P (6and Even) 1/6 1 • Conditional probability: P (6|Even) = = = P (Even) 1/2 3 General Axioms: • P({}) = 0 ≤ P(A) ≤ 1 = P(Ω), • P(A ∪ B) + P(A ∩ B) = P(A) + P(B), • P(A ∩ B) = P(A|B)P(B).

Intro/Overview/Preliminaries

- 17 -

Marcus Hutter

Probability Jargon Example: (Un)fair coin: Ω = {Tail,Head} ' {0, 1}. P(1) = θ ∈ [0, 1]: Likelihood: P(1101|θ) = θ × θ × (1 − θ) × θ Maximum Likelihood (ML) estimate: θˆ = arg maxθ P(1101|θ) = 3 4

Prior: If we are indifferent, then P(θ) =const. R P 1 Evidence: P(1101) = θ P(1101|θ)P(θ) = 20 (actually ) Posterior: P(θ|1101) =

P(1101|θ)P(θ) P(1101)

∝ θ3 (1 − θ) (BAYES RULE!).

Maximum a Posterior (MAP) estimate: θˆ = arg maxθ P(θ|1101) = 2 Predictive distribution: P(1|1101) = P(11011) = P(1101) 3 P Expectation: E[f |...] = θ f (θ)P(θ|...), e.g. E[θ|1101] =

Variance: Var(θ) = E[(θ − Eθ)2 |1101] =

2 63

Probability density: P(θ) = 1ε P([θ, θ + ε]) for ε → 0

2 3

3 4

Linear Methods for Regression

2

- 18 -

Marcus Hutter

LINEAR METHODS FOR REGRESSION • Linear Regression • Coefficient Subset Selection • Coefficient Shrinkage • Linear Methods for Classifiction • Linear Basis Function Regression (LBFR) • Piecewise linear, Splines, Wavelets • Local Smoothing & Kernel Regression • Regularization & 1D Smoothing Splines

Linear Methods for Regression

- 19 -

Marcus Hutter

Linear Regression fitting a linear function to the data • Input “feature” vector x := (1 ≡ x(0) , x(1) , ..., x(d) ) ∈ IRd+1 • Real-valued noisy response y ∈ IR. • Linear regression model: yˆ = fw (x) = w0 x(0) + ... + wd x(d) • Data: D = (x1 , y1 ), ..., (xn , yn ) • Error or loss function: Example: Residual sum of squares: Pn Loss(w) = i=1 (yi − fw (xi ))2 • Least squares (LSQ) regression: w ˆ = arg minw Loss(w) • Example: Person’s weight y as a function of age x1 , height x2 .

Linear Methods for Regression

- 20 -

Marcus Hutter

Coefficient Subset Selection Problems with least squares regression if d is large: • Overfitting: The plane fits the data well (perfect for d ≥ n), but predicts (generalizes) badly. • Interpretation: We want to identify a small subset of features important/relevant for predicting y. Solution 1: Subset selection: Take those k out of d features that minimize the LSQ error.

Linear Methods for Regression

- 21 -

Marcus Hutter

Coefficient Shrinkage Solution 2: Shrinkage methods: Shrink the least squares w by penalizing the Loss: Ridge regression: Add ∝ ||w||22 . Lasso: Add ∝ ||w||1 . Bayesian linear regression: Comp. MAP arg maxw P(w|D) from prior P (w) and sampling model P (D|w). Weights of low variance components shrink most.

Linear Methods for Regression

- 22 -

Marcus Hutter

Linear Methods for Classification Example: Y = {spam,non-spam} ' {−1, 1}

(or {0, 1})

Reduction to regression: Regard y ∈ IR ⇒ w ˆ from linear regression. Binary classification: If fwˆ (x) > 0 then yˆ = 1 else yˆ = −1. Probabilistic classification: Predict probability that new x is in class y. P(y=1|x,D) := fw Log-odds log P(y=0|x,D) ˆ (x) Improvements: • Linear Discriminant Analysis (LDA) • Logistic Regression • Perceptron • Maximum Margin Hyperplane • Support Vector Machine Generalization to non-binary Y possible.

Linear Methods for Regression

- 23 -

Marcus Hutter

Linear Basis Function Regression (LBFR) = powerful generalization of and reduction to linear regression! Problem: Response y ∈ IR is often not linear in x ∈ IRd . Solution: Transform x ; φ(x) with φ : IRd → IRp . Assume/hope response y ∈ IR is now linear in φ. Examples: • Linear regression: p = d and φi (x) = xi . • Polynomial regression: d = 1 and φi (x) = xi . • Piecewise constant regression: E.g. d = 1 with φi (x) = 1 for i ≤ x < i + 1 and 0 else. • Piecewise polynomials ... • Splines ...

Linear Methods for Regression

- 24 -

Marcus Hutter

Linear Methods for Regression

- 25 -

Marcus Hutter

2D Spline LBFR and 1D Symmlet-8 Wavelets

Linear Methods for Regression

- 26 -

Marcus Hutter

Local Smoothing & Kernel Regression Estimate f (x) by averaging the yi for all xi a-close to x: fˆ(x) =

Pn K(x,xi )yi Pi=1 n i=1

K(x,xi )

Nearest-Neighbor Kernel: i |