1 of 66

Introduction to Machine Learning

Maggie Makar

Presidential Postdoctoral Fellow/Assistant Professor

Electrical Engineering and Computer Science

2 of 66

My work: clinical decision support through…

Prediction

Does this X-ray show signs of Pneumonia?

Causal inference

Will chemotherapy extend the patient’s life expectancy?

Start treatment

Chemo

No action

Palliative care

Does this X-ray show signs of Pneumonia?

Will chemotherapy extend the patient’s life expectancy?

Yes

No

Yes

No

3 of 66

What is Machine learning?

The study of patterns to create rules that generalize

4 of 66

What is Machine learning?

The study of patterns to create rules that generalize

What is not Machine learning?

Artificial Intelligence

Machine learning

5 of 66

What is Machine learning?

The study of patterns to create rules that generalize

What is not Machine learning?

Artificial Intelligence

Machine learning

“Prescribed” rules

E.g., Boolean and Fuzzy logic

If rice is brown and heat is 100 🡪 stop

If rice is white and heat is 100 🡪 lower heat

6 of 66

What is Machine learning?

The study of patterns to create rules that generalize

What is not Machine learning?

Artificial Intelligence

Machine learning

“Prescribed” rules

Learned rules

E.g., Boolean and Fuzzy logic

Don’t know what the rule is, but we try to ”learn” it from data

If rice is brown and heat is 100 🡪 stop

If rice is white and heat is 100 🡪 lower heat

7 of 66

Types of Machine Learning

  • Supervised learning:
    • Input is labeled data, goal is to generate a prediction for new examples
    • E.g., Using patient characteristics to predict future adverse outcomes, using chest X-rays to detect presence of Pneumonia

8 of 66

Types of Machine Learning

  • Supervised learning:
    • Input is labeled data, goal is to generate a prediction for new examples
    • E.g., Using patient characteristics to predict future adverse outcomes, using chest X-rays to detect presence of Pneumonia
  • Unsupervised learning:
    • Input is unlabeled data, goal is to discover new structures/clustering
    • E.g., subtyping autism trajectories

9 of 66

Types of Machine Learning

  • Supervised learning:
    • Input is labeled data, goal is to generate a prediction for new examples
    • E.g., Using patient characteristics to predict future adverse outcomes, using chest X-rays to detect presence of Pneumonia
  • Unsupervised learning:
    • Input is unlabeled data, goal is to discover new structures/clustering
    • E.g., subtyping autism trajectories
  • Reinforcement learning:
    • Input varies (online vs offline RL). In offline RL state, action pairs and a reward signal. Goal is to identifying sequence of actions to optimize long term rewards
    • E.g., Optimal strategy for sepsis treatment

10 of 66

Types of Machine Learning

  • Supervised learning:
    • Input is labeled data, goal is to generate a prediction for new examples
    • E.g., Using patient characteristics to predict future adverse outcomes, using chest X-rays to detect presence of Pneumonia
  • Unsupervised learning:
    • Input is unlabeled data, goal is to discover new structures/clustering
    • E.g., subtyping autism trajectories
  • Reinforcement learning:
    • Input varies (online vs offline RL). In offline RL state, action pairs and a reward signal. Goal is to identifying sequence of actions to optimize long term rewards
    • E.g., Optimal strategy for sepsis treatment

11 of 66

Supervised learning: setup

Input: Labeled data

12 of 66

Supervised learning: setup

Input: Labeled data

Regression:

Binary classification:

Multiclass-Classification:

13 of 66

Supervised learning: setup

Input: Labeled data

Goal: learn a mapping h:

Regression:

Binary classification:

Multiclass-Classification:

14 of 66

Picking a hypothesis (mapping)

Define a hypothesis class,

Define evaluation criteria

Define a learning algorithm

15 of 66

Picking a hypothesis (mapping)

Define a hypothesis class,

Define evaluation criteria

Define a learning algorithm

16 of 66

Picking a hypothesis (mapping)

Define a hypothesis class,

Define evaluation criteria

Define a learning algorithm

Age

Income

Space of linear hypotheses

17 of 66

Picking a hypothesis (mapping)

Define a hypothesis class,

Define evaluation criteria

Define a learning algorithm

Age

Education

Age

Education

Space of linear hypotheses

Space of decision-tree based hypotheses

Age

Income

18 of 66

Picking a hypothesis (mapping)

Define a hypothesis class,

Define evaluation criteria

Define a learning algorithm

How good is a prediction?

19 of 66

Picking a hypothesis (mapping)

Define a hypothesis class,

Define evaluation criteria

Define a learning algorithm

How good is a prediction?

Regression problems

20 of 66

Picking a hypothesis (mapping)

Define a hypothesis class,

Define evaluation criteria

Define a learning algorithm

How good is a prediction?

Regression problems

Binary Classification (0/1)

21 of 66

Picking a hypothesis (mapping)

Define a hypothesis class,

Define evaluation criteria

Define a learning algorithm

How good is a prediction?

Regression problems

Binary Classification (0/1)

How good is a hypothesis?

22 of 66

Picking a hypothesis (mapping)

Define a hypothesis class,

Define evaluation criteria

Define a learning algorithm

  • A set of steps for the computer to take in order to identify the best
  • Usually involves an optimization step�

23 of 66

What makes an ML model good?

For an unobserved dataset of size m, want low:

As a proxy, we will minimize:

🡪Empirical risk minimization

24 of 66

Warning!

Minimizing training loss is an imperfect proxy. �Will minimizing the training loss give us a good model if we consider the memorization hypothesis?

25 of 66

A regression problem

Whiteboard!

26 of 66

Why gradient descent?

  • Closed form solution is possible, but expensive (e.g., linear regression)
  • Closed form solution is not possible (e.g., logistic regression and neural networks)

 

 

27 of 66

Gradient descent: learning rate = 0.05

Guess #

0

-3.000

160.128

1

0.493

9.672

2

1.308

1.478

3

1.498

1.032

4

1.542

1.007

 

28 of 66

Gradient descent: learning rate = 0.05

Guess #

0

-3.000

160.128

1

0.493

9.672

2

1.308

1.478

3

1.498

1.032

4

1.542

1.007

 

29 of 66

Gradient descent: learning rate = 0.05

Guess #

0

-3.000

160.128

1

0.493

9.672

2

1.308

1.478

3

1.498

1.032

4

1.542

1.007

 

30 of 66

Gradient descent: learning rate = 0.05

Guess #

0

-3.000

160.128

1

0.493

9.672

2

1.308

1.478

3

1.498

1.032

4

1.542

1.007

 

31 of 66

Gradient descent: learning rate = 0.05

Back to whiteboard…

Guess #

0

-3.000

160.128

1

0.493

9.672

2

1.308

1.478

3

1.498

1.032

4

1.542

1.007

 

32 of 66

Gradient descent: Putting it all together

 

33 of 66

Gradient descent: small learning rate

34 of 66

Gradient descent: large learning rate

35 of 66

Other forms of gradient descent

Stochastic GD

Mini-batch

Adam/Adagrad

36 of 66

Recap

Learning algorithms 🡪 Gradient descent and its sisters

37 of 66

New dataset

38 of 66

New dataset

39 of 66

A different hypothesis class

40 of 66

Polynomial with degree 1

41 of 66

Polynomial with degree 2

42 of 66

Polynomial with degree 3

43 of 66

Polynomial with degree 9

44 of 66

Polynomial with degree 15

45 of 66

Regularization

  • Prevents the model from “trying too hard”

Equivalent to:

46 of 66

Revisiting the hypothesis class

Recall our previous function class definition

The regularized version

 

 

47 of 66

Different norms 🡪 Different hypothesis classes

 

 

 

 

48 of 66

The bias-variance tradeoff

Thought experiment:

  • Sample n points from the full distribution
  • Learn a model
  • Sample a different set of n points
  • Learn a new model
  • Repeat…

Note: Every model will be slightly different…why?

49 of 66

The bias-variance tradeoff

 

 

50 of 66

The bias-variance tradeoff

 

 

 

 

51 of 66

The bias-variance tradeoff

 

 

 

 

 

 

52 of 66

The bias-variance tradeoff

 

 

 

 

 

 

 

 

53 of 66

The bias-variance tradeoff

 

 

 

 

 

 

 

 

Low bias, high variance

Large bias, low variance

Low bias, low variance

54 of 66

 

Holdout method

Observed data

 

 

 

 

 

 

 

 

55 of 66

 

K-fold cross validation, with K = 3

Observed data

Training data

Validation data

 

 

 

 

 

 

56 of 66

 

K-fold cross validation, with K=3

Observed data

Training data

Validation data

 

 

 

 

 

 

57 of 66

 

K-fold cross validation, with K=3

Observed data

Training data

Validation data

 

 

 

 

 

 

Training data

58 of 66

K-fold cross validation, with K=3

Round 1

�Round 2

�Round 3��

 

 

 

 

 

 

 

 

 

 

59 of 66

K-fold cross validation, with K=3

Round 1

�Round 2

�Round 3��Average

 

 

 

 

 

 

 

 

 

 

 

 

 

60 of 66

Recap

Hypothesis classes, regularization & bias-variance tradeoff

61 of 66

Learning representations

Recall the polynomial regression problem:

What if we do not know ?

62 of 66

Feature learning

pixel 1

pixel 2

pixel 1

pixel 2

Dogs

Non-Dogs

Input space

Example from J. Wiens

63 of 66

Feature learning

pixel 1

pixel 2

pixel 1

pixel 2

Dogs

Non-Dogs

Input space

“muzzle”

“paw”

muzzle

paw

Example from J. Wiens

64 of 66

Neural networks

Chalkboard!

65 of 66

Types of neural networks

  • Fully connected neural networks
  • Convolutional neural networks
  • Recurrent neural networks

66 of 66

Challenges in healthcare settings

  • Interpretability
  • Bias/fairness
  • Causality
  • Logistical challenges…