1 of 18

CSE 163

ML and Images�

Suh Young Choi�

🎶 Listening to: Unwed Sailor

💬 Before Class: You can instantly become fluent in any language, but you’re banned from traveling anywhere that uses it as an official language. What language do you pick?

2 of 18

Announcements

CP 3 and LR 6 due Monday 8/11

​

Project Report/Code due Thursday 8/14

  • Turned in via Gradescope
  • No late work accepted, no resubmissions

​

Two more resubmission periods remaining, unless…

  • If 60% of the class fills out the final course eval (releasing 8/13), then you get a third!
  • You may submit any one THA during this “bonus” period (8/20 – 8/22)

​

​

2

3 of 18

This Time

  • Machine learning with images

Last Time

  • Convolutions
  • Kernel operations

3

4 of 18

Machine Learning, revisited

Terms from machine learning

  • Features / labels
  • Learning algorithm
  • Model
  • Model class
  • Training set / test set
  • Parameters / Hyperparameters

4

5 of 18

ML + Images

How do we do machine learning on images?

  • Simplest: Unroll the image into a vector
  • Complex: Use other tools to extract features from the images

​

​

5

10

20

30

40

50

60

70

80

90

10

20

30

40

50

60

70

80

90

Raw Image

Unrolled Image

6 of 18

ML + Images

Pros: Simple transformation (just a call to reshape!)

Cons: It loses the idea of “neighboring” pixels (up/down)

  • Most machine learning models don’t take position of the features into account
  • This is where more complex models like convolutional neural networks come in to encode that local information as features

​

​

6

Despite these drawbacks, it can work in practice on some problems!

​

7 of 18

Neural Network

Based on how our brains �work

7

8 of 18

Example

What is the output for this neuron if the inputs are 0 for the first input and 1 for the second? The activation function is the step function (0 if negative, 1 otherwise). The bias should be subtracted from the weighted sum before applying the activation function.

8

3

-2

4

9 of 18

Example

What is the output for this neuron if the inputs are 0 for the first input and 1 for the second? The activation function is the step function (0 if negative, 1 otherwise). The bias should be subtracted from the weighted sum before applying the activation function.

9

3

-2

4

0

1

10 of 18

Example

What is the output for this neuron if the inputs are 0 for the first input and 1 for the second? The activation function is the step function (0 if negative, 1 otherwise). The bias should be subtracted from the weighted sum before applying the activation function.

10

3

-2

4

0

1

0 * 3 + 1 *(-2) - 4 = -6

11 of 18

Example

What is the output for this neuron if the inputs are 0 for the first input and 1 for the second? The activation function is the step function (0 if negative, 1 otherwise). The bias should be subtracted from the weighted sum before applying the activation function.

11

3

-2

4

0

1

0 * 3 + 1 *(-2) - 4 = -6

squish(-6) = 0

12 of 18

Image Classification

12

13 of 18

Unsupervised

Learning

So far, we have seen supervised machine learning, where we have to explicitly shown the algorithm the labels

​

Unsupervised machine learning lets the algorithm try to learn trends on its own without providing explicit labels

​

Examples

  • Clustering
  • Outlier detection

13

14 of 18

Project Deliverable Details

Visualizations MUST include:

  • Title
  • Axis labels
  • Legend
  • Caption (with figure number)

​

Include in any captions:

  • Figure number
  • Type of plot
  • Variables being plotted
  • (Optionally) trends/takeaways from the plot

​

14

15 of 18

Project Deliverable Details

Fig 1. A line plot showing the relationship between shark ages in months and caudal fin lengths in inches.

16 of 18

Project Deliverable Details

Don’t let numbers float (ha) in the vacuum!

  • Accuracy / MSE – what do these numbers mean for your ML model?
  • Pearson’s R or R-squared values – what does this imply about the strength or direction of the relationship between variables?
  • p-values – do you reject or fail to reject your null hypothesis? What does this imply about your results?
  • Percentages, counts, averages, sums, etc:

​

16

17 of 18

Project Deliverable Details

Length requirements

  • 15 pages for the report (excluding optional title page and appendix)
  • 3 minutes for the video
  • Please don’t do this:

​

17

18 of 18

Before Next Time

  • Complete Lesson 21
    • Remember not for points, but do go towards Checkpoint Tokens
  • CP 3 + LR 6 due on Monday

Next Time

  • Ethics and Data Science

​

18