Now it's OK, oh wow, I'm magnified, OK, so we're already started of bad high
I'm Yens, I work at SAP on the SNAP programming language, together with my friends and you see
Berkeley and with more friends at SAP you are also working on this and working here, anybody
ever worked with scratch or snap, same scratches, like snap, something OK, so here's one thing
I got the sticker yesterday, it says no AI and I'm about to put it on my laptop because
this is sort of the thing that has been harassing all of us, right?
Whether we're programmers, whether we're educators, just AI keeps popping up being this
huge thing that everybody except us seems to be talking about as the good thing and we are
kind of thinking it might not be the best thing and it'll be great if people actually
know more about AI so when we're in schools and when we're with teachers and professors
discussing AI often if you go to these conferences it'll be all about prompting for
biology prompting for inclusion prompting for
something or the other and what's often left is well why don't somebody just explain how
the damn thing works so I can find out what it is and whether I can have fun with it and
this is what we've been trying to do with our programming language that is used in some schools
and so the idea is that really it's almost like a thunderstorm, this AI thing that's coming in
and we've coined this term Gale, it's like a game is something that is really sweeping away
but not really so much in a good way and we try to come up with a meaning for what Gale means so
we want to do pedagogy for dealing with neural networks and we want to focus on kind of four things
that I'd like to demonstrate. One is the general purposeless of it, it is really something that
we can apply and we are applying to things that we don't know anything about, we don't know
how stuff works and yet we can do things with it, it is also about abstraction and abstraction is
something where you know when you're talking about AI and comparing it to classical CS, there are
some differences like in AI we're often comparing things for being similar rather than mathematically
equal and we need the similarity so we can put them into bins so we can put them into group
to classify them and also a lot of it in order so that we can compare things for similarity,
there's some normalization involved. AI makes errors and if you think about it errors are really just
also a property of abstraction because if you're comparing things you're saying all of these
individual things I'm going to put them into different groups you're not going to be right
for many things because you're just going to leave out many things that you're going to look
at because say for the sake of this these are in the same group. So abstraction is something that
literally takes away things so we can then talk about them. Another really interesting thing is when
we're talking about the mathematics of neural networks is something that is difficult to be taught
in schools because it really requires at least some basic linear algebra and we're wondering
kind of what the basis is because very often when we look at the explanation of how it works
we see a bazillion variables and we see a bazillion loops that connect a bazillion variables
to bazillion other variables and then all some them up and put them in some function. So linear
algebra really helps demystify that and so we would like to come up and teach something that
we're calling the sales slip algorithm and the fourth thing would be evolution and this is also
something we talk a lot about like is it human should we talk about AI in human terms should we say
should we give it a personality or not and if we're modeling it in a programming language
there are two things that are important to us that is emergence things happen a lot a lot and then
something else appears that isn't just a repetition of what's happening and the system changes
it mutates. Mutations is something that we hackers, we computer scientists, we programmers have
problems about because we're all these super cool functional programmers that are all stateless
and some mutation is something that we really don't like to hear but these systems
really are emerging or adapting and are mutating so maybe there's another way we want to
think about certain aspects of programming and I'd like to go back to really something that
I might be unusual so when we're thinking about when does it all start I mean we can go back
to Aristotle I guess but I'd like to suggest concretely that it started with Oliver heavy side
in 1881 now I'm not sure whether anybody knows Oliver heavy side he's a self-taught mathematician
really cool dude in Great Britain working on telegraphs and he invented a stepping function
which you all know I guess but there's also something even more important that he was
and it's the notation for the scalar product of a vector the mutation of the dot
and really these two things if you think about it is almost all you need to know to build a neural
network so a couple of years later after 1881 the next thing that we want to talk about is this other
guy but oh here's the sense that algorithms so this is the algorithm so you've got you know a
bunch of products you want to buy something these are the seven things you need to make a good
cake in this German children song and if you want to know what it costs is of course you
you multiply the quantity in each row with the price and then you take the sum total that's the
sense of algorithm and that's literally how a neural network works so a couple of years later
there's Frank Rosenblatt and Frank really built something that he called the perceptron the Mark
one perceptron and it's a giant machine it's a giant machine for the cables and the usage was
off for the military which is I'm just going to show you in a few minutes a giant machine and of
course now it's no longer a machine now it's just a algorithm and so it kind of had these things
formula what you see at the right here is literally the sales level algorithm and on the left is
how the damn thing works like you've got several layers of that that we're a picture is coming in
then it gets projected to something then it gets sort of digitized and then there are some random
connections with random weights associated to it that mutate that change as it learns here you can see
sort of the thing how it actually works so there's the C for the Cornell University and there's
there's lamps so so this was a projected projection on the right side down here you see the C
in a matrix so this is already the matrix and then what happens is it got through the neural network
the neural network literally was this network of things that connect all these inputs with each
other and this is something I just very quickly like to build now in this programming language
so so we can play with it and find out how it works so I would like to look at
we should look the project this all was really motivated by looking at some data so here's some
some data you might know the sooner mine's data set anybody know the sooner mine's data set
so data set of actual pings sooner pings that and the echoes that come back and what comes back
the signal tells you whether this thing is a metal cylinder or not it could be a rock it could be a
piece of wood or something so these are actual signals it's a table of signals and in the last
column there's a number that tells you well this is just a rock it's not a mine and if it's one
it's a metal cylinder now always when I look at this data I'd like to actually plot it so so we
can we can look for example at the first item of this thing it's just a list of signals
and the last item zero so it's not a rock so we can plot this now these numbers are all very
small they're all normalized so we want to scale them in snap scaling them is just you multiply
the whole vector with something like with say 200 and this is what we call about building linear algebra
sort of into the system so we don't need to use loops for that so we just want to look at that
and we see that maybe we just want to center it so this is the example of the sonar signal for
a rock right so now if I look at the last item this is the sonar signal of a mine you can see
because the last column has has this this this this big bar and we can look we can now just
eyeball events with these things like random things like this is another example of a rock
another example of a mine another example of a mine another example of a mine another example
of a rock rock a mine a mine and you know I've eyeballed these a Brazilian times
I as a human being I have no idea I I can't find any pattern like to to distinguish whether
a one is a mine or a whale or or whatever and this is exactly the kind of problem that they
were dealing with back in the 50s and 60s because there are people who are very interested in that
and those are the military and so it's you know maybe we shouldn't talk about this in school but you
know that's the truth the military was sponsoring this the military is interested in this this is about
killing them or getting killed so why not use this database so the idea was how about we built this
Mark one perceptron in snap so we make a new object I'm calling a perceptron and a perceptron
need something that is a weight so I've actually got a couple of weights here which I found
on the free market you know these weights this is actually it's really cute usually weights kind of
have these have these little limbs that you kind of kind of things that you hold them on this is
actually cute this is something that they're sort of you can this is like a matriuska thing
it's very cool and there's actually some hey if you're a computer scientist there's numbers in there
this one says 16 this one says eight this one says four two I again you know we all love the
powers of two so this is essentially this is a vector of weights randomly associated this is what
we need for neural networks so we're just going to make weights I'm going to add that to that
weight where is it make a variable for the perceptron only and these are called weights
we make another variable for this perceptron only and these are called inputs these are the two
variables we need for this and so I don't have to code this all along I've sort of prepared something
like the cooks on TV in order to set this up there is one method that this perceptron does that
just sets up the weights with random numbers so what I want to do is I want to take this data set here
the um and I want to just get the sooner to a variable called data and now I want to set up
my perceptron I'm going to show the weights here with random numbers so I'm broadcasting set up
to the perceptron and so the weights kind of taken some dimension what goes in what goes out
so this is going to be a list of numbers there's going to be six features going in a 60 features
actually and one decision coming out whether it's a rock or a mine and when I click on this this is
this is my my weight matrix it's here so the second thing that we want to do is we want to actually
now ask the perceptron for a prediction is this a rock or is this a mine and so remember this
little say slip algorithm I've also kind of just coded this up in snap it's a huge big program
this is all it takes um and you know anything about neural networks you'll realize it's literally
just that take the sum like multiply everything with everything just take the sum of it and
lead it through a stepping function or a sigmoid function a function that really just tells me yes
this is okay or this is not okay this is all it takes because there's linear algebra involved
so what I want to do is I want to just um now request from I want to request predict
from the perceptron with some data so you know let's actually take the first item of the data
which is a rock so I want to know whether it is a rock and I'm getting back a probability
and says well with the probability of 75% it's a rock so this is wrong already
so let's find out and it's no wonder it's wrong because we just have a bunch of random numbers
so let's find out how well we're doing for the whole data set so I'm going through each of the samples
in my data and I want to make a variable that says um you know what's the target I know the target
because the target is just the last item in my data in my sample then I want to know what
my perceptron actually answers and that's the output and I can say the output
is what did request here I'm not just taking the item one of the data I'm taking the sample
oh wait let's make the singular also here now I can see what the difference is the difference is the
delta and the delta really is nothing but the difference between what I'm expecting which is the
target and when I'm getting I know about also just count the errors some first my errors are zero
and then I'm changing the errors not by the delta because the delta can be either you know one
or minus one or anything between so I need to take the absolute value of the delta
here and when I'm done I'd like to know how well I'm doing so I could say something I could say
the ratio of errors to the length of the data said and since I want to be positive I want to see
the success rate I'm taking the opposite like the inverse and yeah let's see how well we're doing
with this whole data said oh 55 percent that's not great that's about what's to be expected let's
take another set of random numbers and give it another try oh 50 percent okay so you get the
we're just basically we're throwing dice and no wonder and now the idea is how about
this thing learn something so we want to adjust these weights we want to oh wait there's another
one I forgot in here two other ones crazy we've got this huge vector we want to rearrange these weights
so they fit to the error to the delta that we found and there's this last script which is
how we need to go to the perceptron the last method of the perceptron is how does it learn
and all it takes is really this learning means the weights are adjusted the weights are shifted
but not all the way because then we would fit just every kind of data to the maximum
but shifted a little bit so it because we need to riddle in everything of like all of these
records so and that's that's kind of the abstraction and here's what they found out
so now we've got this what if we you know go through all of this once more and this is actually
shuffle the data so so it doesn't remember the sequence and see what happens when we do it once more
so I click on this once more it's 50 once more wait oh we need to we need to actually tell
it to learn okay so we're broadcasting learn to the perceptron with the delta so let's try this again
you see it's 51% 56% 60% you can see at each iteration the system learns and that
was kind of mind-blowing to them back then when they found this out and this is kind of all the
promise that wow this thing can actually learn so what we can do is we can try to visualize this
so we're making a log initiating the log to no list and I am adding the errors to the log
and I also want to visualize that again by plotting the bars these are the errors
by visualizing them and we should probably also scale them a little bit
excellent let's let's try this and let's maybe just do the error as one number
uh okay let's just do that so let's start a new new setup and um wait don't think of the data
okay so now what we want to do is this um we want to forever do this and find out how well it's
doing um wait wait wait there's something wrong see this is what happens when there's a room for the
people and somebody tries to code up something um didn't it just work
uh I need to plot the not the errors but the log this is what I need to do
um
to log yes thank thank you Glenn thank you Glenn
okay I didn't get it oh but but you can see it's going up like now it's it's already at at
77 percent so okay so what you see is it's actually learning but it doesn't kind of go above 78
percent and you just think about 78 percent that is pretty great like if you're investing money
like yeah I would put my my money in there to make money but it's not so great when it's about
should I kill this guy or should this guy kill me um so it's not good enough and the question
how how to make it good enough is is really a difficult one and so what they did was um what one
perceptron cannot do maybe two perceptrons can do and this is the thing about deep learning so what
they did is um they have this idea that it takes more than one layer and that was actually
found out by uh Martin Minsky and see my paper they proved that a single layer a single
perceptron can only learn certain problems but it cannot learn certain other problems and it can
only learn problems that are linearly separable if there's a non-linear function even an
easy non-linear function one layer is not enough and you need more than one layer two layers or
even more layers well two two layers actually can do anything but there's more than two layers and
this is they didn't know for a long time how to do this well some people knew but then it didn't
get published or or got published but only in finish uh which nobody in the US read so it didn't
exist um and this is kind of this this whole thing that at one time um rumble hard and and
and they found out how to do actual back propagation and back propagation is something where they just
added one little thing to this formula of how it learns really just one little thing
and essentially when you before you change the weights make another delta for the next layer and return
this you can now have two layers one kind of perceptron layer and one thing that is called a hidden layer
and when you do this with a hidden layer you can reformulate this you can say okay the output now is not
just one request it is actually a pipe it is a pipe of piping my data my sample
to the hidden layer and then taking what I'm getting out of this to the perceptron layer or the
output layer and this is called a forward pass and then when you're learning you're not just
broadcasting something that it can learn but you need another you need another um pipe
we're taking the delta and you're requesting now first uh you're requesting to learn but you're
requesting first from the output like the layer for the perceptron layer and what it gives you back
is you're requesting then from the hidden layer and that is called back propagation
and with these two kind of simple things they were able to build a network that was way better
in learning now let me let me glance over this again there is something wrong here the target
that sounds the output is okay the delta is okay um yes errors I guess the errors should be the
sum of this so this should work um so now we need to also initialize the hidden layer
now when you look at its weights
so I'm having the perceptron and duplicating this because first there is a hidden layer it takes
60 features coming in and let's say maybe five features coming out then it takes five features
coming in and one decision coming out the click on this um uh wait hidden layer
now I've got my weights here hidden layer and the perceptron um
now that's actually try this now we can see how it learns and we can see it learns
much much better it's already it's 78% you can see how the weights adjust themselves
and you can see that it's going now all the way it's already we've rated a little bit it'll be
over 90% and this is precisely the thing um that is very interesting to do um and this is what is
called deep learning deep learning is when you have more than one layer you can have now you can
copy these layers you can have as many layers as you want to solve any non-linear equations so
we're now we're at at 70% already which is kind of fundamentally a great thing and with this
kind of running out of time I want to show you that with this when we use this in classroom
we can actually have more fun than analyzing data sets we can actually do fun things when we
maybe when we incorporate this into a programming language like like snap where we have a
library that is called a neural network library so we can use this to use this on our own on our
own data and we can build these neural networks sort of as something that programs a block for us
so let me make a little list of things that I'd like to show you I'd like to show you a picture
of a heart of a star on the house of a boat whoops of a balloon of a bird
heart star house boat balloon bird I forgot you see what else is there
that's fine so so what I want to do is I want to map over this list and I want to draw an
example for each of these things I'm going to draw a scribble and I'm going to append the name
of what it is to it which will then give me a very small data set of six entries and I want to
make a little neural network that generates a predicate for that actually that classifies what I drew
a classifies the shape for that so this is going to make a new block a neural network that's
actually try this um so I'm doing this now now I'm drawing a heart I'm drawing a star
free hand I'm going a house and a boat
who let's say a balloon and a bird and now let's see what's happening my neural network is
analyzing what I drew and it is learning is having it's a little bit of a bigger neural network
now because there's many more gestures in my stroke and it claims that it learned a hundred percent
of that well I'd like to believe that um now we'll find out now what I want to do is I want to say
okay wait when I kind of press anywhere on the stage when I want to do is I want to sketch something
and when I receive that I sketch something you know what I want to do is I want to get the shape
of this is the block that my neural network made it is not programmed on the inside it just has
some weights these are the weights that the neural network learned and it made a new block that
classifies that with these weights so I want to get the shape of you know what I just drew
so I'm going to draw something that shape is a name and I want to look that up in the library
of animations and I actually want to animate it so let's try this so we could now say
this AI thing is like this gale the storm that is shaking up all of our education
but you know the storm is also kind of a wind a wind of change that can lead us and take us to
different shores where we kind of have to focus on our guiding star and not let us say I think
take away our jobs but maybe make us more empathetic towards each other so we can let our creativity
fly and kind of take it for a different future then it seems now a different future
sorry for being too long
any questions yes yes yes yes yes yes yes yes please
questions so about the terminology so you're calling it's network in learning but I don't
this is about what's called networks we're all network and deep learning is going to improve
things like evolution or some kind of tricky set of multi-glame
your calculations are you interested? well images are are of course more complicated because
now what what I've shown you is just vectors it's just a neural network working on vector data
if your images you're probably doing a convolutional network but the deepness of a network really
is is an attribute about having more than one layer now of course you know with technology you
would be saying maybe deep means more than five layers or more than ten layers but the idea really
is all the same you can add as many layers as one the difficulty was having more than one layer
yes please
what we did in the classroom is we use this what I just showed you we use this to classify data from
datasets and to use it to classify data that's coming from ourselves what we don't do in the
classroom is build neural networks ourselves so I showed you how we built it ourselves and we have a
library for that where we can actually we give you that sprite we give you that percept on sprite
and we can show you that that you can manually duplicate that sprite and build that network of your
cell yes yes but then we use it just as a block because this is something that we feel
is important what if you just went away what if a neural network is just a function that you call
and you just get some back some numbers and you can call it what if it just makes a function for you
right yes sir and when you did that in got it some of what you're doing with kind of
black what if what if it's what if it's not your your your what but it's just running
locally it's in snap it's the same thing I showed you just just packed into a block
I just put it into a block yes the whole thing is just one
show it to a university class we are working on a curriculum this we just recorded a course for this
we taught it to there's all kinds of students coming into SAP so we tried it with them
classes yes yes yes yes yes yes yes thank you very much sorry there's a number time
thank you
s