This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Ill. 33 Basic Vector Operations
This is a brief review of some basic linear algebra l:] .
inner product:<g,y>= 3Ty= 31ng X xi yi =
1
absolute value or length or Euclidean norm lzl = ll LII = §T L = (2(xi)2)1/2
How to make a unit vector (divide by length) u = g / M
X
I



Projection of 3: onto 5
3
14
ET A = ET g ° IX!
Basis for vector space
u1,u2, ,gn are abasis ifany gcan be written 3: a] u] + azuz + +an un Orthonormal Basis if if gj :0 for i¢j and ui _i=l III. 34
Some Examples of Linear Operations on Data Samples Taken from an Action Potential The examples below are intended to help you think about linear transformations in general and in
particular, how they may be used to find patterns which are interesting. An essential idea is that,
whenever you take the dot product of a weight vector with a data vector, you are “looking for data which
looks like the weight vector”. Another way to think about it is that taking the dot product is a way of
asking “how much does the data look like the weight vector”. Of course a linear transformation usually
takes several dot products at the same time. 1 ix
II
Nv—awOOUN—‘l Standard Representation  Identity Basis
A tedious but correct way to describe the vector 5; is: gz—iu1—2u2+1u3+5u4+8u5+3 u6—1u7—2u8 where u 1 = oooooooi—A
I:
l\)
II
OOOOOOi—‘O
Is:
00
ll
#0000000 and the ui’s are the columns of the Identity Matrix I>—4
ll III. 35 Haar Representation
Another representation is related to the Haar Transform has alternations in sign, like a sinusoid, but uses the values of only 0, l, or ~l. (It could be considered the “poor man’s Fourier transform” 
you don’t need to do any multiplying  just adding or subtracting  and can find out frequency like information without a fast computer). Although the Haar transform is useful —— and has been used in the action potential sorting
research literature — the reason to introduce it here is to have you consider that there are lots of different
linear transforms, each one of which emphasizes different qualities of the raw data. 1 l l
l l l
I l —l
l l —l
Q1: 1 \/§ hz— 1 —\/§ h3— Q ﬁll—1
l —l O
l —l O
l —l 0
0 l 0
0 —l O
O O l
0 0 —1
D4: 1 +\/Z hs 0 +45 he: 0 +N/5
1 O 0
1 0 0
_1 0 0
O O
0 O
0 O
O 0
Q7: 1 +‘\/5 big: 0 +Nl§
—l O
0 l
O 1 The Haar representation has alternating signs. A quality of taking a dot product is that it provides a
quantitative answer to the question: “how much does the signal vector look like ....?” The Haar
functions “look like” action potentials with different widths, as you can see here. a= l—% 2% Fu— 19* W
a: l—Ilj— / action potentials
I) N‘—l til— i III. 36
Note the the hi’s are orthonormal and that 11TH = the identity matrix. J "10000000 thhrthh2~h1Ths 01000000 1gb] 00100000 Let E: h1h2 L18 thenﬂTﬂz =00010000
00001000 '  00000100 hgm @118 00000010 000000014 Action Potential Representation
Our example action potential can be represented by the following 23:39:11—1.8h2—45h3l7h4+0.7h5—2.8h6+3.5h7+0.7hg or, 23H = which is a shorthand notation for 3 represented on the H basis You can interpret this result as saying that our AP has an average value of 3.9, and looks a lot
(value = 7) like the “square looking” action potential h4. Here is how you convert from one basis to another: Let £1: 5 represented on “normal” basis gH = 3 represented on Haar basis then 5 =ﬂ; and 2g =ﬂ"lx =HTX
H I I H H H1. 37 Discrete Sine/Cosine Transforms The same strategy can be used with the discrete sine and cosine transforms, which are the way Fourier
transforms were computed before the era of computers. cos 0°
cos 0° 0
O l I 00'  HHP—dt—db—‘h—db—‘bd l 00' cos 135°
cos 180° 19
II .in
[\3
ll
I—_————ﬁ
v 0' ll v
a» mi L». L».
mommmowm
/ cos 535° cosO°
cos90
coslSO
cos270
COS360 :
cos450
cosS40
005630 :J I
N
H
a, u 'l a
Omom0mom
ll cos 0°
cos 135° IO
U)
H J?
u = 0 (not used) cos 0
cos 180
cos 360
94 = j
L III. 38 sin 0
sin 180
sin 360 sin 0
[$111 135] 3
sin 270 —5
. .35
S3 = + 2 : 0 L61 Q: [9021929394. §1§2§3]
Then LC = Q 31
or 3:39 QO—8.7_C_1 +3.5 Q2—0.3_C_3+1.1§_4+1.7 _S_1—1,0§2—.3§3
3.9 represented on COS/SIN basis
—8.7
3.5
—O.3
0r Kc = 1.1
L (— “how much does AP look like sine wave ﬁl”
_ _ T Ill. 39 Fourier Transform Representation
Here we’ve used some informal notation to help with the representation of the complex vectors used in the Fourier Transform. Otherwise, the methodology above is the same as above — but the basis
vectors are complex. em“ I] >
eio‘“ l —>
610: 1 __) 'Ivectors pointing in the 0° direction
$00 1 _> in complex plane
1’10 = 6} —~l§ = +V§ =
6,10 l —>
610° 1 —>
6,103 1 ——)
Lew 1_ ——>
' 610° ' cos(Oc)+ j sin(0°) ‘ l 1 _
ewe cos(453) + j sin<455> ~5 + W a
em cos(90°) + j sin(90°) j 2
C  ms“ ' ' C '5— T
W : 1+JS] = 6 +Vrg: cos(l35 )+Jsm(l35) +Jg: V J ~ +x/g R
i {2‘ also: cos(180°)+ j sin(180°) —1 <E
652256 c0592?) +j sin<225c) —«/§ — b5 ¢
6137“ cos(270c) +j sin(2709) “j \
LCM J cos(315°)+ j sin(315°)J _ﬁ HWJ
r eJOC 7 cos(05)+ j sinar) “ 1 ' [—91
619‘“ cos(90°) +j sin(90°) j T
CW? cos(l800)+j 51110803) —1 s
7 ' a W 2703 +' ' 270° —‘ i = = e. c CO“ 3 W 3 mg =
N5 61360 cos(360 )+] sm(360 ) 1 ‘9
€450: cos(4500)+j sin(450°) T
ej540° cos(540°)+j sin(540°) ‘1 (—
Let/>30" _ cos(630°) + j sin(630° )d —j_ _ H
l’ 630 ' — l 1 WkO
ejiasc —1 £5 = 313* Wm
61270 1 I ‘ Wu
614050 —1 V— \CGmpiex Wk; 1 J,21tkm
__ _ :: + : ~ = _ 8
3’23 ejsw \/§ W4 1 8 conjugate) Wk wk4 ka wfge
61675” —1 ‘16: E; WkS
61810 1 WM:
1915: L_.1 E7: 141* W
_ J ‘— k7 111. 40
Representing the action potential with Fourier Coefﬁcients aw = E31
3.9
—6.2+j1.2 §=3.9wo+(—6.2+j1.2)ﬂ1
2.5—j0.7 +...+(—6.2—j1.2)m7
—0.2 j 0.2
éw — 1.1 ~
‘02 +1 02 (Since X is real the imaginary parts must
2.5 +J 0.7 cancel)
~62 —} 1.2
3.9 1 0° AP
6.3 416 170°
2.5 X —16°
0.3 )1 —130a
3W ’ 1.1 a: 03
0.3 1 130° A . h
cosme Wit
2.6 160
a: a 1700 phase
6.3 l —170 Shift
the AP looks a lot (amplitude 6.3)
like a cosine with a 170° phase shift t = 0 Equivalence of Fourier and Cos/Sin Bases ﬂ0=§0 ﬂ1=Q1+131
ﬂ2=§2+132
_W.3=Q3+JS3
w=§4 E5=Q3153
916:22—152
ﬂ7=.C_1—151 Ill. 41 Transformations are Rotations All orthonormal transformations to new orthonormal bases are rotations. This is easy to see in the 2
dimensional case. It also applies to Fourier transform, Haar transform, etc, but it is harder to imagine. the basis you are
used to transformation rule cosG —sin6 cos 6 —sin6 r : _ 1‘ = R: .
‘1 sme ’2 +COSG Sine C056 5 can be represented by
£1= 3 21 + 5 22 KR = 5.1 r] +2.8 :2 =r1):1+ r2) :2 Ill. 42 Distance Measures in Vector Spaces E2 3 (X1 — X2)2 + (Yr — y2)‘ for n dimensional
n 1/2
(115 = E (XiYi)2 = 11:qu = Ilwlz y d}; = Euclidean distance = dCBD = 2 [Xi*Yi = Ila—XHCBD = Ila—EH] : — EH A (absolute value) Max (Error) Distance dA = .max lxi—yi'
1:1, n amb) = lll*¥llM b =lé*¥ltm III. 43 Egui—Distance Lines Euclidean circles
centered about gaumsiq >13 : KID
means Maximum Error Distance squares
about
means Two Class Two Feature Decisions f /
2 1 / locus
. / equidi
/ 1
/
/
/
/ / o 2 (l
/
f2
0
1 locus of
<————— equidistant
/ points
max CI‘I‘OI‘ ‘2 III. 44
Classiﬁcation Problem: Which class does AP x belong to? distances from unit 1: c1131 = \/(6—3)3+(7—4)2 = \lﬁi dCBD1= l63l+l74l=6 dMl = max ([6 — 3, 7 — 4) = 3 (best according to Max Error Distance)
distances from unit 2: DE2 = \l(6 — 7)2 + (7 — 11)2 = \Iﬁ (best accoreding t0 Euclidean Distance) dCBD2 = 6 — 7 + {7 — 111 = 5 (best according to City Block Distance)
dM2 = max(6—7,7—11)=4 Separation Matrices a wav of represeting the pairwise distances between points distances between
mean values of 2 features for
each of4 classes III. 45 Gaussian Probability Density Function
What happens when their is unequal variance? This can occur simply because the units are different —— for instance if one measure is in cm and another is in mm, it is likely that the scatter is
unequal in the different directions. What happens when there is non—zero covariance? This happens
when two variables tend to change together. The formula for Gaussian distributed variables is given below, as well as a graphical description of what happens in two—dimensions. PG) €XP[—%(§ — mlTlé—l (é — ml] / “isoprobability” curves width amplitude
width ﬂ. i a  cluster diagram
each point is from
one AP waveform iamplitude
This leads to the problem highlighted below. a is clearly closer to the mean when measured with a ruler, while b is clearly closer in a probabilistic sense. What is needed is an algorithm which will
“measure” the distance in a way which agrees with our intuitive understanding. This algorithm can be derived if it is assumed that the variables are Gaussian distributed. 8 Which is closer to In? a or
b?
in. Which is more likely to
happen? a or b?
b
One way to do this is to use the following measure of distance: dMaln = (g — mﬂ 191 (1 — m) This is the Mahalanobis distance (of course, Mahalanobis did this firstl). It does exactly what we want. H1. 46 A second way is to transform the coordinate system using a linear transformation so that the
distribution is no longer cigar shaped, but instead looks spherical. All contours are perfect circles
<————— about mean (equal variance;
covariance = 0)
Here’s the procedure: assume that the matrix inverse K'1 exists
. , 7 _ , T s »
assume that you can take its “square root” K‘”‘ such that K 1= (K 1/2) K 1/“ then
1 1 _ i T _ ,
Pfé) = €XP[—;(§—E)T(K V') K UTE31.)]
or
1 l A A T A A
13(5) = CXP['E(§‘Q) (rmﬂ
where >1 = Ema; Q = Eng In words, this means that if you do the transformations of the vector and the mean into the A coordinate
system, then you can mesure the distances directly (“with a ruler”). The picture below shows that there
are two things which happen: first, there is a rotation of the axes such that the principal axes are now
along the x and the y directions; second, the axes have been either stretched or compressed so that one
unit equals one standard deviation. Thus, this is a statistical representation. The distribution is said to
have been “whitened” because the variation in any direction is equal to and independent of the variation
in any other direction. Thus, the noise or variation is like white light  its magnitude is independent of
the measurement (analogous to wavelength). +/— o +/— 1 “whitened” distribution ...
View
Full
Document
 Spring '08
 PRINCIPE
 Signal Processing

Click to edit the document details