馃攳
Stealing Baseball Signs with a Phone (Machine Learning) - YouTube
Channel: Mark Rober
[1]
[indistinct shouting]
[4]
- No steal. There's no steal there. I predict not a steal, watch this:
[11]
...and he stayed.
[17]
[excited]
He's gonna steal! This is a steal!
[19]
If this app works, this kid's about to steal!
[21]
[excited squealing]
There he goes!
[25]
There he goes!
[26]
Freakin' works!
It works.
[29]
Two years ago I came up with an idea for an app where you could decode baseball signs
[33]
So you would know when the other team was going to steal, even after just the first inning.
[37]
Then in a covert effort to get people more interested in coding the machine learning,
[41]
I would make the app free and available to everyone.
I'm happy to report...
[44]
It's no longer just an idea.
[47]
Today I'm going to show you exactly how the app works, and we'll use it in the wild,
[50]
and then we're going to talk about machine learning in very simple terms with my buddy Jabril.
[54]
But first, to set the stage we need to understand the fascinating world of secret baseball signs.
[60]
It's the game within the game.
[62]
Most people know the catcher will give signs to the pitcher when your team is on defense.
[65]
But when you're on offense, the third-base coach gives signs to both the batter and the base runner.
[70]
For example, he could secretly tell the batter to bunt, or to not swing at the next pitch,
[75]
or he can tell the base runner to steal.
[77]
And just to be clear, stealing a base is when you start running as soon as the pitches thrown,
[81]
instead of waiting for the batter to try and hit it.
[83]
It's risky because if the batter doesn't hit the ball and the catcher is good,
[87]
he can throw you out at second base.
[89]
Because it's a big advantage, coaches will actually tell their players to watch
[93]
and see if they could figure out the other team's signs.
That's considered a fair play and it's part of the game.
[98]
The problem is, our brains aren't great at figuring out the complex pattern.
[102]
So we set out to create an app that would use machine learning to do exactly that. And by we, I mean
[107]
Jabril actually sat down and wrote the code and I just made sure he had unlimited Cheez-Its and Lacroix.
[112]
Here's how it works:
If I saw coach touched his nose, ears, arm, chin, and so on, I would assign those to letters in the app.
[118]
Then I'll just watch him sign and record the order. After that I would just let the app know the outcome;
[123]
so was it a steal or not.
After you do this for enough sequences, the app will start to make predictions.
[129]
In this case, it's predicting the combination of "A, D", or "nose then chin" is their steal sign.
[134]
This worked well enough on my workbench,
[135]
so now it's time for the first real-world test
in a kids-versus-adults Wiffle Ball game.
[140]
And my friend Sara takes the game of Wiffle Ball pretty seriously,
[143]
so she was the captain of the kids team, and was signaling for them to steal at just the right moments.
[150]
[Cheering]
[154]
- And I wasn't sure about the ethics of using our app against a bunch of little kids,
[158]
but they were scoring runs and stealing bases with impunity, and then they got so confident, they started talking trash.
[164]
[kids screaming]
WE WANT A PITCHER,
NOT A BELLY ITCHER!
[167]
And no one says that about my pitcher,
[169]
so at that point the gloves came off.
[171]
We found it easiest to film her signs with our phone, and then scrub through and capture the order in the app afterwards,
[178]
as opposed to trying to do it real-time.
[180]
And I'm very happy to report we cracked their code after only three sequences.
[187]
And what's cool is once you know the code, you no longer need the app because you can just watch for the steal signal
[193]
and when we saw it, we alerted our pitcher with the secret sign of our own
[198]
[music]
[202]
[screaming]
Ayyyyy! You're outta there buddy!
[206]
And after that the tides of the game shifted and we were able to officially prove adults rule, and kids drool.
[212]
So our app cracked the code after just three sequences and I'm going to show you them
[216]
to see if you can figure out the steal sign using just your brain.
[220]
Here's the first one:
[221]
And this was a STEAL.
[223]
Here's the second:
[226]
And this was NO STEAL.
[228]
And this is the third:
[231]
And it was a STEAL.
[233]
Pause and go back if you want to try and figure it out, because I'm about to tell you the answer.
[236]
According to the app, which Sara later confirmed,
[239]
their steal sign was only if she touched her hat and then left ear back to back.
[243]
Everything else was just a decoy.
[245]
Now before we tell you exactly how the app can figure this out so quickly,
[249]
we need a little background information.
[251]
So I've cornered my buddy Jabril here and I'm gonna make him give us a super simple explanation of machine learning.
[256]
Now here's what you should know about Jabril: He's basically a genius who taught himself how to code when he was 14.
[261]
He has an amazing YouTube channel you should check out with videos like this one
[265]
where he made a video game where the character teaches himself how to navigate any maze
[268]
using machine learning and neural networks.
[270]
[Jabril]
- All right. Let's say we have Timmy here. And Timmy likes certain type of toys, but not others.
[275]
So in a fake example here, he decides his based on how big the toy is and how complicated it is.
[281]
So, from small to big, and then over here
[284]
how many parts it has; from just one piece, to a really complex toy with gears and moving parts and things like that.
[290]
And so, if we asked Timmy about 20 different toys and start to plot those on the graph,
[294]
we'll start to see a pattern.
[296]
So generally, he likes toys that are big and complicated, but does not like toys that are small and simple.
[304]
And so, by looking at his past preferences,
[307]
we can make really good predictions for the future.
[309]
If you show little Timmy here a toy that is this complicated
[313]
and this big, we're confident that he'll like it before we show it to him because it is inside the "like" boundaries.
[320]
That's the big deal with machine learning:
[322]
We don't have to take the time and show a little Timmy here every toy that's ever been created
[326]
and record his answers. After we record some
[329]
likes and dislikes we're able to draw some boundaries.
[332]
And precisely where we draw these boundaries is the secret sauce.
[337]
In this case, with just two inputs,
[339]
You can just eyeball it and see where to put the boundaries.
[341]
Butt
[342]
...when you have thousands of inputs that interact with each other, it's
[345]
impossible for our brains to comprehend where those boundaries should go.
[349]
However, it's pretty trivial for a computer using machine learning.
[353]
[Mark]
- In doing research for this video, I talked to probably over 50 baseball players and coaches.
[358]
And when we asked about signs, it was surprising to me how they all basically use the same strategy.
[362]
See if you can pick up on it.
[363]
[Coach]
- Every coach has an indicator.
[365]
- I have an indicator so I could do all this, you know
[367]
random stuff like this, touch anywhere until I touch this, none of that matters.
[371]
- So it'll be an indicator and the next sign, that's the 'hot' sign.
[374]
So it's indicator, arm is 'steal', if I just do arm, that's nothing.
[378]
- Oftentimes, I'll give this
[381]
'Simon didn't say'.
[383]
If I go indicator, and then immediately to anywhere on my arm:
[387]
Steal.
[388]
Bunt is to the belt; indicator to the belt.
[390]
[Mark]
- So basically nothing matters and it's all a decoy until they touch the indicator, and then
[394]
the very next sign is the instruction.
[396]
So after the indicator you might be told to bunt,
[398]
or to take a pitch,
[400]
or to steal.
[401]
And so since the steal sign comes immediately after the indicator, We just look at a sequence where steal was recorded here
[407]
That's showing us one and we look through that sequence two letters of the time and store those combos and we do the same thing
[412]
for all the
[413]
Sequences where steal was recorded and whatever two letter combo shows up in all of them is their indicator and steal sign in this case
[420]
It's a D. So if we decode that that means noses their indicator and chin is their steal sign now
[426]
I have a confession what I just showed you doesn't use machine learning at all. It's just a simple algorithm
[431]
We realized at work
[432]
once we discovered that pretty much all teams will use an indicator directly before
[437]
Giving the real sign but based off all the people we talked to you if you're trying to decode signs this simple version should work
[443]
Like ninety percent of the time but what about the other 10% where they do anything other than indicator followed by sign?
[449]
That's where you need machine learning because I've done properly machine learning can crack any code as long as you give it enough training data
[455]
So to really see how good Jabril x' machine learning app was I generated some training data based off an insanely?
[461]
Complicated steals line I came up with to see if he could figure it out
[465]
so my secret sign was a mustache rub is the indicator followed by any random sign and then a tooth tap as
[471]
The steal sign then I can have up to fifty different
[474]
Signals in each sequence and then to throw them off even more if I ever touch my right, eyebrow
[478]
It's not a steal
[479]
So you ignore everything in the sequence?
[481]
Even if i've already given this deal now just to set the stage if we weren't going to use machine learning
[485]
This would take a normal computer
[487]
Thousands of years to solve because it's the same as if you're asking Timmy about every toy ever made instead of just drawing the boundaries
[493]
Before we see if gibreel can successfully crack my code and how long it will take him
[498]
Let's just go one layer deeper than the Timmy toy example and see how machine learning
[502]
Mimics the human brain in creating neural networks that can draw those boundaries in the more complicated case of more than two inputs
[510]
There are three main parts to a neural network and hang with me here because I'm going to keep this simple
[515]
You have the input layer which in our case are the signs being given and then way over here
[520]
You have the output layer in our case steel or no steel and then in the middle
[524]
We have the hidden layers and right now that's just a black box
[527]
So if the sign was hat hat nose hand
[530]
We would tweet these input knobs like this depending on how each of these knobs is turned
[535]
Each one is interconnected with the knobs to its left
[538]
So it causes some simple math to occur at each node
[541]
And when you sum up all of those numbers
[543]
You're left with a number between 0
[545]
And 1 and if that number is really close to 0 that's no steal
[548]
And if the number is really close to 1 that's a steal so you give it a bunch of training data
[552]
We're given an input
[553]
You know what the output should be you start with these hidden layer knobs turned in totally random directions
[558]
And when you add them all up you get something like point five five. Well, that doesn't make sense
[563]
You can't have half a steel and more importantly with the training data
[566]
you know the answers and you know that this
[568]
Combination should have been a steel
[570]
So you just start tweaking these hidden layer knobs until you start to get
[574]
Outputs that are more correct over time and after going through a bunch of examples where you know what the answer should be
[579]
Eventually, you get to a point where any more tweaking of the knobs just makes it less accurate
[584]
so you stop so now you
[586]
Superglue these three hidden layer knobs into place because you've trained your model
[590]
And so now with the brand-new input where you don't know the answer it gives you the correct output in this case us steel
[596]
Of course, this is a simple model
[597]
But this scales up so you could have thousands of inputs and thousands of outputs and you're able to discover really?
[604]
complicated relationships
[605]
What's so cool about this is this is basically how neural networks in our own
[609]
Rains are set up to learn once
[611]
I've been given enough training data to understand the interaction between my hand and arm and keeping something balanced like this then my model is
[618]
Trained and I superglue those middle knobs in my brain, then I can introduce a totally new input
[623]
I've never tried before and I still know what to do
[626]
I don't need to be trained on every possible
[628]
different type of object because my brain
[630]
Has drawn the boundaries think about that for a long time before machine learning in neural networks computers were just following
[636]
hard-coded instructions given by humans now
[639]
they can learn like humans only they can do it much faster and more comprehensively than we can look at Ori and
[647]
That's why when I give Jabril the challenge that would take a normal computer using brute force methods thousands of years to solve
[655]
Yo, man
[657]
Please tell me that your indicator is a moustache rub and then you know, whatever and
[665]
Then it do that
[668]
Is that it
[671]
Jibril's machine learning algorithm just created the right boundaries and solved it in less than three minutes
[676]
The machine learning model requires more data than our simple version which can solve it after like three sequences
[681]
But the upside is that it will eventually decode any set of signs. As long as you're capturing the inputs, right?
[687]
And so now it was time for a real-life test. So I asked my buddy Destin to do some secretive recon work
[693]
Okay, dude, this is the field. I used to play it growing up today. My son is playing on the Rascals
[698]
I'm gonna go film on third base coaches doing their thing and we'll plug all that data into the machine learning algorithm
[703]
These kids are yelling at me
[705]
Want me to know what my channel is and the fact they didn't recognize him just proved to me that whatever was happening in this
[710]
Region was a totally effective disguise and thanks to Dustin's great interviews in raw footage
[714]
We were able to get even more data to show that methods totally worked
[717]
And while Destin just brazenly set up a tripod and filmed all these third-base coaches
[724]
Yeah, cuz signs are pretty secret, right yeah, yes, sir get it
[730]
I get in trouble for stealing sons
[732]
I was a little more nervous and discreet if you put a GoPro in a cup
[736]
you can actually just watch the footage and frame the shot real time and it just looks like your check and dank means with the
[742]
Drink in your hand. I've actually used this trick a few times especially on my Carnival scam science video
[747]
So just like with Destin's footage
[748]
It worked perfectly the games I went to and it was just a cool feeling once you'd crack their code
[756]
To be able to predict exactly what was coming next
[764]
I
[765]
Hope you enjoyed this excuse to learn more about machine learning as much as I did
[769]
I will put links to both versions of the app in the video
[772]
description for you to check out and of course if there are specific rules against using
[776]
Technology to steal science in your league. I am not telling you to break them. Otherwise from personal experience
[782]
You might risk getting some very important people mad at you
[785]
I
Most Recent Videos:
You can go back to the homepage right here: Homepage





