What is modeling? NEU 466M Instructor: Professor Ila R. - - PowerPoint PPT Presentation
What is modeling? NEU 466M Instructor: Professor Ila R. - - PowerPoint PPT Presentation
What is modeling? NEU 466M Instructor: Professor Ila R. Fiete Spring 2016 Reference: NEURAL NETWORKS FOR PATTERN RECOGNITION, CHRISOPHER BISHOP
NEURAL ¡NETWORKS ¡FOR ¡PATTERN ¡ RECOGNITION, ¡CHRISOPHER ¡BISHOP ¡
Reference: ¡
hEp://cs.du.edu/~mitchell/mario_books/Neural_Networks_for_PaEern_RecogniLon_-‑_Christopher_Bishop.pdf ¡
What ¡does ¡modeling ¡mean? ¡
example of ‘a’ example of ‘b’ Pixels xi with values 1 or 0 (black or white).
What ¡does ¡modeling ¡mean? ¡
example of ‘a’ example of ‘b’ What is ‘a’-ness, versus ‘b’-ness?
Equivalent ¡problem ¡encountered ¡by ¡electrophysiologists ¡
Categorize ¡recorded ¡spike ¡as ¡coming ¡from ¡neuron ¡a ¡or ¡b ¡
→ ‘a’ ‘b’
figure ¡from ¡Quian ¡Quiroga ¡
What ¡does ¡modeling ¡mean? ¡
example of ‘a’ example of ‘b’ What is ‘a’-ness, versus ‘b’-ness?
Model: ¡relaLonship ¡between ¡data ¡and ¡ its ¡category ¡
256 × 256 pixels : N = 65536
Store every image with its letter label?
{x1, x2, · · · , xN} → ‘a’ {x0
1, x0 2, · · · , x0 N} → ‘b’
Model: ¡store ¡every ¡possible ¡image ¡ with ¡corresponding ¡leEer ¡label? ¡
256 × 256 pixels : N = 65536
→ ‘a’ ‘b’
Number of 256 × 256 bw images: 265536 ∼ 1020000
Atoms in universe: ∼ 1080 Houston, ¡we ¡have ¡a ¡problem. ¡ ¡
Storing ¡each ¡data, ¡category ¡pair ¡
- Need ¡too ¡many ¡examples/data ¡to ¡fill ¡grid ¡between ¡
inputs ¡to ¡categories! ¡“Curse ¡of ¡dimensionality” ¡
- Too ¡much ¡data ¡to ¡store! ¡ ¡
à ¡Compactness ¡ ¡
- Not ¡predicLve: ¡What ¡to ¡do ¡with ¡new ¡example? ¡ ¡
¡ à ¡Generalizability ¡ ¡
What ¡we ¡want ¡from ¡a ¡model: ¡compactness ¡and ¡
- generalizability. ¡
One ¡soluLon: ¡feature ¡selecLon ¡
- Look ¡at ¡some ¡much ¡smaller ¡set ¡of ¡
characterisLc ¡features ¡that ¡define ¡the ¡classes. ¡
- How ¡to ¡choose ¡these? ¡ ¡
¡-‑ ¡by ¡“hand” ¡ ¡-‑ ¡some ¡“automaLc” ¡technique ¡
(sounds ¡magical ¡but ¡this ¡is ¡goal ¡of ¡much ¡staLsLcs ¡and ¡machine ¡learning; ¡ ¡ we ¡will ¡consider ¡how ¡automaLcally ¡find ¡features ¡in ¡this ¡class) ¡
Features ¡
˜ x1 : height-to-width ratio of object ˜ x2 : some other feature
Features ¡
˜ x1 : height-to-width ratio of object ˜ x2 : some other feature
: ‘a’ × : ‘b’
Features ¡
: ‘a’ × : ‘b’
˜ x1 only would lead to poor categorization More features can be helpful:
Features ¡
- If ¡adding ¡features ¡improves ¡performance, ¡
keep ¡adding ¡independent ¡features? ¡
- Will ¡this ¡conLnue ¡to ¡improve ¡performance? ¡
At ¡some ¡point, ¡NO! ¡Performance ¡will ¡get ¡worse. ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡WHY? ¡
A ¡more ¡familiar ¡example: ¡regression ¡
- Instead ¡of ¡discrete ¡categories ¡(‘a’, ¡’b’), ¡each ¡
datapoint ¡(or ¡data ¡vector) ¡maps ¡to ¡some ¡value ¡
- f ¡a ¡conLnuous ¡variable ¡(y). ¡ ¡
¡
{(x1, y1), (x2, y2), · · · , (xN, yN)}
{(x1, y1), (x2, y2), · · · , (xN, yN)} x1 independent variable y1 response or dependent variable
Modeling ¡as ¡regression ¡
{(x1, y1), (x2, y2), · · · , (xN, yN)}
What ¡does ¡it ¡mean ¡to ¡model ¡this ¡data? ¡ ¡
- ‑ ¡ ¡Want ¡to ¡write ¡y ¡as ¡some ¡funcLon ¡of ¡x ¡
- ‑ Want ¡to ¡fit ¡a ¡funcLon ¡through ¡x, ¡y ¡ ¡
- ‑ Given ¡x ¡want ¡to ¡predict ¡y ¡
Regression: ¡curve-‑fieng ¡
{(x1, y1), (x2, y2), · · · , (xN, yN)} free parameters: (w0, w1, · · · , wM) ˜ y(x) = w0 + w1x + · · · + wMxM =
M
X
j=0
wjxj
Polynomial ¡regression ¡
- The ¡larger ¡M, ¡the ¡higher-‑degree ¡the ¡polynomial ¡
à ¡more ¡complex ¡model/more ¡features. ¡ ¡
- Expect ¡fit ¡to ¡get ¡beEer ¡with ¡increasing ¡M. ¡ ¡
When ¡M ¡= ¡N, ¡then ¡exact ¡fit ¡to ¡all ¡datapoints ¡(b/c ¡ Mth ¡order ¡polynomial ¡has ¡M+1 ¡parameters, ¡M ¡ roots). ¡ ¡
- So ¡are ¡the ¡more-‑complex ¡models ¡beEer? ¡ ¡
Parameters ¡chosen ¡to ¡minimize ¡fit ¡error ¡
Common ¡error ¡funcLon: ¡sum-‑of-‑squares: ¡ ¡
(How ¡to ¡implement? ¡Matlab: ¡polyfit. ¡Theory: ¡we’ll ¡get ¡to ¡it.) ¡ (Is ¡this ¡the ¡only ¡choice? ¡No. ¡Best ¡choice? ¡InteresLng ¡q: ¡we’ll ¡get ¡to ¡it.) ¡
w∗ = arg min
w
1 2
N
X
n=1
[˜ y(xn; w) − yn] E = 1 2
N
X
n=1
[˜ y(xn; w) − yn]
0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Degree 1, squared error = 0.45126
Linear ¡fit ¡(M=1) ¡
N ¡= ¡11 ¡datapoints ¡ dashed ¡= ¡true ¡fxn ¡
x y
0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Degree 2, squared error = 0.45126
QuadraLc ¡(M=2) ¡
N ¡= ¡11 ¡datapoints ¡ dashed ¡= ¡true ¡fxn ¡
x y
0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Degree 3, squared error = 0.02289
Cubic ¡
N ¡= ¡11 ¡datapoints ¡ dashed ¡= ¡true ¡fxn ¡
x y
0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Degree 9, squared error = 0.0023272
M=9 ¡
N ¡= ¡11 ¡datapoints ¡ dashed ¡= ¡true ¡fxn ¡
x y
0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 −0.4 −0.2 0.2 0.4 0.6 0.8 1 Degree 11, squared error = 1.184e−20
M ¡= ¡11 ¡
N ¡= ¡11 ¡datapoints ¡ dashed ¡= ¡true ¡fxn ¡
x y
1 2 3 4 5 6 7 8 9 10 11 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5
Sum-‑of-‑squares ¡error ¡
fit ¡error ¡on ¡training/new ¡data ¡
M squared error
Predictability ¡
- Error ¡on ¡fieng ¡the ¡specific ¡training ¡data ¡keeps ¡decreasing ¡with ¡
model ¡complexity ¡(M). ¡
- Error ¡of ¡fit ¡to ¡previously ¡un-‑fit/unseen ¡data ¡improves ¡but ¡then ¡
worsens ¡with ¡increasing ¡M. ¡
- Model ¡is ¡overfi.ng ¡to ¡foibles ¡of ¡training ¡data ¡(noise) ¡ajer ¡M ¡= ¡3. ¡ ¡
- Model ¡becomes ¡both ¡more ¡complex ¡and ¡less ¡predic8ve ¡beyond ¡M ¡= ¡
3 ¡features. ¡ ¡
- Key ¡technique: ¡cross-‑validaLon. ¡Test ¡model ¡on ¡previously ¡unseen ¡
- data. ¡Hold-‑out ¡dataset ¡or ¡jack-‑knife/leave-‑one-‑out ¡approaches. ¡ ¡
(There ¡are ¡other ¡ways ¡to ¡improve ¡predictability ¡by ¡reducing ¡complexity, ¡ ¡ e.g. ¡by ¡directly ¡constraining ¡the ¡complexity ¡of ¡the ¡model: ¡“regularizaLon”) ¡ ¡
Back ¡to ¡categorizaLon ¡example ¡
simplest ¡ intermediate ¡ most ¡flexible/complex ¡ exhibits ¡overfieng ¡
BeEer ¡features: ¡admit ¡simpler ¡model ¡
poor ¡choice ¡of ¡features ¡
→ ‘a’ ‘b’
beEer ¡choice ¡of ¡features ¡
(In ¡regression ¡example, ¡data ¡were ¡generated ¡from ¡a ¡sine ¡wave. ¡ ¡ Using ¡sines ¡instead ¡of ¡polynomials ¡would ¡have ¡produced ¡an ¡excellent ¡2-‑parameter ¡fit.) ¡
Summary ¡
- A ¡good ¡model ¡can ¡describe ¡the ¡data ¡in ¡a ¡
relaLvely ¡simple/low-‑complexity/compact ¡way ¡ (but ¡not ¡too ¡low! ¡Einstein: ¡as ¡simple ¡as ¡possible, ¡ but ¡no ¡simpler) ¡and ¡has ¡good ¡predicLon ¡
- performance. ¡ ¡ ¡
- ExtracLng ¡“features” ¡of ¡data ¡as ¡a ¡way ¡to ¡model ¡it. ¡ ¡
- To ¡determine ¡predictability, ¡important ¡to ¡cross-‑