Course materials · Introduction to Machine Learning

Feature Representations and Model Comparison · Study

English translation

Topics covered

Images with the same brightness may have different structures. How features are represented affects distinguishability.

Different images with the same mean brightness

Vertical and horizontal bars have different orientations even when their mean brightness is the same. A model needs features that preserve the information needed to distinguish them.

Representations that tolerate position changes

Shifting an image by one cell leaves its true orientation unchanged. Position-sensitive features may change substantially. Use a small transformation to examine which information a representation retains and discards.

Worked example

In the 8×8 images, A has 1s only in the middle two columns, and B only in the middle two rows; all other pixels are 0.

import numpy as np
import matplotlib.pyplot as plt
A=np.zeros((8,8));B=A.copy();A[:,3:5]=1;B[3:5,:]=1
print(A.mean(),B.mean(),A.sum(axis=0),B.sum(axis=0))
import matplotlib.pyplot as plt
fig,axes=plt.subplots(1,2,figsize=(6,3))
axes[0].imshow(A,cmap="gray",vmin=0,vmax=1);axes[0].set_title("A")
axes[1].imshow(B,cmap="gray",vmin=0,vmax=1);axes[1].set_title("B")
0.25 0.25 [0. 0. 0. 8. 8. 0. 0. 0.] [2. 2. 2. 2. 2. 2. 2. 2.]
실행 결과

Reference example

View more examples

Reference materials