0% found this document useful (0 votes)
2 views262 pages

ML Lecture Notes

The document presents various patient and customer data over time, highlighting changes in health conditions, financial status, and product characteristics. It includes specific details such as age, diabetes status, loan balances, and product stages. Additionally, it discusses machine learning concepts like inductive bias, classification, and error analysis in neural networks.

Uploaded by

bosojel785
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views262 pages

ML Lecture Notes

The document presents various patient and customer data over time, highlighting changes in health conditions, financial status, and product characteristics. It includes specific details such as age, diabetes status, loan balances, and product stages. Additionally, it discusses machine learning concepts like inductive bias, classification, and error analysis in neural networks.

Uploaded by

bosojel785
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 262

Patient103 time=1 Patient103 time=2 ...

Patient103 time=n

Age: 23 Age: 23 Age: 23


FirstPregnancy: no FirstPregnancy: no FirstPregnancy: no
Anemia: no Anemia: no Anemia: no
Diabetes: no Diabetes: YES Diabetes: no
PreviousPrematureBirth: no PreviousPrematureBirth: no PreviousPrematureBirth: no
Ultrasound: ? Ultrasound: abnormal Ultrasound: ?
Elective C−Section: ? Elective C−Section: no Elective C−Section: no
Emergency C−Section: ? Emergency C−Section: ? Emergency C−Section: Yes
... ... ...
Patient103 time=1 Patient103 time=2 ... Patient103 time=n

Age: 23 Age: 23 Age: 23


FirstPregnancy: no FirstPregnancy: no FirstPregnancy: no
Anemia: no Anemia: no Anemia: no
Diabetes: no Diabetes: YES Diabetes: no
PreviousPrematureBirth: no PreviousPrematureBirth: no PreviousPrematureBirth: no
Ultrasound: ? Ultrasound: abnormal Ultrasound: ?
Elective C−Section: ? Elective C−Section: no Elective C−Section: no
Emergency C−Section: ? Emergency C−Section: ? Emergency C−Section: Yes
... ... ...
Customer103: (time=t0) Customer103: (time=t1) ... Customer103: (time=tn)
Years of credit: 9 Years of credit: 9 Years of credit: 9
Loan balance: $2,400 Loan balance: $3,250 Loan balance: $4,500
Income: $52k Income: ? Income: ?
Own House: Yes Own House: Yes Own House: Yes
Other delinquent accts: 2 Other delinquent accts: 2 Other delinquent accts: 3
Max billing cycles late: 3 Max billing cycles late: 4 Max billing cycles late: 6
Profitable customer?: ? Profitable customer?: ? Profitable customer?: No
... ... ...
Customer103: (time=t0) Customer103: (time=t1) ... Customer103: (time=tn)
Sex: M Sex: M Sex: M
Age: 53 Age: 53 Age: 53
Income: $50k Income: $50k Income: $50k
Own House: Yes Own House: Yes Own House: Yes
MS Products: Word MS Products: Word MS Products: Word
Computer: 386 PC Computer: Pentium Computer: Pentium
Purchase Excel?: ? Purchase Excel?: ? Purchase Excel?: Yes
... ... ...

Customer103: (time=t0) Customer103: (time=t1) ... Customer103: (time=tn)


Sex: M Sex: M Sex: M
Age: 53 Age: 53 Age: 53
Income: $50k Income: $50k Income: $50k
Own House: Yes Own House: Yes Own House: Yes
Checking: $5k Checking: $20k Checking: $0
Savings: $15k Savings: $0 Savings: $0
Current−customer?:
... yes ...
Current−customer?: yes Current−customer?: No

Product72: (time=t0) Product72: (time=t1) ... Product72: (time=tn)


Stage: mix Stage: cook Stage: cool
Mixing−speed: 60rpm Temperature: 325 Fan−speed: medium
Viscosity: 1.3 Viscosity: 3.2 Viscosity: 1.3
Fat content: 15% Fat content: 12% Fat content: 12%
Density: 2.8 Density: 1.1 Density: 1.2
Spectral peak: 2800 Spectral peak: 3200 Spectral peak: 3100
Product underweight?: ?? Product underweight?: ?? Product underweight?: Yes
... ... ...
Sharp Straight Sharp
Left Ahead Right

30 Output
Units

4 Hidden
Units

30x32 Sensor
Input Retina
Determine Type
of Training Experience

Games against ...


experts Table of correct
Games against moves
self

Determine
Target Function

Board Board ...


➝ move ➝ value

Determine Representation
of Learned Function

...
Polynomial
Linear function Artificial neural
of six features network

Determine
Learning Algorithm

Linear ...
Gradient programming
descent

Completed Design
Instances X Hypotheses H

Specific

h h
x1 1 3

h
x 2
2
General

x1= <Sunny, Warm, High, Strong, Cool, Same> h 1= <Sunny, ?, ?, Strong, ?, ?>
x = <Sunny, Warm, High, Light, Warm, Same> h = <Sunny, ?, ?, ?, ?, ?>
2 2
h = <Sunny, ?, ?, ?, Cool, ?>
3
Instances X Hypotheses H

-
h0 Specific
x3
h1

h 2,3
x 1+ x+
2

x4+ h General
4

h = <∅, ∅, ∅, ∅, ∅, ∅>
0
x 1 = <Sunny Warm Normal Strong Warm Same>, + h1 = <Sunny Warm Normal Strong Warm Sam
x 2 = <Sunny Warm High Strong Warm Same>, + h2 = <Sunny Warm ? Strong Warm Same>
x 3 = <Rainy Cold High Strong Warm Change>, - h = <Sunny Warm ? Strong Warm Same>
3
x = <Sunny Warm High Strong Cool Change>, + h = <Sunny Warm ? Strong ? ? >
4 4
S: { <Sunny, Warm, ?, Strong, ?, ?> }

<Sunny, ?, ?, Strong, ?, ?> <Sunny, Warm, ?, ?, ?, ?> <?, Warm, ?, Strong, ?, ?>

G: { <Sunny, ?, ?, ?, ?, ?>, <?, Warm, ?, ?, ?, ?> }


S : {<Ø, Ø, Ø, Ø, Ø, Ø>}
0

G 0: {<?, ?, ?, ?, ?, ?>}
S: { <Sunny, Warm, ?, Strong, ?, ?> }

<Sunny, ?, ?, Strong, ?, ?> <Sunny, Warm, ?, ?, ?, ?> <?, Warm, ?, Strong, ?, ?>

G: { <Sunny, ?, ?, ?, ?, ?>, <?, Warm, ?, ?, ?, ?> }


S: { <Sunny, Warm, ?, Strong, ?, ?> }

<Sunny, ?, ?, Strong, ?, ?> <Sunny, Warm, ?, ?, ?, ?> <?, Warm, ?, Strong, ?, ?>

G: { <Sunny, ?, ?, ?, ?, ?>, <?, Warm, ?, ?, ?, ?> }


Inductive system
Classification of
Training examples Candidate new instance, or
Elimination "don’t know"
Algorithm
New instance Using Hypothesis
Space H

Equivalent deductive system


Classification of
Training examples new instance, or
"don’t know"
Theorem Prover
New instance

Assertion " H contains


the target concept"

Inductive bias
made explicit
Outlook

Sunny Overcast Rain

Humidity Yes Wind

High Normal Strong Weak

No Yes No Yes
[29+,35-] A1=? [29+,35-] A2=?

t f t f

[21+,5-] [8+,30-] [18+,33-] [11+,2-]


1.0
Entropy(S)

0.5

0.0 0.5 1.0


p
+
[29+,35-] A1=? [29+,35-] A2=?

t f t f

[21+,5-] [8+,30-] [18+,33-] [11+,2-]


Which attribute is the best classifier?

S: [9+,5-] S: [9+,5-]
E =0.940 E =0.940

Humidity Wind

High Normal Weak Strong

[3+,4-] [6+,1-] [6+,2-] [3+,3-]


E =0.985 E =0.592 E =0.811 E =1.00

Gain (S, Humidity ) Gain (S, Wind )


= .940 - (7/14).985 - (7/14).592 = .940 - (8/14).811 - (6/14)1.0
= .151 = .048
{D1, D2, ..., D14}
[9+,5−]

Outlook

Sunny Overcast Rain

{D1,D2,D8,D9,D11} {D3,D7,D12,D13} {D4,D5,D6,D10,D14}


[2+,3−] [4+,0−] [3+,2−]

? Yes ?

Which attribute should be tested here?

Ssunny = {D1,D2,D8,D9,D11}

Gain (Ssunny , Humidity) = .970 − (3/5) 0.0 − (2/5) 0.0 = .970

Gain (Ssunny , Temperature) = .970 − (2/5) 0.0 − (2/5) 1.0 − (1/5) 0.0 = .570
Gain (Ssunny , Wind) = .970 − (2/5) 1.0 − (3/5) .918 = .019
+ – +

...
A2
A1
+ – + + + – + –

...

A2 A2

+ – + – + – + –
A3 A4

+

... ...
Outlook

Sunny Overcast Rain

Humidity Yes Wind

High Normal Strong Weak

No Yes No Yes
0.9

0.85

0.8

0.75
Accuracy

0.7

0.65

0.6 On training data


On test data
0.55

0.5
0 10 20 30 40 50 60 70 80 90 100
Size of tree (number of nodes)
0.9

0.85

0.8

0.75
Accuracy

0.7

0.65

0.6 On training data


On test data
0.55 On test data (during pruning)

0.5
0 10 20 30 40 50 60 70 80 90 100
Size of tree (number of nodes)
Outlook

Sunny Overcast Rain

Humidity Yes Wind

High Normal Strong Weak

No Yes No Yes
Sharp Straight Sharp
Left Ahead Right

30 Output
Units

4 Hidden
Units

30x32 Sensor
Input Retina
x1 w1 x0=1
w0
x2 w2

.
. Σ n
Σ wi xi n

xn
. wn i=0
{
o=
1 if Σ wi xi > 0
i=0
-1 otherwise
x2 x2
+
+
- + -
+
x1 x1
- - +
-

(a) (b)
25

20

15
E[w]

10

0
2

1
-2
-1
0 0
1
2
-1 3
w0 w1
head hid who’d hood
... ...

F1 F2
x1 w1 x0 = 1
x2 w2 w0

.
. Σ n
net = Σ wi xi 1
. wn i=0 o = σ(net) = -net
1+e
xn
Inputs Outputs
Inputs Outputs
Sum of squared errors for each output unit
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
0 500 1000 1500 2000 2500
Hidden unit encoding for input 01000000
1
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0 500 1000 1500 2000 2500
Weights from inputs to one hidden unit
4
3
2
1
0
-1
-2
-3
-4
-5
0 500 1000 1500 2000 2500
Error versus weight updates (example 1)
0.01
0.009 Training set error
Validation set error
0.008
0.007
Error

0.006
0.005
0.004
0.003
0.002
0 5000 10000 15000 20000
Number of weight updates

Error versus weight updates (example 2)


0.08
0.07 Training set error
Validation set error
0.06
0.05
Error

0.04
0.03
0.02
0.01
0
0 1000 2000 3000 4000 5000 6000
Number of weight updates
... ...
... ...
y(t + 1) y(t + 1)

x(t) x(t) c(t)

(a) Feedforward network (b) Recurrent network

y(t + 1)

x(t) c(t)

y(t)

x(t – 1) c(t – 1)

y(t – 1)

x(t – 2) c(t – 2)
(c) Recurrent network
unfolded in time
Binomial distribution for n = 40, p = 0.3
0.14
0.12
0.1
0.08
P(r)

0.06
0.04
0.02
0
0 5 10 15 20 25 30 35 40
Binomial distribution for n = 40, p = 0.3
0.14
0.12
0.1
0.08
P(r)

0.06
0.04
0.02
0
0 5 10 15 20 25 30 35 40
Normal distribution with mean 0, standard deviation 1
0.4
0.35
0.3
0.25
0.2
0.15
0.1
0.05
0
-3 -2 -1 0 1 2 3
0.4
0.35
0.3
0.25
0.2
0.15
0.1
0.05
0
-3 -2 -1 0 1 2 3
P(h ) P(h|D1) P(h|D1, D2)

hypotheses hypotheses hypotheses


(a) ( b) ( c)
Inductive system

Training examples D Output hypotheses


Candidate
Elimination
Hypothesis space H Algorithm

Equivalent Bayesian inference system


Training examples D
Output hypotheses
Hypothesis space H
Brute force
MAP learner
P(h) uniform
P(D|h) = 0 if inconsistent,
= 1 if consistent

Prior assumptions
made explicit
y

hML

x
20News
100
90
80
70 Bayes
TFIDF
60 PRTFIDF
50
40
30
20
10
0
100 1000 10000
Storm BusTourGroup

S,B S,¬B ¬S,B ¬S,¬B


C 0.4 0.1 0.8 0.2
Lightning Campfire
¬C 0.6 0.9 0.2 0.8

Campfire

Thunder ForestFire
Storm BusTourGroup

S,B S,¬B ¬S,B ¬S,¬B


C 0.4 0.1 0.8 0.2
Lightning Campfire
¬C 0.6 0.9 0.2 0.8

Campfire

Thunder ForestFire
p(x)

x



+ +
xq

+ −
+

f(x)

w0 w1 wk
1 ...

...
a 1 (x) a2 (x) a n (x)
A stored case: T−junction pipe
Structure: Function:
Q ,T T = temperature
1 1 Q +
Q = waterflow 1
Q
3
Q +
2
Q ,T
3 3
T +
1
T
3
Q ,T T +
2 2 2

A problem specification: Water faucet

Structure: Function:
+

?
C Q +
t + c
+ + Q
m
C + Q
f h −
+
T +
c
T
m
T
h +
Initial strings Crossover Mask Offspring

Single-point crossover:
11101001000 11101010101
11111000000

00001010101 00001001000

Two-point crossover:
11101001000 11001011000
00111110000

00001010101 00101000101

Uniform crossover:
11101001000 10001000100
10011010011

00001010101 01101011001

Point mutation: 11101001000 11101011000


+

sin

x +

^ y

x 2
+ +

sin ^ sin

2 + +
x x

x y ^ y

x 2

+ +

sin ^ sin

2 ^ +
x x

x 2 + y

x y
n
e
s
r v u l a i
IF
THEN PlayTennis=yes

IF Wind=weak
THEN PlayTennis=yes
...
IF Wind=strong IF Humidity=high
THEN PlayTennis=no IF Humidity=normal THEN PlayTennis=no
THEN PlayTennis=yes

IF Humidity=normal
Wind=weak
THEN PlayTennis=yes
...
IF Humidity=normal IF Humidity=normal
Wind=strong IF Humidity=normal Outlook=rain
THEN PlayTennis=yes Outlook=sunny THEN PlayTennis=yes
THEN PlayTennis=yes
C : KnowMaterial V Study C : KnowMaterial V Study
2 2

C : PassExam V KnowMaterial C : PassExam V KnowMaterial


1 1

C: PassExam V Study
C: PassExam V Study
Father (Tom, Bob) GrandChild ( y,x ) V Father ( x,z ) V Father ( z,y )

{Bob/y, Tom/z}

Father (Shannon, Tom ) GrandChild ( Bob,x) V Father ( x,Tom )

{Shannon/x}

GrandChild ( Bob, Shannon)


Agent

State Reward Action

Environment

a0 a1 a2
s0 s1 s2 ...
r0 r1 r2

Goal: Learn to choose actions that maximize

r + γ r + γ 2 r + ... , where 0 < γ <1


0 1 2
0
0 100
G
0
0 0
0 0 100
0 0

0 0

0
90 100
G 90 100 G
81 0
72 81
81 90 100
81 90
81 90 100
72 81

G
72 100 90 100
R R
63 63
81 81

a right

initial state: s1 next state: s2

You might also like