The Math Behind Basketballs Wildest Moves Rajiv Maheswaran TED Talks

My colleagues and I are fascinated
by the science of moving dots.

So what are these dots?

Well, it’s all of us.

And we’re moving in our homes,
in our offices, as we shop and travel

throughout our cities
and around the world.

And wouldn’t it be great
if we could understand all this movement?

If we could find patterns and meaning
and insight in it.

And luckily for us, we live in a time

where we’re incredibly good
at capturing information about ourselves.

So whether it’s through
sensors or videos, or apps,

we can track our movement
with incredibly fine detail.

So it turns out one of the places
where we have the best data about movement

is sports.

So whether it’s basketball or baseball,
or football or the other football,

we’re instrumenting our stadiums
and our players to track their movements

every fraction of a second.

So what we’re doing
is turning our athletes into –

you probably guessed it –

moving dots.

So we’ve got mountains of moving dots
and like most raw data,

it’s hard to deal with
and not that interesting.

But there are things that, for example,
basketball coaches want to know.

And the problem is they can’t know them
because they’d have to watch every second

of every game, remember it and process it.

And a person can’t do that,

but a machine can.

The problem is a machine can’t see
the game with the eye of a coach.

At least they couldn’t until now.

So what have we taught the machine to see?

So, we started simply.

We taught it things like passes,
shots and rebounds.

Things that most casual fans would know.

And then we moved on to things
slightly more complicated.

Events like post-ups,
and pick-and-rolls, and isolations.

And if you don’t know them, that’s okay.
Most casual players probably do.

Now, we’ve gotten to a point where today,
the machine understands complex events

like down screens and wide pins.

Basically things only professionals know.

So we have taught a machine to see
with the eyes of a coach.

So how have we been able to do this?

If I asked a coach to describe
something like a pick-and-roll,

they would give me a description,

and if I encoded that as an algorithm,
it would be terrible.

The pick-and-roll happens to be this dance
in basketball between four players,

two on offense and two on defense.

And here’s kind of how it goes.

So there’s the guy on offense
without the ball

the ball and he goes next to the guy
guarding the guy with the ball,

and he kind of stays there

and they both move and stuff happens,
and ta-da, it’s a pick-and-roll.

(Laughter)

So that is also an example
of a terrible algorithm.

So, if the player who’s the interferer –
he’s called the screener –

goes close by, but he doesn’t stop,

it’s probably not a pick-and-roll.

Or if he does stop,
but he doesn’t stop close enough,

it’s probably not a pick-and-roll.

Or, if he does go close by
and he does stop

but they do it under the basket,
it’s probably not a pick-and-roll.

Or I could be wrong,
they could all be pick-and-rolls.

It really depends on the exact timing,
the distances, the locations,

and that’s what makes it hard.

So, luckily, with machine learning,
we can go beyond our own ability

to describe the things we know.

So how does this work?
Well, it’s by example.

So we go to the machine and say,
“Good morning, machine.

Here are some pick-and-rolls,
and here are some things that are not.

Please find a way to tell the difference.”

And the key to all of this is to find
features that enable it to separate.

So if I was going
to teach it the difference

between an apple and orange,

I might say, “Why don’t you
use color or shape?”

And the problem that we’re solving is,
what are those things?

What are the key features

that let a computer navigate
the world of moving dots?

So figuring out all these relationships
with relative and absolute location,

distance, timing, velocities –

that’s really the key to the science
of moving dots, or as we like to call it,

spatiotemporal pattern recognition,
in academic vernacular.

Because the first thing is,
you have to make it sound hard –

because it is.

The key thing is, for NBA coaches,
it’s not that they want to know

whether a pick-and-roll happened or not.

It’s that they want to know
how it happened.

And why is it so important to them?
So here’s a little insight.

It turns out in modern basketball,

this pick-and-roll is perhaps
the most important play.

And knowing how to run it,
and knowing how to defend it,

is basically a key to winning
and losing most games.

So it turns out that this dance
has a great many variations

and identifying the variations
is really the thing that matters,

and that’s why we need this
to be really, really good.

So, here’s an example.

There are two offensive
and two defensive players,

getting ready to do
the pick-and-roll dance.

So the guy with ball
can either take, or he can reject.

His teammate can either roll or pop.

The guy guarding the ball
can either go over or under.

His teammate can either show
or play up to touch, or play soft

and together they can
either switch or blitz

and I didn’t know
most of these things when I started

and it would be lovely if everybody moved
according to those arrows.

It would make our lives a lot easier,
but it turns out movement is very messy.

People wiggle a lot and getting
these variations identified

with very high accuracy,

both in precision and recall, is tough

because that’s what it takes to get
a professional coach to believe in you.

And despite all the difficulties
with the right spatiotemporal features

we have been able to do that.

Coaches trust our ability of our machine
to identify these variations.

We’re at the point where
almost every single contender

for an NBA championship this year

is using our software, which is built
on a machine that understands

the moving dots of basketball.

So not only that, we have given advice
that has changed strategies

that have helped teams win
very important games,

and it’s very exciting because you have
coaches who’ve been in the league

for 30 years that are willing to take
advice from a machine.

And it’s very exciting,
it’s much more than the pick-and-roll.

Our computer started out
with simple things

and learned more and more complex things

and now it knows so many things.

Frankly, I don’t understand
much of what it does,

and while it’s not that special
to be smarter than me,

we were wondering,
can a machine know more than a coach?

Can it know more than person could know?

And it turns out the answer is yes.

The coaches want players
to take good shots.

So if I’m standing near the basket

and there’s nobody near me,
it’s a good shot.

If I’m standing far away surrounded
by defenders, that’s generally a bad shot.

But we never knew how good “good” was,
or how bad “bad” was quantitatively.

Until now.

So what we can do, again,
using spatiotemporal features,

we looked at every shot.

We can see: Where is the shot?
What’s the angle to the basket?

Where are the defenders standing?
What are their distances?

What are their angles?

For multiple defenders, we can look
at how the player’s moving

and predict the shot type.

We can look at all their velocities
and we can build a model that predicts

what is the likelihood that this shot
would go in under these circumstances?

So why is this important?

We can take something that was shooting,

which was one thing before,
and turn it into two things:

the quality of the shot
and the quality of the shooter.

So here’s a bubble chart,
because what’s TED without a bubble chart?

(Laughter)

Those are NBA players.

The size is the size of the player
and the color is the position.

On the x-axis,
we have the shot probability.

People on the left take difficult shots,

on the right, they take easy shots.

On the [y-axis] is their shooting ability.

People who are good are at the top,
bad at the bottom.

So for example, if there was a player

who generally made
47 percent of their shots,

that’s all you knew before.

But today, I can tell you that player
takes shots that an average NBA player

would make 49 percent of the time,

and they are two percent worse.

And the reason that’s important
is that there are lots of 47s out there.

And so it’s really important to know

if the 47 that you’re considering
giving 100 million dollars to

is a good shooter who takes bad shots

or a bad shooter who takes good shots.

Machine understanding doesn’t just change
how we look at players,

it changes how we look at the game.

So there was this very exciting game
a couple of years ago, in the NBA finals.

Miami was down by three,
there was 20 seconds left.

They were about to lose the championship.

A gentleman named LeBron James
came up and he took a three to tie.

He missed.

His teammate Chris Bosh got a rebound,

passed it to another teammate
named Ray Allen.

He sank a three. It went into overtime.

They won the game.
They won the championship.

It was one of the most exciting
games in basketball.

And our ability to know
the shot probability for every player

at every second,

and the likelihood of them getting
a rebound at every second

can illuminate this moment in a way
that we never could before.

Now unfortunately,
I can’t show you that video.

But for you, we recreated that moment

at our weekly basketball game
about 3 weeks ago.

(Laughter)

And we recreated the tracking
that led to the insights.

So, here is us.
This is Chinatown in Los Angeles,

a park we play at every week,

and that’s us recreating
the Ray Allen moment

and all the tracking
that’s associated with it.

So, here’s the shot.

I’m going to show you that moment

and all the insights of that moment.

The only difference is, instead
of the professional players, it’s us,

and instead of a professional
announcer, it’s me.

So, bear with me.

Miami.

Down three.

Twenty seconds left.

Jeff brings up the ball.

Josh catches, puts up a three!

[Calculating shot probability]

[Shot quality]

[Rebound probability]

Won’t go!

[Rebound probability]

Rebound, Noel.

Back to Daria.

[Shot quality]

Her three-pointer – bang!

Tie game with five seconds left.

The crowd goes wild.

(Laughter)

That’s roughly how it happened.

(Applause)

Roughly.

(Applause)

That moment had about a nine percent
chance of happening in the NBA

and we know that
and a great many other things.

I’m not going to tell you how many times
it took us to make that happen.

(Laughter)

Okay, I will! It was four.

(Laughter)

Way to go, Daria.

But the important thing about that video

and the insights we have for every second
of every NBA game – it’s not that.

It’s the fact you don’t have to be
a professional team to track movement.

You do not have to be a professional
player to get insights about movement.

In fact, it doesn’t even have to be about
sports because we’re moving everywhere.

We’re moving in our homes,

in our offices,

as we shop and we travel

throughout our cities

and around our world.

What will we know? What will we learn?

Perhaps, instead of identifying
pick-and-rolls,

a machine can identify
the moment and let me know

when my daughter takes her first steps.

Which could literally be happening
any second now.

Perhaps we can learn to better use
our buildings, better plan our cities.

I believe that with the development
of the science of moving dots,

we will move better, we will move smarter,
we will move forward.

Thank you very much.

(Applause)

我和我的同事都
对移动点的科学着迷。

那么这些点是什么?

好吧,这就是我们所有人。

当我们在我们的城市和世界各地购物和旅行时,我们正在家里、办公室里搬家

如果我们能理解所有这些运动,那不是很好吗?

如果我们能从中找到模式、意义
和洞察力。

对我们来说幸运的是,我们生活在一个

非常
擅长捕捉关于自己的信息的时代。

因此,无论是通过
传感器、视频还是应用程序,

我们都可以
非常精细地跟踪我们的运动。

所以事实证明
,我们拥有关于运动的最佳数据的地方之一

是运动。

因此,无论是篮球、棒球、
足球还是其他足球,

我们都在检测我们的体育场
和我们的球员,以每分每秒跟踪他们的动作

所以我们正在做的
是把我们的运动员变成——

你可能猜到了——

移动的点。

所以我们有大量的移动点
,就像大多数原始数据一样,

很难处理,
也没有那么有趣。

但是有些事情是
篮球教练想知道的。

问题是他们无法了解他们,
因为他们必须观看

每场比赛的每一秒,记住并处理它。

一个人做不到,

但机器可以。

问题是机器无法
用教练的眼光看比赛。

至少他们直到现在都做不到。

那么我们教机器看什么呢?

所以,我们简单地开始了。

我们教它传球、
投篮和篮板。

大多数普通粉丝都会知道的事情。

然后我们继续处理
稍微复杂的事情。

像背身、
挡拆和单打这样的事件。

如果你不认识他们,没关系。
大多数休闲玩家可能会这样做。

现在,我们已经到了今天
,机器可以理解复杂的事件,

比如向下屏幕和宽引脚。

基本上只有专业人士知道的事情。

所以我们教了一台机器
用教练的眼睛看东西。

那么我们是如何做到这一点的呢?

如果我让教练描述
类似挡拆的东西,

他们会给我一个描述

,如果我将其编码为一种算法,
那就太糟糕了。

挡拆恰好是
四名球员之间的这种篮球舞蹈,

两名进攻,两名防守。

这就是它的运行方式。

所以有一个无球进攻的人

,他走到防守有球人的人旁边

,他就呆在那里

,他们都移动,事情发生了
,ta-da,这是一个接球- 卷。

(笑声)

所以这
也是一个糟糕算法的例子。

所以,如果作为干扰者的球员——
他被称为掩护者——

靠近,但他没有停下来,

这可能不是挡拆。

或者如果他确实停下了,
但他停得不够近,

那可能不是挡拆。

或者,如果他确实靠近
并且他确实停下了,

但他们在篮下进行了,
这可能不是挡拆。

或者我可能是错的,
他们都可能是挡拆。

这实际上取决于确切的时间
、距离、位置

,这就是让它变得困难的原因。

因此,幸运的是,借助机器学习,
我们可以超越自己

描述已知事物的能力。

那么这是如何工作的呢?
嗯,举个例子。

所以我们走到机器前说:
“早上好,机器。

这里有一些挡拆
,还有一些不是。

请想办法区分。”

而这一切的关键是找到
使其能够分离的特征。

所以如果我
要教它

苹果和橙子的区别,

我可能会说,“你为什么
不用颜色或形状?”

我们正在解决的问题是,
那些东西是什么?

让计算机
在移动点的世界中导航的关键功能是什么?

所以弄清楚所有这些
与相对和绝对位置、

距离、时间、速度的关系——

这确实
是移动点科学的关键,或者我们喜欢称之为

时空模式识别,
用学术白话来说。

因为第一件事是,
你必须让它听起来很难——

因为它是。

关键是,对于 NBA 教练来说
,并不是他们想知道

挡拆是否发生。

他们想
知道它是如何发生的。

为什么它对他们如此重要?
所以这里有一点见解。

事实证明,在现代篮球中,

这种挡拆可能
是最重要的比赛。

而知道如何运行它
,知道如何防守它,

基本上是赢得
和输掉大多数比赛的关键。

所以事实证明,这种舞蹈
有很多变化

,识别
变化真的很重要

,这就是为什么我们需要
它非常非常好。

所以,这里有一个例子。

有两名进攻
球员和两名防守球员,

准备
进行挡拆舞。

因此,有球的人
可以接受,也可以拒绝。

他的队友可以滚动或弹出。

防守球的人
可以上或下。

他的队友可以展示
或打到触球,或者打软

,他们可以一起
切换或闪电战


当我开始时我不知道大部分这些事情,

如果每个人都按照这些箭头移动会很可爱

这会让我们的生活更轻松,
但事实证明,运动非常混乱。

人们经常扭动

并且在精确度和召回率方面以非常高的准确度识别这些变化是很困难的,

因为这是让
专业教练相信你所需要的。

尽管
使用正确的时空特征存在所有困难,但

我们还是能够做到这一点。

教练相信我们
机器识别这些变化的能力。

我们正处于今年
几乎所有

NBA 总冠军争夺者

都在使用我们的软件的地步,该软件建立
在一台能够

理解篮球运动点的机器上。

不仅如此,我们提供的
建议改变了策略

,帮助球队赢得了
非常重要的比赛

,这非常令人兴奋,因为
你有在联盟工作

了 30 年的教练愿意
接受机器的建议。

这非常令人兴奋,
不仅仅是挡拆。

我们的计算机
从简单的东西开始

,学习了越来越复杂的东西

,现在它知道了很多东西。

坦率地说,我
不太了解它的作用

,虽然
比我聪明并没有那么特别,

但我们想知道,
机器能比教练更了解吗?

它能比人知道的更多吗?

事实证明,答案是肯定的。

教练们希望球员
能投出好球。

所以如果我站在篮筐附近,

而我附近没有人,
这是一个很好的投篮。

如果我站在远处
被防守者包围,那通常是一个糟糕的投篮。

但我们从不知道“好”有多好,
或者“坏”有多坏。

到目前为止。

所以我们能做什么,再次,
使用时空特征,

我们查看每一个镜头。

我们可以看到:镜头在哪里?
篮筐的角度是多少?

防守者站在哪里?
他们的距离是多少?

他们的角度是什么?

对于多名防守球员,我们可以
看看球员的移动方式

,预测射门类型。

我们可以查看它们的所有速度
,我们可以建立一个模型来预测

在这种情况下这个镜头进入的可能性有多大?

那么为什么这很重要呢?

我们可以把拍摄的

东西,以前是一回事
,把它变成两件事:

镜头的质量和射手的质量。

所以这里有一个气泡图,
因为没有气泡图的 TED 是什么?

(笑声)

那是NBA球员。

大小是播放器的大小,
颜色是位置。

在 x 轴上,
我们有射击概率。

左边的人拍摄困难,

右边的人容易拍摄。

[y轴]是他们的射击能力。

好人在上,
坏人在下。

例如,如果有一个球员

的投篮命中率为 47%,

这就是你之前所知道的。

但今天,我可以告诉你,一名
球员的投篮命中率是一名普通 NBA 球员

的 49%,

而他们的投篮命中率要低 2%。

重要的原因
是那里有很多 47。

因此,真正重要的是要

知道你正在考虑
投入 1 亿美元的 47 人

是一个投篮不好的好

射手,还是一个投篮好的差投手。

机器理解不仅改变
了我们看待玩家的方式,

还改变了我们看待游戏的方式。

所以几年前有一场非常激动人心的比赛
,在NBA总决赛中。

迈阿密落后三分,
还剩 20 秒。

他们即将失去冠军。

一位名叫勒布朗詹姆斯的绅士
走了过来,他投了一个三分打平。

他错过了。

他的队友克里斯-波什拿到一个篮板,

将球传给了另
一位名叫雷-阿伦的队友。

他打了一个三分。 它进入了加时赛。

他们赢得了比赛。
他们赢得了冠军。

这是篮球界最激动人心的
比赛之一。

我们能够
了解每个球员每秒的投篮概率

以及他们每秒获得篮板的可能性,

可以以前所未有的方式照亮这一刻

现在很遗憾,
我不能给你看那个视频。

但对你来说,我们

在大约 3 周前的每周篮球比赛中重现了那个时刻

(笑声

) 我们重新创建
了导致洞察力的跟踪。

所以,这就是我们。
这是洛杉矶的唐人街,

我们每周都会去的公园

,我们正在
重现雷阿伦的时刻

以及
与之相关的所有追踪。

所以,这就是镜头。

我将向您展示那一刻

以及那一刻的所有见解。

唯一不同的是,
不是职业选手,是我们

,不是职业
播音员,是我。

所以,忍受我。

迈阿密。

下三。

还剩二十秒。

杰夫举起球。

乔希接球,投三分!

[计算投篮概率]

[投篮质量]

[篮板概率]

不会去!

【篮板概率】

篮板,诺埃尔。

回到达里亚。

【投篮质量】

她的三分——砰!

平局还剩五秒。

人群变得疯狂。

(笑声

) 大致就是这样。

(掌声)

大致。

(掌声)

那一刻在 NBA 发生的几率大约为 9%

,我们知道这一点
,还有很多其他事情。

我不会告诉你我们花了多少次
才做到这一点。

(笑声)

好的,我会的! 那是四个。

(笑声) 好样的

,达里亚。

但关于这段视频的重要之处,

以及我们对每场
NBA 比赛的每一秒的洞察力——并非如此。

事实上,您不必成为
一个专业团队来跟踪运动。

您不必成为职业
选手也能获得关于运动的见解。

事实上,它甚至不必与运动有关,
因为我们到处都在移动。 当我们在我们的城市和世界各地购物和旅行时

,我们正在我们的家中、

在我们的办公室中移动

我们会知道什么? 我们会学到什么?

或许

,机器可以
识别时刻,而不是识别挡拆,让我

知道我女儿什么时候迈出她的第一步。

现在任何时候都可能发生这种情况

也许我们可以学会更好地利用
我们的建筑,更好地规划我们的城市。

我相信随着
移动点科学的发展,

我们会走得更好,我们会更聪明,
我们会前进。

非常感谢你。

(掌声)