Iris
Example
Given
Xz
X4
of
Sepal
:
:
Petal
length
(cm)
width
X
=
(cm)
Versicolour
types
=
,
Virginica
Iris
flowers
I &
[x +x2x39x]xx4
,
of
XI
X
((m)
width
Petal
:
three
,
(data points)
15 0
Sepal length (cm)
X:
X2
=
Setosa
-
features
4
data :
N
flowers
X2
X3
X4
Setosa
Versicolour
Virginica
rows
> 50
-
>
-
50 rows
- 50 rows
>
MX4
Goal
:
Given
the
such
classifier
it
that
Virginica
>
-
Versicolour
outcome
from
[ I
-
false
false
Y
to
Versicolour
150 XI
a
Boolean
classifier
50
Fals e
True
3
Need
data
Total
False
-
and
Setosa
able
Predicts
True
>
-
Setos a
Actual
,
be
should
classifier
Virginica
Class
distinguish
data
for
Iwis
points
each
flower
class
150
of
In
python
True
False
TIF
are
used
Convert
in
>
-
>
-
0
2
converted
3
to
numerical
Actual
Convert
to
olz
0/1
use
-112
3 heat y
y
when
=
2b
-
1
function
expression
outcomes
Actual
outcomes
from
·
TIF
[J
to
-1/th
to
-1 +
To
do
Design
:
predict
to
closest
Outcomes
which
classifier
Boolean
a
can
based
outcomes
actual
on
-
the
X,
Since
data
get
the
XI
9
Need
1)
2)
data
flower
Iris
,
Y
has
,
X39
&
**
,
based
features
on
we
a
can
Regression
model
use
,
predictions
Regression
linear
model
classifier
f(x)
f(x)
Regression
+
=
X
B +
model
c
Iris
>0
=>
Virginica
to
Linear
-
real
our
f(x)
u +
=
02
,
03 04
,
XI < X2
f(x)
=
Xy
,
0 .. 1
p
,
x
+
B2Xz
05
,
,
X4
+
feature
-
02
03 fz(x) + 04 fq(x)
of the
parameters
-
.
+
x
,
+
03
-
x8
+
04 x3
-
model
+
05 f5(x)
model
of
vectors
XB + c
B4X4
+
33x4
=
regression
linear
as
+
f(x)
=>
affine
function
Of , (x) + O2fz(x)
=
,
valued
f(x)
is
f(x)
>
regression
Consider
Q
model
Regression
&
2
the
+
data
05
-
X
=
AO
f(x)
=
AO
I
x)
AXX)22
"
I
. . . .
(2)
XI
X
)
i
(N)
a
=
[x
N X5
A
(2x x2xx]
+
=
or
A
=
[2
m
Xm]
Find
least
=
square
M
Use
fitting
Answer
Least
model
fit
such
Y
the
that
Predicts
=
minimum
A
A
where
= (ATA)
and
minimum
is
data
"At y
the
residual
11 y-y/1
Square
has
is
.
matrix
defined
Y
is
actual
outcomes
-
y
Check
of
Elements
>
-
#
=
A
<
o
Predictions
Actual
out comes
y
y
=
+ 1
-
=
1
=>
Virginica
Fris
Matrix
Confusion
Compute
Predictions
y
=
+ 1
N+
P
NfP
y
=
1
Nfu
Np
Nen
Nu
.
-
Multi-class
classifiers
classification
for
>
-
lets
say
>
-
We
want
labels
a
>
-
Confusion
,
2
...
,
classifier
F(x)
-
2
are
labels
2
than
more
:
features
matrix
R2
+
the
in
:
&
1
,
data
1XK
2
,
. . .
k3
Predicted
Actual
Come
out
y
=
1
y
=
2
I
M
Y
=
2
y
=
out comes
....
2
Nt1
Nf2
No
N
Y
=
k
NfK
-...
-
+ z
NfK
↑
"
"
I
-
y
=
12
Nf1
Diagonal
Nf2
terms
.
=
...
true
Ntk
predictions
predi
c
ti
offalse
Number
is
Error
=
rate
(Sum
Error rate
100
=
=
74
%
model
4X4
-
diagonal
↓ of
I
10026
made
predictions
is
.
wrong
by
=
0
the
.
74
Least
Square
labels
>
-
multi-class
are
K
Divide
Label (l)
1
2
2
,
2 ....
labels
to
K
,
Total
data
Boolean
K
TIF
TI F
TIF
3
points
=
N
classification
classification
!
K
classifier
K
Boolean
classifications
Actual
outcomes
Y
Ii
=
li
,
12 ,
--
.
(E(1
,
2
,
&
We
want
predict
to
design
correct
How
a
classifier
label
for
to
achieve
each
this
,
data
?
which
can
.
point
. . .
k)
classifier
Design
for
model
Create
of
each
I
labels
these
A De
=
l
Or
>
-
=
n
parameter
,
[F
...
for
model
[i]
NXK
each
=
label
Anx
[
0,
0
. . .
ok]
NXK
This
fit
is
problem
Solve
-
-
based
equivalent
YNXK
on
K
solving
to
Least
Onxk
Avxn
I
Onxi
=
Onxl
we
(ATA)"ANYNX
nxn
,
have
predictions
(1)
Y
I
[T
N Y
. . .
=
square
Je
YXK
Yaxy
Predicted
out comes
In
python
compare
Confusion
Argunax (Ynxx)
=
Choose the
largest
in
a
the
,
gives
argmax
with
matrix
index
actual
and
outcomes
error
of
to
.
rate
maximum
value
givenwow
correct
value
calculate
as
label
Feature
Create
new
above
4
d
Mi
Can
be
data
features
L
features
d
=
flower
Iris
of
Features
>
-
=>
Engineering
Vie X1
&
d
+
Viz
*2
+
VisXy
X,
X2
by wandomly mixing
&
+
**
X3
i
WieX
=
1, 2
,
written
↓
as
M
=
XRT
Random
Wij e
mixing
(1 1)
,
...
L
New
1
(1)
mi
(1)
M2
features
original
features
. . .
my I
(1)
XI
X , (2)
=
- MIN
N
mIN)
(N)
X,
) [i]
(1)
Xz
X)
x2(2)
x(
I
:!
x(N)
Mixing matrix
)
*
X3
(1)
X4
X
,)
Wis
X4
Wik
NX4
NXL
↑ XL
mone
M
RT
X
M
=
(m
,
dm
-
. .
ma]
=
[X &
&
x2
x3X]RT
i is
classify
Goal :
flower
as
Setosa ,
Versicolour
Virginica
classifier
such
that
Virginica
Setos a
Versicolour
Actual
outcomes
·
[]
it
Predicts
3
Need
a
Boolean
classifier
and
#Construct
f(x)
A
#
a
v
=
#
+
B
, x
+
L
B2Xz
=
+
B3x3
my
xix2xxym
[2
*
features
width
regression
model
and
In
negative
. . .
,
Fris
flowers
length
cannot
of
the
new
B4X +
my] xx(L 5)
width
negative
be
,
B4 + i
Mi
&
(5) xI
+
petal
features
+
&
length
,
Sepal
.
there
be
should
terms .
A
M3]
[19xx29x39Xax30
,
=
no
max
the
(0
,
M)
elements
where
of
M
Matrix
is
a
returns
matrix
M 70
[
replaces
values
the
negative
by Zero
3