You are on page 1of 5

Okay, now what I got to ask is here's,

here's the test by the way. I get these


values Pval it's a number. I've projected
it onto the twenty features, I've
projected onto the plane. I now have a
single number. And, that is called Pval.
So all for, all 38 pictures, I get a
number. And then all I got to do is do
this, Resvac is Pval greater than
threshold? Now, threshold came back from
my trainer. It was, it was this number.
The number where the separation happens.
Something in this example, like 12.3
something, or 12.13, or. It's a, it's a
number. What does that mean? In
abstraction, that is your decision line.
When everything's projected onto these
twenty features, and onto this linear
discriminational plane, the number you get
is twelve, or thereabouts. Bigger than
twelve you're a cat. Lower than twelve,
you're a dog. Right. I mean some would
argue that's what we're doing,
cognitively, when we recognize people. You
see something. You're making a decision.
Is that a dog or a cat? And somehow, all
it's doing is some projections to get a
score, and it says, oh yeah. That's a dog,
that's a cat. Telling, you know, doing
very bright, basic, functionality of this
sort, okay? So what this, so Pval is a
bunch of numbers, and this vector, if it's
bigger than threshold, turns it into a
one, if it's lower than this number, it's
a zero. So every vector component either
gets turned into a one or zero using this
command structure here, okay? Well test
numbers is the length of Pval. And, now
we're going to display the number of
mistakes. Here it is. By the way, there
was this vector that we put in there
called hidden labels. What are those?
Hidden labels are ones of . These are the
true answers. True answers that, hey I
looked, that's a dog, that's a cat, I did
that by my sight. I have a truth table.
Truth table is hidden labels. So. Hidden
labels is either one or 0s. Depending on
if it's a cat or dog. is either one or
zero, depending on if the computer thinks
it is a cat or dog. If I got everything
right, that is zero. But, if it turns out
that this is a one, when that's a zero, I
got it wrong, or if this is zero and
that's a one, I got it wrong. So I take
the absolute value of that and I sum'em
up. So I sum up the total, number of 1's
that I got, wrong, and I just, that's my
error number, okay? And the error number
is one minus this value over the test
number. So if I've 38, I, I count up the
number I got wrong or right, divided by
38, there's my percentage. Simple as that.
Everybody good with that? Okay all right,
final little piece here. All this code
does here. Is going to show me the ones I
got wrong, if I got some wrong. So, I'm
going to go through this thing say, hey, I
have some I can look at the air vec thing
and I can basically go through this thing
and I can look, when res vec does not
equal hidden labels, res vec tells me it's
one or zero for cat, dog, hidden labels
tells me one, zero if it's cat and dog.
But this is right, this is my truth and
I'm not sure if this is truth. These
should be the same, if I got everything
right. So if they're not the same, that
means I have an error. Now what I'm going
to do is, I'm going to go through all
these things and I'm going to look to see
when are they not the same, and whenever
they're not the same, I'm going to go grab
that one. I'm going to turn it into a
after the , and I'm going to, I'm going to
plot it. And your going to see which ones
are right, or which ones are wrong, okay?
Ready? It's going to run it, and then
you'll see. And, another comment, watch
how fast this runs. I did everything. The
whole code. All those SVDs. All the
wavelet transforms, almost
instantaneously. And what plotted up here
were my mistakes. I made two mistakes. My
accuracy was about 95%. I trained it. Let
the computers say. And with these 38
pictures only got two wrong. Which two?
These two. Why did it get it wrong? So
obvious. The ears. The ears, right? And
you can imagine, oh. So I could think
about enhancing the algorithm. All we did
is say, take the edges and project ''em.
You can enhance the al gorithm by looking
for other things, but clearly here, you
get the ears, and these things come out,
then, as cats. They're labeled as cats
because of the ears. And so you start
seeing how the algorithm is looking for
it. And by the way, maybe how you're
looking for it. You know, just by looking
at the ears, in some sense. Right? This, I
think, I think the message here is, what
the computer told you. It's something that
maybe afterwards you think about. It's
like, oh that's kind of true maybe, right?
Which is, we can do a first cut at
evaluating your dog or cat just by looking
at it's ears. If we just catch the sight
of it's ears, y, you're 95% chance it's
going to be right that it's dog or cat.
And then you'd have to do things like, oh
well why, by the way how can you tell it's
a dog? The nose. There's 3D information
here, right? You, we have this perspective
that, oh that nose extends out, cats don't
have that, okay? So, knowing that, you can
think about building an algorithm that
would take that into account. We have 3D
information, don't we? We look at a cat
and dog, we have 3D. But, by the way, we
can do it even with 2D images, trivially.
You look at that, you knew they were dogs.
How'd you know that? Well, cuz you kind of
project 3D into this thing. You could tune
your computer to project 3D into this
thing, maybe. Right? Be fancier than this.
You see how fast that ran? Matter of
seconds. Did all of it. That's pretty
remarkable, I think. And by the way, let
me just add this. If you are not impressed
by any of this, this is probably the wrong
course for you. This, this I think is
amazingly impressive. That we can write in
a series of a week of lectures, an
algorithm that does this. Gets you 95%
accurate. And, by the way, runs in, like,
two seconds. That's. This is what. I mean.
If you think about where you were.
Alright. You know, January two or three.
What, before I start this course, taught
this course, I think about, what did I
know about data before I taught this
course? Mean, variance, I'm assuming, I'
m, I'm guessing, that most of you, that's
kind of what you knew about data. Yeah,
yeah, yeah, you got the data probably
calculate the mean and the variance. Cause
that's what you knew how to do. Right? And
now look at you! All grown up! . Doing
stuff like this, okay? It's a whole
different ballgame out there. And if you
look at where you are now versus then, you
know. Part of this is what I always like
to encourage people to think about,
reflect upon. What you can start thinking
about now, versus what you used to be able
to even conceive back then. That's, that's
the educational value. Now, let's do one
more thing here. I want to, I want to show
you a couple more pictures here. we can
try and see how this thing works, on. I
don't know how much time we have to do
but, let's, let's try. These were
suggestions of, dogs and cats from class.
So, from people in class. Not all of them,
as you'll see. But here. We're going to
ask. . . If I were in a classify these,
how would they come across? Now let me
explain so there's these are some class
dogs, we put in a cat which was actually
not a real cat but a, whatever leopard
cheetah. Whatever. Something cat like.
Scooby-doo. This ugliest dog in the world
winner, like two years in a row. That is
an ugly dog. And we have a deer. We have
this guy whose the one in the Thunder
cats. Cartoon dude. And this guys' like
this bounty hunter on Tv. What's his name?
Do you guys know his name? What was that?
I'm Doug. Doug. Yeah the name's dog.
[LAUGH] I've never seen this show. But
someone sent it to me and said, hey you
should check out dog is dog and so, this
is going to be our data. And what I'm
going to do is take this data, and each
one of these that I either got sent to me
or downloaded off the web come with
different resolutions. So the idea is
first you have to turn it into a 64 by 64.
Okay, so these nine pictures, and you turn
them into 64 by 64s. Here's what they look
like, so image resize will do this for
you. So, the image re-size command is
right here. You take any image. A nd you
just tell it the number of pixels and X
and Y. And it does some kind of
interpolation routine, rewrites the number
of pixels. imagery size is only available,
I think in the yeah you need to re-size
toolbox. So anyway. Sorry about that.
however that you, you can always, if you
turn it into double precision data you can
do it with an interpolation command in
Matlab to, to it. But image re-size kind
of has a nice code that does it for you.
So it's, it's no that hard to do, it's
just, it's a pain. And I hate these
toolbox structure but, there we go. And
now we showed all of this. Here are the
hidden labels. I just did it here so all
we got to do to run this thing is come
over and I called it two. I think that's
what I called it. Yeah. So I saved all
this data into save, pattern two. Is it
dogs? Is that ? Yeah. I labeled them all
as dogs. But actually they're normal dogs,
right? What were they again? So we can run
it, I labeled them all as dogs for the
moment, when I run this it's going to show
me the ones that are not dogs. Actually,
where is that coming from? Alright,
anyway. it turns out that thundercat gets
labeled as a dog. So the guy dog is really
a dod. interesting. If you remember, we
also had that leopard got labeled as the
dog. Why? Did you see his little nubby
ears? He had no ears, almost. He certainly
didn't have the cat ears, right? Let's go
back and look at those because I think
it's important so. So the thunder cat, did
not get labeled as a dog. And you can kind
of see why. Does everybody see why, the
Thundercat didn't get labeled as a dog
because, you see his little. Those look
like ears. It sees that structure and
goes, "Dude, Boom! You're, you're a cat
probably." this, look at those ears,
partly, it might be because also the
background, shades it out, but those ears
are small. And in the cat pictures, the
ears are pretty prominent. So, everybody
gets labelled as a dog, including Scooby
Doo, which has his ears out. And dog and
deer. I'm not sure about the deer, and it
also could be the deer is not cropped
well. Right, remember, there's one issue
here that I've kind of totally. Swept
under the rug. And that is the following.
Notice how pre-processed everything is
already. If you looked at our dog, cat
pictures. Frontal shots, perfectly cropped
this is not real life, okay? So there's a
whole set of things you got to do to do
that pre-processing. Pre-processing
actually turns out to be, in a lot of
stuff, your key step. Here, what we did is
we focused on the back end. If you give me
good pre-processed data, I can tell you if
it's a dog or a cat with 95% accuracy
which is, I think pretty impressive. With
a simple algorithm. That you can, that's
all there in the notes, It's not like. You
know, I got to call this huge library ,
got to do this, this, this. It's pretty
simple. Okay, but remember, pre-processing
key. And you're going to do something like
this for homework five, just letting you
know now. two more weeks left. Next week
we talk about compressed sensing. I'm
going to do a week lect, set of lectures
on compressed sensing, which is super
awesome. And then, the week after that is
dynamic reduct, dynamic dimensionality
reduction techniques. We will talk about
that and finish off the quarter. awesome,
okay.

You might also like