**Question: **Who is an “elite” paint defender?

**Heuristic: **Measure three variables: Field goal percentage in paint, Field goal frequency in paint, Rate of passes out of paint after player drives/cuts into paint.

This isn’t a terrible set-up. The thought process is rather direct as it focuses primarily on **end-state** results. It’s an analysis that helped idealize Roy Hibbert several years ago. And while Hibbert was a great interior presence, his numbers are rather confounded: his Defensive Rating was only at “elite” levels when effectively both Paul George and David West were on court. More importantly, the pressure Hibbert yielded on the interior, combined with the pressure of the guards and other Bigs led to teams taking less efficient field goal attempts.

**(Side Note: **When I was working with an Eastern Conference team, the lead analyst mentioned he would have rather taken Hibbert over Blake Griffin if given the opportunity. The following year, Hibbert went to LAL and I made the bet that Hibbert’s defensive numbers would decrease dramatically over the next couple years because he doesn’t have D. West next to him anymore. The comment was tongue-in-cheek and West was emphasized as George had missed the year due to the leg injury, but the numbers did drop and has widely been blamed on the shifting tides of the NBA.)

Instead of making this an article about Roy Hibbert, let’s focus on the shifting tides that were becoming clear: Teams were finally adopting long range approaches and more complex offensive schemes to force rim protectors away from the rim. This led to sequences such as Hammer attacks or “Screen-the-Screener” action that would intentionally tangle rim protectors.

From a data science perspective, this becomes a nightmare in confounding players versus the system, IE: the Jae Crowder problem.** The drives that result in a pass away from the basket?** Are those designed passes to find open players within a complex offensive scheme or because the rim protector is a legitimate rim protector? **The low frequency of rim two’s?** Is this a fact that the team is finding a dynamic motion to to open more three point attempts? Here, we begin to understand the need for a **random effects model** that begins to separate out the **system**, which is widely considered a lurking variable for measures such as BPM and RAPM, from the **player**. In this article, we start to look at **identifying the system**.

The challenge with constructing a lurking variable into a feature is due to the inability to measure the lurking variable accurately. For measures such as Player Efficiency Rating, Box Plus-Minus, or Regularized Adjusted Plus-Minus, the values are derived from play-by-play data or synthesized from box score data; without any ability to adjust for play type. This play type (system) becomes effectively the reason a player such as Jae Crowder performs well for a 50+ win team in Boston that cannot escape the Eastern Conference Playoffs but then struggles mightily with a 50+ win team in Cleveland that eventually makes the NBA Finals. To this end, these types of models are effectively **Y = g(f(X)), **where **Y** is the resulting measure, **X** is the player activity, **f **is the function that measures the player, and **g** is the noise model. For RAPM, this model is explicitly given here. In a primitive form, the model is given by

**Rating = Player on Court + Error**

This model is effectively a **first order random effects model**. The first order means that the model only looks at the variables measured and **no interactions**. If RAPM truly cared about pairs of players, we’d see the explosion of variables where the 1’s and 0’s are multiplied. In this case we don’t, and we are left with a first order model. The randomness comes from not being able to define what players are one the court. Instead, we just sample them as they come. This is different than a **fixed effects** model, where we can simply identify who is playing when before the entire games begins.

Our goal at this point is to impose a new feature: the play type. We can then look at the model

**Rating = Play Type + Player on Court + (Play Type x Player on Court) + Error**

and we have ourselves a second order random effects model. We can visualize the play type as a **grouping** or **treatment** in terms of designs of experiments; but this now requires us to **cluster play types; **and hence measure the lurking variable. And there are two ways to do this: **Mechanical Turk **or **Tracking Data**.

The Mechanical Turk is a method of developing labels by hand instead of machine. It’s name comes from the famous chess playing “machine” from 200+ years ago. It is also the primary method for **Synergy** and **Krossover ** data collection. The process is tedious and often flawed. If you haven’t heard the question “Is that really a PnR?” 1000 times when working with Synergy, you haven’t worked with Synergy data enough. However, the process is good enough to produce actionable labels.

The PnR question from above started to make a lot of problems for analytics departments when the question if whether a hip tap by a passing by “screener” or an unused “screen” of a “screener” 5+ feet away from the play were considered as pick-and-rolls (even shallow cuts were being labeled as PnR’s).

While the simple understanding of identifying a screen becomes a challenge, more complex schemes such as breaking out plays becomes a near impossible task for these methodologies. For starters, to break down a play in the NBA we typically need to at least see the play **three times**. And that’s for experts who can break plays down.

Tracking data instead allows the scientist to apply machine learning techniques to help tease out actions. In this case, we are able to **template** plays based on their spatio-temporal patterns and then cluster the actions. And while this may seem sexy and time saving; this process if too often flawed. If you’ve ever heard the question “Is that really a post touch?” enough times when working with **Second Spectrum** markings data, then you haven’t worked with enough Second Spectrum data. Notice a trend here?

Regardless, attempting to identify complex plays using tracking data is also a very difficult task. There have been some public attempts, such as sketching from Andrew Miller; which performs a segmentation of track paths made by players, a functional clustering of segments (treating components as words), and modeling possessions (treating possessions as a topic modeling problem).

It’s a fairly strong attempt, and is fairly on par with my work since interacting with SpotVu data with teams from many seasons ago. However, this methodology suffers from the dreaded **time-warping problem. **That is, players run at different speeds along fuzzy paths in the same direction due to either competency or design. Taking a look at Miller’s paper above, time-warping rears its ugly head when cuts or perimeter motion takes effectively between 2 and 8 seconds.

A key benefit to the procedure, and why it becomes such a strong attempt, is that this is an unsupervised technique; allowing for construction of plays without encoding plays. Along with this unsupervised formulation, interpretability is easily available as tracks are identified as the vocabulary.

The methodology I’ve been using for the better part of five years comes from development on SportVU data with that same aforementioned Eastern Conference team. When it was originally presented to the staff, I probably received the largest glassy-eyed response I’ve ever received in my life. But at the end, it was able to separate out the effect of the defensive system on a player such as **Roy Hibbert** and identify that he was a product of the system; which maximized his talents exceptionally well. And, unfortunately, it’s not as a visually cool application as Andrew’s work above.

The methodology is rather tedious: We start with a collection of unmarked plays and break out their locations at each time step as a binned structure; not much unlike the shot locations in the Nonnegative Matrix Factorization procedure for field goal attempts. From there, we have to identify that we are now victims of two types of alignment: play start alignment and time-warping.

For play start alignment, we employ a **Fast-Fourier Transform**, treating the position of the players and the basketball as a a **signal** over time. The resulting **power spectrum ** can be used to cross-correlate plays to identify differences in start times between two similar plays in the 2D Fourier spectrum. Consider this equivalent to comparing two arbitrary signals over time that end up being same frequency, same information content with noise, disrupted by a time-delay. If the cross correlation’s peak is at time zero, the signals are at the same time. If the peak is offset from zero, the offset is the play alignment. The width of the cross-correlation is two-fold: “flat” schemes are differing plays and “fat” schemes are similar plays with time-warping or players doing slightly different actions. Unfortunately, identifying peaked cross-correlations doesn’t help us much; unless we mechanical turk plays in advance and use them as templates. And even then, this is a **global property**. Any slight changes will flatten and fatten the cross-correlation and leave us with no immediate reason as to why.

For time-warping, we tackle this problem later.

So let’s start understanding this system through the use of a particularly well known strategy: the **Horns** structure. Under this set-up, we will start to break down different Horns plays and apply data science techniques to uncover features that break the plays down.

The Horns offense is a well-known offense that is initialized with a dual screen action towards the ball handler. The “Twist” action is when the ball-handler is screened twice. Once by each screener, leading to a zig-zag pattern.

The action is straightforward and commonly used to tangle interior defenders at the free throw line. This will either open up a driving mismatch for the point guard 12-15 feet from the rim, open up a pullup three point attempt from the top of the key, or open up the initial screener underneath the rim.

To illustrate out process, we take a sequence of five Horns Twist plays to the right and plot them on the court. These plays have been subjected to the FFT mentioned above and the play tends to look very predictable.

If we up this towards twenty five samples, it begins to take a life of its own.

And now we start to see the jumbled mess we expected to see. Don’t ask for 500 of them, it colors almost a third of the court. However, we are able to start mapping out the **tensor** over time:

Applying a tensor decomposition, we start to identify characteristics, or **signatures, **of different styles of play. Here, we apply a **nonnegative CANDECOMP-PARAFAC decomposition**. This allows us to start breaking down the plays into a number of **components**.

For instance, if we settle on **one** component to represent a **Horns Twist**, we end up with a **Sideline component, **a **Baseline component**, and a **Temporal component:**

The sideline action will capture components of motion that occur along the sideline. Similarly, baseline action captures motion along the baseline. The temporal component identifies the **segments** of when activity occur. To reconstruct the play, we focus on the **outer-product** of these components. By taking the outer product, we see a significant amount of activity happening at the right of right around the perimeter. This component captures the motion of the screens and the ball-handler. In this case, the non-moving shooters have relatively insignificant roles; despite the small blips at 1 and 50 in the Baseline action; and the small blip at 1 in the sideline action.

More importantly, in the temporal component, we identify the screen actions. The first bump is the first screen, the second bump is the screener chasing the ball-handler and the second screen being set. The slight dip is the second screener approaching the ball-handler.

If we wish to expand on the decomposition and focus on breaking out particular components, we can. However, it should be noted that more components does not necessarily indicate better fit. In fact, if we break down the Horns Twist play with five components, we get seemingly more actions:

Here, we immediately see our rank-one action as the first component in the tensor decomposition. But now we see other activities. What is component 2 capturing? This happens early on in the possession, and again late. It’s location is primarily focused near the center of the court. Similarly, there’s two primary actions in accordance with the sidelines: **This is effectively the initial screener’s role**. In fact, this is his screen action towards the ball handler and subsequent roll to the basket. The temporal component at the end is the motion of the ball-handler entering into this region after the second screen.

Component three trims on this exact same action, allowing us flexibility in modeling the pick and roll type action that occurs on the first screen. What ultimately happens is that the collection of these components **captures players’ roles and motion** within an offensive scheme. For a common possession, I tend to use **fifty** components.

**Side Note:** There’s no distinct tried and true way to select the optimal number of components. This is an actual open research problem. Fifty is just a feel-good, warm, fuzzy number.

Alas, that time warping problem is back. Here, we mitigate it by using a dual attack on the temporal component. Using the tensor decomposition, the motion of the players will elicit similar signatures. However, we will see changes in the temporal components associated with the motion. A slow player will have distorted temporal changes. A delayed player, will have a shifted temporal component.

At this point, we again appease to the Fourier transform gods and cross-correlate these signals to find speed/reaction of player (fattening) and strategic delay (offset).

Let’s take a look at a subtle wrinkle.

The Horns 4-5 play is a near identical action as the Horns Twist play. The exception is that the secondary screener screens the primary screener.

This secondary screen action frees the original screener and typically sets up a three point attempt, or forces the interior defender to step up, freeing the secondary screener to slip into the lane. In this case, we selected 25 FFT’d pops:

And the associated **wormhole **plot:

As we start to break down the components, we immediately see a different structure. For a single rank-1 decomposition, we obtain a seemingly significantly different result:

We see the two screens like before, but this time they are located in different spots. We see the **identical screen** set at roughly 12 feet along the baseline and about 20 feet out from the basket. However, we see the second screen action that short of the first. This is the staggered screen the screener action. We also pick up the resulting flare of the primary screener as the rolling drop of the baseline action.

Similarly, the temporal aspect shows that the Horns 4-5 acts as a “smoother” play as two screens can interact simultaneously; as opposed to the Horns Twist that **requires a staggered time-delay screen on the ball-handler.**

Expanding out to five components, we have a similar decomposition of the play:

Comparing these components to the Horns Twist components, we start to see the massive differences between the two plays in the decomposition space.

At this point, we have to make a decision: do we store templates or use an autonomous structure. The former action resorts back to a **mechanical Turk** type activity. Here, we use subject matter expertise to design out plays and then collect the plays to **diagnose** a signature. Instead of keying thousands of plays; we merely have to key approximately 200 plays and use the template going forward. More importantly, we can diagnose specific **actions** within a play; and diagnose those. Typically, we piecemeal actions together.

The latter is to aggregate all actions and perform a decomposition with a large rank; or large number of components. This allows us to not have to template, but requires a significant amount of tender, love, and care to tease out actions and label them. This is more in the flavor of Miller’s paper above, but potentially runs the risk of developing many false-positives: ghost actions that don’t really occur but reduces the noise in the observed tensor.

Despite this, we can then take a team’s actions and merely fit the components to a team. This will yield a collection of coefficients that in turn. These coefficients acts as weights for the types of plays that teams run. For instance, in the 2015-16 NBA season, the highest weight for the **Los Angeles Clippers** was the **Horns 4-5**. This play, coincidentally, was a Bread-and-Butter play for the Clippers when ran with Chris Paul, Blake Griffin, and DeAndre Jordan. Furthermore (not so coincidentally), when Austin Rivers replaced Paul, the timing was significantly flattened out; indicating that the play took much longer to develop.

It’s indeed a heavy-lifting methodology; but it’s a way for data science to interact with NBA modeling by leveraging tracking data without having to impose heuristically developed features that can be tainted by lurking variables.

]]>This was a working document at the time; and has not been updated since the course. That said, the document effectively breaks down play-by-play data to build a box score and look at 5-man lineups.

Enjoy!

Document: PythonPandasExample

By the way, this document is the precursor to developing 5-on-5 stats such as this Minnesota Timberwolves one from mid-season in the 2017-18 NBA season:

]]>In the Pistol action, the offense attempts to catch the defense before it sets in hopes to find optimal mismatches or blown coverage by a lack of defensive rotation. It’s called an **early offense** as it usually begins on the heels of a transition or is the initiation of an offensive set. One of the key components is that the Pistol breaks up other revolutionary defensive rotations such as BLUE, as the offense is set up to go sideline already. The difference here is that if Pistol is run correctly and efficiently, there is rarely a two-nine defender who can deter the layup.

Pistol, also known as the “21 series” to many teams, starts in a triangular format. Typically, utilizing the point guard, the shooting guard, and a big; hence the “21” in the name. The triangle usually runs its base parallel to the sideline as almost to be set up as a give-and-go far away from the basket.

Typically, the Pistol will be initialized through one of two options: **the pass** and the **dribble**. These two different initializations will dictate the how the primary and secondary actions will break out. Ideally, the court is spread out such that there are no offensive players near the key.

It should be noted that the Pistol need not start in spread-option. This is a common set-up, but not always the case. By using this spread option, however, the defenders that are coming down into position must make initial decisions to guard space or their man; both leading to decidedly difficult situations.

The pass option mimics a “dump-and-chase” outlet; similar to a give and go. In this situation, the point guard passes ahead towards the shooting guard. Usually the point guard has drawn a defender well outside the three point line. By dumping the pass, the point guard is free to accelerate by chasing the ball. This forces the point guard defender to have to rotate and accelerate; thereby putting him at a disadvantage for staying between his man and the basket.

Situationally, this places more emphasis on two defenders: the shooting guard and the two-nine; if the latter even exists.

As we see the Point Guard chase the pass, the defender saddles near the player, forcing them towards the sideline. In this case, the offense must make their **primary decision** with the basketball.

The standard option is to perform a give-and-go. The Point Guard can rub his defender off the Shooting Guard using a handoff, forcing the Shooting Guard’s defender to either **show** or **drop**. A show will uncover the shooting guard for a roll to the basket, while a drop to give the Point Guard’s defender a chance to fight through the screen with minimal contact will allow the point guard breathing room.

The primary action actually catches many teams off-guard. Let’s take a look at the execution from a Portland Trail Blazers game against the Houston Rockets on November 3rd, 2013.

Here, **Damian Lillard** (POR – 0) tosses the pass ahead to **Mo Williams **(POR – 25) with **LaMarcus Aldridge** (POR – 12) playing the big position. As the Pistol initializes, notice how **Wes Matthews** (POR – 2) fades to the opposite corner, drawing **James Harden** (HOU – 13) away from the action, and **Dorell Wright** (POR – 1) staying at the opposite wing, drawing **Francisco Garcia** (HOU – 32), above the key.

This ensnares **Dwight Howard **(HOU – 12) on Aldridge, leaving **Patrick Beverly **(HOU – 2) and **Chandler Parsons **(HOU – 25) to guard the give-and-go. Notice Beverly stays well beyond the three point line; giving up the dump-ahead pass to Williams. Lillard then accelerates hard, leaving Beverly in rotation and forcing Parson to show. With a full head of steam, Lillard blows by Parsons for a nearly uncontested layup as Harden merely watches from the weak-side.

If the defense reads the give-and-go well, then a path to the basket does not appear and the offense must resort to a **secondary action**. This action is usually either a screen or a pass. Regardless, the secondary action must operate through the use of an off-ball player’s action.

The most common is the **Screen-the-Screener** action. We will see this pop a few more times later in this breakdown. The action is simple: after the give-and-go handoff screen, the Big comes to set the screen for the Shooting Guard. This action creates a flare to the top of the key for a potential open three; or opens up a slip by the post if the defense reacts poorly towards the shooter.

As example, consider Portland’s December 6, 2013 game against the Utah Jazz. In this play, **Mo Williams **(POR -25) initializes the offense through **CJ McCollum **(POR – 3) with **Brooke Lopez **(POR – 42).

In this situation, **Diante Garrett **(UTA – 8) plays well off Williams; but is hedging towards the center of the court. After Williams dumps to McCollum, Garrett and **Alec Burks **(UTA – 10) **switch** the play, and **Enes Kanter **(UTA – 0) drops into the paint to help deter the drive. Note that Kanter can get away with this as Lopez is not a well-known three point shooter… even moreso in 2013.

This leads us to the secondary action: Lopez comes to set a screen on Garrett. However, as Garrett already hedged to the center of the court; this forces McCollum out of the play. Lopez then moves into another secondary action and screens Williams. At this point, we have already reached 8 seconds into the shot clock and the Pistol is nearly a broken play. Despite this, the screen forces Burks to go under, leaving Williams for a lightly contested 21-foot jump shot; which is effectively a win for Utah on the play except for one fact: Williams knocked it down to give Portland the lead.

The second primary option on the Pistol is for the Shooting Guard to keep the ball. In this case, the Point Guard will typically run away from the Shooting Guard to establish a secondary action from the Big. This is effectively a screen-the-screener action, but the screener kept the ball for a **fake handoff** as opposed to a real **handoff**.

To illustrate, let’s consider a quick Lakers action against the Detroit Pistons. Here, **D’Angelo Russell** passes ahead to **Jordan Clarkson. **In this case, Clarkson keeps the ball and turn towards the center of the court, where he is met with a secondary action screen from **Brandon Bass** for the mid-range two.

Typically, keep action from a pass-ahead requires a secondary action as the Shooting Guard usually has their back to the basket out on the wing. Therefore, this action is the rarest of the four major primary actions for a Pistol series.

Instead of a dump-and-chase option, the Point Guard may instead dribble towards the Shooting Guard and set-up a dribble handoff, or DHO. This type of initialization of the Pistol forces the on-ball defender to converge to the Shooting Guard; whereas in the pass option, the on-ball defender can change coverage away from the ball (as it is passed).

Under the DHO initialization, we head into the two primary actions: **handoff** and **step-up. **These are slight variations on the dump-and-chase primary options above, only because the ball is in the Point Guard’s hands as opposed to the Shooting Guards hands. Due to the dribble action, a screen is much more likely to occur (**step-up**) than in a passing initialization.

The first primary option is to perform a dribble handoff. In this action, the Point Guard will typically set a screen to clear out a path for the Shooting Guard to drive. As the handoff action usually pushes the Shooting Guard towards the center of the court, defenses can naturally react and contain this motion.

As an example, let’s consider an example from the Houston Rockets versus Sacramento Kings game from November 25, 2016. In this example, the Rockets won the tip and went directly into a Pistol action.

The reason for such an action is to force the smaller guards on Sacramento, **Ty Lawson** and **Darren Collison**, to interact with **Matt Barnes** against the stronger duo of **James Harden **and **Patrick Beverley**, with **Ryan Anderson **stalking the perimeter. With the spreading of **Clint Capela **and **Trevor Ariza**, Sacramento’s big men of **Rudy Gay **and **DeMarcus Cousins** are pulled away from the defensive action. In the end, this Pistol action should create a 3-on-2 game of Beverley, Capela, and Ariza against Gay and Cousins.

As we see at the end of the clip, Gay and Cousins leave Ariza on the perimeter and pack the lane. Barnes shows to push Beverley along the perimeter. Without a full head of steam, Beverley is unable to penetrate the key and Lawson is able to recover. This leads into a secondary action, the **wide pin** screen.

A wide pin screen is a pin-action screen that sets the screen away from the center of the court with the purpose of opening up a lane for the screened offensive player towards the center of the court.

In the Rockets-Kings example above, we see at the end of the clip that Anderson sets a wide-pin on Harden’s man (Collison). As the ball has been taken back to the top of the key, the Pistol series has run its course and the offense resets by placing the ball back into Harden’s hands.

And we see that the possession is rather lengthy, taking a total of 21 seconds to convert for a score; hardly an instant offense.

The step-up screen is one of the most common screens in the Pistol series. This action turns a DHO into a step-up screen by serving as a pick-and-roll/pop/other action that potentially frees either the Point Guard or the Shooting Guard by baiting the defense into a double team. The primary actions on a step-up is a **Drive **to the rim, or a **pullup. **

To illustrate consider this example from a Mavericks – Rockets game from December 4th, 2015. With the Mavericks railing 79-80 after a **Jason Terry** (HOU) layup, the Mavericks go into Pistol with **Raymond Felton** at the point, **Chandler Parsons** at the wing, and **Dwight Powell** at the top of the key.

Parsons hits the step-up screen on **Ty Lawson**, effectively pinning him on the play. With **Corey Brewer **hugging Parsons on the screen and **Josh Smith** not getting back fully; tightly guarding a non-threatening shooter in Powell, Felton drives unabated to the rim to reclaim the lead.

If a defense manages to disrupt the ball handler’s path, a secondary action is commonly put into place. This action is either a **screen-the-screener** action as before, or a **misdirection** screen.

For a misdirection, from the same Rockets-Mavericks game as above, we are hit with a step-up screen from **Wes Matthews **(DAL) that brings **Deron Williams **(DAL) down the sideline. **Marcus Thornton** (HOU) disrupts the drive and allows **Patrick Beverley** to recover on the play.

The secondary action is then a **slip-screen** from **Dirk Nowitzki** (DAL). The beauty of the action doesn’t come from Nowitzki’s slip screen. It actually comes from Matthews’ **zipper cut**. Matthews performs a zipper cut to the top of the key, rubbing **Clint Capela **at the elbow. This is done in tandem with Nowitzki’s feigned screen, discombobulating Capela into double-teaming Williams at the perimeter.

This action frees Nowitzki up for a wide open fifteen footer, which unfortunately hits the back of the iron and misses. Nowitzki is clearly disappointed with the miss, as such a sweet secondary action found an open shot for an elite shooter.

For a **screen-the-screener** action, we can refer to a Suns-Lakers game from October 29, 2010. In this play, **Jason Richardson** (PHX) hits **Steve Nash’s **(PHX) defender, **Derek Fisher**, with a step-up screen. As he does so, **Kobe Bryant **(LAL) shows to close Nash’s driving lane. With a secondary screen by **Robin Lopez **(PHX) on Fisher; who is closest to Richardson at this moment, Richardson pops and gets an open look for three.

Up to this point, we broke down the simple actions of the Pistol series. However, this is just a brief introduction as there are literally **dozens** of options to run off this series. Some designed plays such as **Backdoor Options** or **Shuffle Cuts** exist. The primary take-away from this example is to develop an intuition on how to read when a Pistol formation is being established and how it interacts with a defense.

Traditionally, **play diagnosis** is a job that performed using video analysts and video tools such as Synergy, Eagle, or AVGEN. However, with the use of **templating** or **sketching**, we are able to start performing play diagnosis through the tracking data. The challenges then translate to **repeatability**, **exchangability**, and **variability**.

Do we see enough instances of the play to determine it is in fact the play. This is one of the biggest challenges in play diagnosis. Having a full scope of the play helps us diagnose whether a play is a Pistol or if it some other sort of set. For starters, we see a triangle pattern in three locations with the ball at the “point guard” spot. Are we in Pistol?

Maybe…

To define Pistol, we require that action between the Shooting Guard and Point Guard; after all it is called a 21 series. Therefore, any old triangle pattern does not constitute a Pistol. Similarly, this is an early offense action. Sure, the same action could be run late in the shot clock; but that’s not the identity of Pistol; as one of the primary functions is to disrupt the defensive setting.

Furthermore, to diagnose the wrinkles of Pistol, we need to see the action multiple times. Not necessarily the same players, but at least the same **roles**. Which leads us to…

If we attempt to template a play, we cannot simply designate player motion. Instead, we must look into **role motion**. That is, if I have James Harden and Chris Paul on the court, at any single moment they may switch roles on the court. Simply tracking Harden and Paul will cause increases in variability and a reduction in repeatability.

Therefore, we impose a role definition, much like we did throughout this description: Point Guard, Shooting Guard, and Big. If we choose not to select roles, we are on the hook for requesting of upwards to** 120 times the number of necessary plays of a single wrinkle of Pistol.** Good luck with obtaining those.

The other challenge is to identify variability in the plays. Using tracking data, it is very rare to see the same pass twice. If say twenty iterations of Pistol on the right side of the court involve dump and chase during a game (this is ridiculously high by the way), then just measuring the location of the pass leads to considerable amount of variability.

Take for instance a series of ten Pistol plays ran during a recent season by the Portland Trail Blazers. Here, we isolate ten random events of right-side only Pistol. We even curated it to be Lillard to McCollum. Even with this fine-tuning, we see considerable variability of where the pass was initiated and the pass was received.

Therefore a method for capturing variability is required before we can start clustering different plays.

Given these requirements, the goals are straightforward at this point. We template plays to start to identify an encyclopaedia of offense for each team. We can start to measure quantities associated with offensive players such as **burst/acceleration**, **reaction time to screen**, and **court vision**. Similarly, we can start to diagnose tendencies of defenders such as **reaction time** or **coverage range**.This helps us measure the overall athleticism of a player and their associated IQ relative to specific situations.

But first, we have to understand the situations they are in. And Pistol, being a large part of offenses, is just a start.

]]>

Above, we compare the Rockets and the Celtics, both teams that ended their seasons in Game 7 of their respective conference finals. The Rockets only posted a .460 FG% for the season (15th in the league, 11th among playoff teams) as the Celtics were a playoff-worst .450% for the season (22nd in the league, 16th among playoff teams). While the Celtics made their mark defensively by holding opponents to .440 FG%, and more importantly a .495% eFG% (2nd best in the league), the Rockets aired out their offense to a tune of .551 eFG% (2nd best in the league). Houston accomplished this by taking 42.3 3PA per game compared to their 41.9 2PA per game, the highest ratio of 3PA attempts in the history of the league 50.2%!

That said, the Rockets’ 2PA are primarily from high percentage ranges of 60% success, as opposed to mid-range locations that tend to hover closer to 40% success. And it’s this reason that their eFG% stays relatively stable at .551.

Despite this, how do we compare these shooting distributions? A naive manner would be to “bin” the shots in categories such as “paint”, “mid-range”, “rim”, and “three” and compare the distributions. The reason for its naiveté is due to the game not being **symmetric**. An offense that overloads to the right will have a distribution that tends to be right-dominant. We saw this very clearly in the league last year.

In fact, taking a look at the Rockets chart above shows a bit of right-dominance. So why would we just lump everything as a “non-paint 2”? We lose critical information on teams and, at an individual level, their players.

To this effect, we compare shooting distributions by understanding the underlying **structure. **The structure of these distributions will help us identify different types, or styles, of shooting for a team. And the most common way to identify structure is to look for an underlying **basis** or **motif** representation.

The most common way to break down structure of a distribution is to perform the well-known dimensionality reduction technique called **Singular Value Decomposition**. This process takes a matrix of values and assumes that the values can be reduced into three parts: **A rotation for the input space, a stretching of the input space, **and **a rotation to the output space**. Pictorially, if we take a matrix of values **A**, we can write them as a matrix product **USV**, where **V** is the rotation of the input space, **S** is a diagonal stretching along each direction, and **U** is the rotation to the output space:

Through this process, we can start to visualize how to capture structure in NBA shooting distributions. To start, we take the two-dimensional shot chart and bins the shot frequencies into pre-specified bin location, such as performed by Andrew Miller in his 2014 paper. In this case, it’s common to set the matrix, **P**, up as a **25×24** matrix as the half-court is given **2′ by 2′ **bins. Therefore, the maximum rank possible for this matrix is 24.

Note that we used the matrix **P** and not the matrix **A**, which is our data matrix. This is because, we have not constructed our data matrix the way we’d like just yet. Recall that our goal is to identify the trends of teams and, more importantly, players. Therefore, we can breakdown the data matrix as an **Nx600 **matrix by unrolling the shot chart for each player. In this case, the input space is the **player **and output space is the **player’s preferred locations to shoot.**

The matrix **V** then identifies the orthogonal basis to compare shooters. The matrix **S** identifies the differences of shooters relative to their spatial locations. And finally the matrix **U** rotates these spatial differences to the actual spatial locations of preferred shooting. But in order to get here, we must impose more rigor; as we will not have an interpretable solution using only the SVD.

Given the set-up above, it is not enough to proceed analyzing the data. For example, simply applying an SVD, we could obtain undesirable results. For instance, we may obtain negative counts at specific locations! To combat these types of results, we impose a **nonnegative matrix factorization (NNMF) **structure.

The SVD process in the previous section is a **matrix factorization** technique that can be summarized as **A = USV = HW**, where **H** is a weighting matrix and **W** is the structural matrix. When moving from an SVD set-up to another matrix factorization set-up of similar vein, we ideally identify the “additional requirements” we impose on the factorization.

For instance, **Principal Component Analysis** (**PCA)** assumes that the matrix **A** is mean-centered (columnwise typically). And therefore it is common to refer SVD as being equivalent to PCA.

Another example is if we impose **W** to have linearly independent columns. We then obtain **Independent Component Analysis (ICA)**.

And if we impose that the elements of **W** and **H** are non-negative, then we obtain **nonnegative matrix factorization (NNMF)**. It is this requirement we impose to ensure that we avoid obtaining negative shot attempts. NNMF is completed by imposing a number of **structural elements, r, **and minimizing the Frobenius norm

By writing some basic code to trawl through play-by-play, we can build a dictionary that identifies every player with their binned shot-chart:

This results in a **shots** dictionary that is **player : court location counts**. We can then unravel the **N** players and stack them in an **Nx600** matrix as such:

To show how uneventful and effectively unhelpful the shot matrix is, we printed it out:

However, applying the NNMF, we obtain special structure. Let’s look at the first three components:

Here, we identify right-hand dominant players that either shoot the three from the wing **and** drive to the basket. The second component identified mid-range baseline shooters who also attack the rim. The third component is rim only shooters. The idea is simple. To discriminate between players in spatial components 2 and 3, we simply impose the **weights** to emphasize each respective component for each player. Therefore, a rim-dominant player will have a higher weight for component 3 than all other components. But a LaMarcus Aldridge type player will have a higher weight on component 2 than component 3.

As we include more structure components, we start to see the different roles pop out. Here, we find our paint shooters such as Kosta Koufos and Marcin Gortat (component 4), our perimeter shooters (component 5), and our corner three shooters (component 6). The remaining four components are:

We start to see similar components rear their ugly heads, such as components 3 and 10, but they are subtly separating shooters from front-on rim scoring (three) and left/right rim scoring (ten).

Using these components, we’ve effectively uncovered basic structure in shooting distributions. So let’s go back to our introductory example: Boston and Houston.

If we take a look at the core of the Celtics roster from this past NBA season, we are able to extract out their respective weights for the spatial components defined above:

Let’s take a look at some of these players:

Here, we see that Kyrie Irving is a “jack-of-all-trades” kind of player as he emphasizes all spatial components in his game. Taking a closer look, we find that his emphasis of shot selection rests strongly in components 5 and 2. These are **perimeter threes from the wing** and **mid-range jumpers from the baseline **with **attacks at the rim**. A key takeaway is that Irving is least-likely to take jumpers from the left elbow, as the eighth spatial component weight is small.

Given the volume of shots, if we take a look at the Celtics’ shot chart at the intro, we find a healthy dose of those mid-range shots, that Houston doesn’t take, are courtesy of Irving.

Horford is another mid-range shooter on the Celtics’ roster as his weights stress spatial components 2 and 9. Spatial component two suggests that Horford takes many mid-range jumpers with the ability to score at the rim; while spatial component 9 suggests that Horford can knock down the top-of-the-key jumper.

This is indeed Horford’s style of play as he is a consistent top-of-the-key shooter; typically as a second or third option on a play that kicks the ball outward towards the top of the key.

Jaylen Brown is a complementary player to Irving and Horford, as his weights focus on spatial components 3, 5, and 6. This indicates Brown to either be a rim-attacker or a three point shooter. As Brown doubled up his minutes towards 30 minutes per game this past season, we saw an associated jump in his FGA per game. More importantly, 73.7% of Brown’s attempts were from these three spatial components.

Furthermore, Brown de-emphasizes the mid-range game, making him an invaluable player on the offense; making him a maximizing eFG% type player who can stretch the court and attack the rim.

Break-out rookie Jayson Tatum had himself a fantastic year for the Celtics and provided much offense to help boost the team into the playoffs and ultimately the conference finals. His distribution reads as a mix of Rozier and Irving, providing himself not only as a strong complementary player, but also a number one scorer. His weights push at Rozier levels (indicating volume) but facilitates across spatial components 1, 2, and 5; indicating that he is a perimeter shooter with an ability to get to the rim.

However, Tatum also pops up at a team high component seven. This is the “dreaded” mid-range shot from the free throw line. In this region, he took roughly 15% of his field goal attempts at a .450 FG%; thus providing an expected point value of 0.90 points… well below a desired 1.10 per possession. And given Tatum’s volume in shooting, this colors in the remainder of the Celtics’ shot chart above.

So let’s compare the Celtics to the Rockets. From the shot charts above, we see there is a distinguishable difference in mid-range attempts between the Rockets and Celtics. However, to gain insight on the player traits, we can look at the resulting weights for each Houston player.

The fact that so many zeros litter this table shows the discipline taken by the Rockets roster when it comes to shooting. Areas where significant number of zeros occur as in spatial component 2 (**midrange**), spatial component 7 (**midrange**), and spatial component 8 (**midrange**). Usually, there is a small amount showing randomness. But not here. This shows almost complete discipline instilled by D’Antoni and staff on this roster.

We also begin to see which players are given the green light for midrange attempts. This is **James Harden** and **Chris Paul**. As we creep closer into the paint, secondary players get their midrange attempts in: **PJ Tucker, Eric Gordon, **and **Clint Capela**. But these numbers are significantly small; with exception of one of the best mid-range shooters in the game: **Chris Paul**.

Harden posted the highest weights across the team this past year, which should come as no surprise as he is the team’s leading scorer and volume shooter. His focus this past season was heavily influences by spatial components 5, 1, 2, and 9. All of which are a high 1.0+. Spatial component six is the **perimeter three** attempt. Houston valued this shot more than any other team in the league; and it accounts for 33.6% of his weight.

Combine this with his ability to drive and hit shots along the way contribute to components 1 and 2 spiking, as component 1 identifies three point shooters and attack the rim and component 2 identifies baseline mid-range shooters. On top of this, Harden pops on component nine, which is the top-of-the-key jumper; which he and Chris Paul are the go-to shooters at this location.

Chris Paul follows a very similar strategy as Harden as components 2, 5, and 9 are significant to Paul’s shooting strategy. Missing, however, is component 1, which indicates that Paul is not so much as a rim attacking guard as Harden is. In fact, Paul tends to trade rim shots for mid-range paint floaters and jumpers as components 7 and 8 flair up.

Component 8 is a typical location for guards to shoot floaters; a shot that Paul is known for picking up after making an attacking dribble towards the rim from the perimeter. More importantly, it’s a left-side dominant play, which falls in line with right handed scorers; whereas Harden picks up the right-side dominant shots as he is a left-handed player.

Trevor Ariza and P.J. Tucker were Houston’s corner three specialist. We see that both Ariza and Tucker have their highest weights on spatial component 6, the **corner three**. Houston did not value the corner three as much as other teams; but having these two players dutifully serve their roles in position, defending teams had to keep track of these two players.

The different between these two players rested in the fact that Ariza was more likely to attack the rim than Tucker. This gave Ariza a different wrinkle than Tucker. That said, Tucker’s go-to move for driving was to attack the center of the lane, as evidenced by his spike in component 8; which Ariza weighs in at zero.

Given this introduction to non-negative matrix factorization, we are able to being characterizing shooting trends for teams around the league and begin to break down tendencies of specific players. However, this is just one of the first steps in breaking down an offense.

From here, we may look at year-to-year trends, or use this characterization to develop a spatio-temporal analysis. Or, we may use this as an underlying dimension reduction technique to understand if a player can change their shooting strategy.

How would you employ this data science capability to understand offenses better?

]]>When we discuss these roles, we usually can identify clear examples. For instance, when we think of **rim protectors**, we think of guys who cover the lane quickly and can not only rebound, but gather blocks like **Dikembe Mutombo** or **Roy Hibbert**. When we think of **rim runners**, we think of the guys who crash the boards hard from outside the paint like **Clint Capela **or **Amar’e Stoudemire. **When we think of **space creators**, we identify the guys who box out well and may not get as many rebounds like **Robin Lopez. **

Regardless of their sub-specialties, the end goal of their specialty is simple: create space and get boards. Sure, some of these players score as well; the more capable a scorer, the better… but as we will soon find out, this is not theses players specialties. What these players ultimately become are our **forgiving teammates: **the ones who yield second chances.

A **chance** is a a sub-possession quantity that measures the possibility of scoring a basket. Anytime that sub-possession terminates, either the possession ends or another new chance emerges. Common ways to terminate a chance is to attempt a field goal, turn the ball over, or termination of a period. This is not to be confused with NBA Stat’s awkward definition of Second Chance Points:

**As a personal side note:** playing at all levels except professional and working on or with coaching staffs at all levels **including professional**, this has never been the indication of what second chance points means. Opposed to being a “free-throw” definition, second chance points has been commonly defined as “any points scored after an offensive rebound.” **We are going to roll with this traditional definition**.

Second chances are just that: An offense failed to score on their first field goal attempt and an offensive player has bailed the offense out by securing the rebound. This breathes new life into the possession and gives the team an extra chance at scoring! Dump-and-chase is still alive.

By having a rebounding specialist on the team, an offense can enjoy a couple benefits such as **shooting perimeter shots at will** and **forcing the defense to find the lurking rebounder**. There are some drawbacks to having a rebounding specialist on the court such as **poor free throw shooting **and **poor perimeter shooting**, but dependent on the team structure, these drawbacks may be overlooked.

So how much of an impact do these rebounding specialists have on the game?

A rebounding specialist is a **forgiving teammate** as they are erasing the mistakes of a teammate with their rebound. Often times, it may be their own mistake. To understand their impact, we become interested in what these teammates do with the ball after they have secured the rebound.

Commonly, teams strive to hit the **1.10 points per possession **mark. In a 100 possession game, this equates to 110 points scored; which typically ensures a win. Using this value as a benchmark, we would then be interested not only on the offensive rebounding potential of a player, but we are also interested in their points per offensive rebound. Think of this as a **lower bound** on their points per possession mark; as multiple offensive rebounds may occur on a possession.

So who are the top offensive rebounders in the league?

We can do the naive thing and sort players by their **offensive rebounding percentage, **but we’d end up with **Jack Cooley** being the top offensive rebounder in the league. We can do the other naive thing and impose an **arbitrary cut-off** that makes little to no sense, such as “minimum 1000 minutes played.” Then Golden State’s starting Center, **Zaza Pachulia**, is eliminated. Yes, he started 57 games at center in the 2017-18 NBA season.

Instead, we focus on the count of offensive rebounds and adjust as necessary with offensive rebounding percentage. A common tactic is to perform the **cross-product value: OREB*OREB / (OREB + OppDREB)**. We can use other denominators such as “total rebounds” which encapsulates team rebounds as well. If we play off this list, we obtain the following ranking:

We immediately see the usual suspects at the top of this list: **Andre Drummond, Steven Adams, **and **DeAndre Jordan**. Some are lower on the list than expected due to lower offensive rebound counts such as **Hassan Whiteside** (missed 28 games) and **Tyson Chandler **(missed 36 games). Others are lower because their team took **many** missed FG’s such as **Anthony Davis** (13th in league in OREB but only 7.7% OREB%) and **Taj Gibson** (12th in league in OREB but only 8.1% OREB%).

The above list are your prime candidates for who the rebounding specialists are. From here, we become more interested on their impact on possessions. IE: **Who’s more dangerous when an offensive rebound occurs… Domantas Sabonis **or **Thaddeus Young**? Or relatable: **Do we game plan for Steven Adams the same as we would for Andre Drummond? **

We are able to partition play-by-play and start understanding what happens when an offensive rebound is obtained. For instance, we can initialize a rebounder dictionary and keep track of secondary chances:

And then from there, it’s a simple **iterrows** walk through the game file:

From this set-up, we identify how many points are scored on second chances. During the course of processing, however, we did find a handful of errors in the NBA play-by-play logs; most concerning **time_elapsed** and **sequence_number**. Despite spending several hours hunting these items down, there are a couple persistent ones (and partially a reason to be cautious of play-by-play driven site statistics such as Cleaning the Glass).

To identify the top points scorers, instead of looking at the number of second chance points scored by a player, we **credit the rebounder with the points scored**. The purpose for this is to identify the impact of the rebounder on the game. Using this philosophy, we obtain the following Top-54 list:

As you can see, these players are sorted as Player / Team. This means that certain players are split up if they played on multiple teams; such as **Blake Griffin**. In the example of Griffin, he would not fall within the Top-54 players: he contributed to 74 second chance points on 74 offensive rebounds.

Here we see the top three rebounders atop this list as well. However, we see **Enes Kanter **slide down in favor of **Karl-Anthony Towns; **as Towns holds an exceptionally impressive 1.37 points per offensive rebound. Differently, Steven Adams leads to less than a point per offensive rebound; identifying that while the Thunder possession is elongated, it’s not necessarily dire straights for the defense. We will take a deeper look at this shortly.

We note that Clint Capela, in line with Houston’s perimeter philosophy, generates lots of three-point attempts (67 out of 242 rebounds); a number only rivaled by Steven Adams as Adams has 11 less (56) despite requiring 142 more offensive rebounds to get there (384).

Another interesting note is that **Ben Simmons** is the top rebounding guard leading all point guards with contributing to 172 points over 145 offensive rebounds. **Russell Westbrook** comes in right behind Simmons with 171 points over 151 offensive boards.

The rebounders that improve chances of scoring dramatically? That’s **Brook Lopez **(1.39), **Karl-Anthony Towns **(1.37), **Nikola Jokic **(1.33), **Giannis Antetokounmpo **(1.32), **DeMarcus Cousins **(1.32), **Pascal Siakam **(1.36), **Anthony Davis **(1.26), **Nikola Vucevic **(1.26), **Ryan Anderson **(1.26), and **Andrew Wiggins **(1.26). The eleventh spot is tied among several players at 1.25 points per OREB: **Joel Embiid**, **Larry Nance Jr.,** and** LeBron James.**

Let’s compare some of these players.

Andre Drummond, despite only 1.03 points per offensive rebound, is considered one of the best offensive rebounders in the game. When coaches game-plan for Detroit, a common theme is to reduce the number of second chance points. And it’s no wonder: **Andre Drummond leads the league in generating second chance** points. But where do those points come from?

We find that 379 of Drummond’s 414 points generated are scored by himself. A whopping 73% of his offensive rebounds turns into put-backs; of which he is only a 58% shooter. If he gets to the line, he rests at a 58% clip; making it favorable to foul the big man.

However, one item is clear: Detroit’s three point shooting is nonexistent when Drummond rebounds the ball. Detroit managed to go 2-22 (11%) from beyond the arc in such situations. Similarly, the Pistons struggled from the two-point range on Drummond rebounds, shooting below fifty percent at 13-31 (42%).

DeAndre Jordan’s name frequently comes up in tandem with Drummonds thanks to their similar style of play: ferocious put-bank dunks, deterrence to shooters in the lane (on defense), and sub-optimal free throw shooting capability. Jordan lands second on the list for second chance points scored with 364 points, a whopping 50 points less than Drummond; but at a higher rate per offensive rebound at 1.11 points.

Whether it is due to the quality of shooting or how the offense responds to offensive rebounds, the Clippers were far better from the perimeter when Jordan secured offensive boards, coming in at 16-for-33 (48%).

Here, we find that Jordan only puts-back 62% of his offensive rebounds for a 117-205 (57%) rate. This identifies Jordan as being more efficient with his putbacks when compared to Drummond; as well as improving the opportunities for others to score around him in second chance situations.

Another marked improvement is that Tobias Harris, Austin Rivers, and Wesley Johnson combined to go 11-for-16 from three when Jordan gains offensive rebounds. Despite being small sample sizes, it’s an interesting takeaway that Harris, who split time with both Drummond and Jordan, would go 0-3 in one situation and 3-for-4 in the latter. This doesn’t signify that Jordan is a better passer than Drummond; but it lends to investigate what are the differences in these situations as commonly 1-2 baskets are the difference between a win and a loss.

Steven Adams, the third of the big three in second chances, is quite a different player. He’s not much of a dunker; nor is he an intimidating force as a defender (IE: not the first name that pops into your head as a big time blocker). Most importantly, he is the weakest of the three players when it comes to generating points per offensive rebound: 0.93.

Of his 384 offensive boards, only 213 went right back up. This lowly rate of 55% indicates that he is highly likely to kick the ball back out to Westbrook, **Carmelo Anthony**, or **Paul George**. That said, 83 of Adams’ 358 points came from those three as Westbrook cashed in on 40 points, Anthony for 22 points, and George for 21 points.

An interesting result that pops up from Adams’ distribution of second chances is that Carmelo Anthony is an abysmal 2-for-17 from beyond the three point line. Similarly, Paul George is 2-for-10 from within the arc. This combined 4-for-27 absolutely demolishes Adams’ points per offensive rebound production; aside from mentioning Adams’ spotty free throw shooting capability at 18-for-45 (40%) and the 40 turnovers.

What is gleaned at a high-level from here is that the Thunder are become chaotic after second chance points generated by Steven Adams.

There are some wonky results that pop up under Steven Adams’ teammates. This is simply an issue with time-outs, synchronization of NBA’s play-by-play sequencing, and time elapsed. But there are few and far between and we can ignore the random Cousins, Holiday, and Teague results.

With a new contract in hand, we come to Karl-Anthony Towns; the power forward for the Minnesota Timberwolves. Being the best scorer at the top of this list, Towns also establishes his dominance as an offensive rebounding juggernaut by providing 330 points of second-chance offense for his team.

Of his 241 offensive rebounds, Towns put back only 57% of his rebounds, giving a significant chance for redistribution of the ball. It shows in his teammates’ production too: **Taj Gibson** benefited for 20 points, **Jamal Crawford **cashed in for 18 points, **Andrew Wiggins **picked up 16 second chance points, and **Jimmy Butler** got 13 extra points. The distribution means that the Timberwolves could strike from any position; unlike the Thunder’s Big Three Only attack with Adams.

On top of these point totals, his teammates **scored**. The aforementioned four players shot 19-for-29 for two and 6-for-12 from three. And don’t count on fouling Minnesota: they shot 57-for-70 (81%) from the line. Basically, this means **Towns must be kept off the glass at all costs**. And if he manages to get an offensive board, **good luck**.

In true Minnesota fashion, they attacked from the right hand side of the basket and attempted many mid-range field goals. What this indicates is that either Towns scored immediately, or they ground-out a new offensive chance as if it were a new possession. Of the four top second chance scorers, Minnesota showed the most poise as they re-ignited their offense in hopes of wearing out a defense and getting the look they actually wanted.

And to drive this home, the most impressive stat of them all: 12 total turnovers.

We take a jump from many more centers and power forwards and land at one of our first premier perimeter / inside-out/ ball-handling players on the Top 54 list: Giannis Antetokounmpo of Milwaukee. Antetokounmpo jumps high on this list due to his propensity to get the team to score, as he checks in at 4th on the list of points per offensive rebound.

Antetokounmpo is effectively the agile and dexterous version of DeAndre Jordan when it comes to second chance points. Despite playing further away from the basket, and hence having less opportunity to secure offensive rebounds, 158 to Jordan’s 329, Antetokounmpo puts back 64% of his rebounds for a solid 74% rate: 74-for-101. With an effective field-goal percentage of .718, Antetokounmpo is one of the most efficient scorers in second chance points generated by themselves.

Similar to Minnesota, Milwaukee’s performance is fairly efficient on second chances generated by Antetokounmpo, but the quantity is lacking. Only **Eric Bledsoe** scored in double digits (15 points on 6-for-10 shooting) while **Khris Middleton** (3-for-7) kept a very pedestrian production level.

Despite this, Milwaukee kept turnovers low: 8 total… a slightly higher rate than Minnesota on Towns’ second chances. An astonishing take-away is that **no other Bucks players picked up free throws when Antetokounmpo secured second chances**. Compare this to the 15 free throws picked up by Middleton (6-for-7) and Antetokounmpo (4-for-8) when **John Henson** grabbed 148 offensive rebounds.

We skip over the number one rebounding point guard (**Ben Simmons**) in favor of the triple-double machine in **Russell Westbrook**. Westbrook managed to secure 152 offensive rebounds this past season and turned them into 171 points, which is above the 1.10 points per possession line. How he did it, however, is quite interesting.

Westbrook put back up less than half of his rebounds, which indicates he was a ‘cycle-the-offense’ style of player. While his shooting numbers suffered greatly on second chances at 37-72 (.514) 2P, 1-4 (.250) 3P, .521 eFG%, Carmelo Anthony and Steven Adams benefited greatly.

Anthony shot a blistering 10-for-13 from the three point line en route to 40 extra points. Adams uncharacteristically made 3-of-4 free throws to go along with his 5-of-7 shooting for an extra 15 points. Only Paul George and **Corey Brewer** struggled to score on second chance points generated by Westbrook.

Given the nature of second chance distributions, we can start to break down what teams end up doing with their possessions. We find that Drummond is a great rebounder, but lacks the ability of DeAndre Jordan to finish baskets. We also find that Steven Adams leads the Oklahoma City Thunder into chaos as he tries to kick back out to their big three if he doesn’t have the chance to get a put-back.

We also saw how the Minnesota Timberwolves are patient and restart their offense through Karl-Anthony Towns; and how Giannis Antetokounmpo and Russell Westbrook defy the traditional “bigs” approach to becoming a rebounding specialist.

Where we’d want to go next is breaking down how other specialists open up paths for rebounding; such as the Robin Lopez types. And furthermore, what position these rebounders put themselves in before attempting to get the rebound. Think of this as an advanced way of **adjusted OREB%; **which would in turn give us better insight into the intelligence these rebounding specialists bring to the game.

And before we leave, here’s the distribution of second chance points across the league for the 2017-18 NBA season:

]]>To capture data to answer these questions, we resort to “Next Generation” tracking methodologies; which are commonly equated to items such as wearable devices. In an effort to motivate Next Gen devices, let’s consider the aforementioned player performance problem.

One of the goals for monitoring the load of a player is to help inform a coaching staff about the availability of a player. May it be at the micro-scale: say within the course of a game; or at the macro-scale: say over the course of several days. Early models propose that player performance increases with proper training, decreases when training is not applied, and plateaus if consistently applied.

To this end, no training is ever the same for two different players. One player’s body may be at a different stage of growth, a different type of build, and/or a different type of medical background. In order to understand the differences in training regimens, we must next need to define a “training model.” The most relatable model is **strength and conditioning**. But to simply say that training is only these two components would not only be dismissive, it would be a disservice to understanding basic player performance modeling. Instead, we start at S&C and ask how we define strength and conditioning.

Using Calvert’s (1976) model, they propose a cardiovascular, strength, skill, and psychological component-based methodology. For the cardiovascular component, we measure endurance components such as oxygen intake, blood circulation, and blood lactate. We call these measurements the **internal measurements **of the system. For the strength component, we measure power output, speed, acceleration, and other various seemingly-odd measurements such as angular velocity, balance, and distributional force. We call these measurements the **external measurements**.

The skill measurement is the most well-known component in basketball. This component measures “competency” at completing tasks. One of the most basic measurements is shooting free throws after a sequence of sprints. Any basketball player from age five on up is most likely familiar with this practice-ending habit. At the professional level, more robust skill activities are performed; but the idea is still the same.

The psychological measurement is the most-publicized and least-understood of these four components. If you’ve ever seen a Gatorade commercial, you’ve seen marketing for this component. Here, we attempt to measure the “drive” of a player and attempt to understand the motivation for completing a task in the face of adversity; such as body fatigue. However, measuring this component is excessively difficult as it requires understanding the mental tenacity of a player.

Just on these four components, we see that only one component (skill) has been thoroughly addressed, while two others (cardiovascular and strength) are currently in the midst of a technological breakthrough, and the fourth (psychological) is still in its infancy. For **internal measurements**, we attempt to use monitors such as oxygen intake masks and heart rate monitors; but these are hidden state devices and we are still attempting to make head-way in better understanding how to measure internals of a player. For **external measurements**, we have the benefit of next generation devices; one of the best (at the moment) is the **accelerometer**.

Over the previous handful of years, wearable devices have been mentioned as being an up-and-coming innovation in player tracking. Companies like Kinexon Sports, based out of Munich, Germany, have popped up to provide technology and dashboard-based insight into the external measurements of player motion. To be a complete system, it too provides a tracking methodology akin to Second Spectrum, but instead relies on a wearable radio frequency (RF) device instead of a camera-based device.

Since we introduced Kinexon as the example, let’s stick with their product as the exemplar. Despite the RF technology present in the wearable, it’s not so much the RF technology that creates the Next Gen solution. It’s the internal measurement unit (IMU) package they employ. Not to be confused with internal measurements from before, an IMU is an engineering concept for measuring the body in motion using a measurement device on the system. In this case, Kinexon deploys an **accelerometer**, a **magnetometer**, and a **gyroscope**.

Let’s focus on what these components actually do. Please note, this is not going into the specifics of what Kinexon does, but rather focuses on what the types of components can do. If you’re interested in the actual system, I refer you to click on their name above!

An accelerometer is a device that was invented within rocket science decades ago with the purpose of measuring acceleration of a rocket. A goal was to understand required accelerations to achieve proper trajectories for rockets to stay on a desired course. More importantly, the devices could measure rocket apogee and orientation. Today, accelerometers are used in cell phones as they help us with simple things like turning the screen on when we orient the phone towards our face.

**Warning Techno-Babble: **Decades ago, accelerometers were big and bulky; but today they are small. Small enough to fit inside a cell phone as a microchip. Acceleration is typically measured through the use of semi-conductance. An electrode sits inside a small “container” and is supported by a cantilever. The cantilever is wired to a circuit to process the electrode motion. Within the container, two other electrodes line the walls of the container, producing a couple of **capacitors**. As we move the container, the electrode shakes. The amount of capacitance that changes between the walls identifies the motion. More importantly, the chance in electric charge identifies not only the direction of motion, but the amount of motion as well. Hence we have acceleration in magnitude and direction!

Accelerometers give us fantastic measurements. They may be slightly messy, but from our previous stochastic tracking article we know we can filter the results and obtain quite reasonable estimates! Want to know which direction a player is actually moving? Look at the accelerometer data. At this point, we can revisit the stochastic model and remove the assumption that acceleration is constant between two points and now state **I know the** **acceleration**.

Despite now having acceleration in hand, we still don’t know certain aspects of the player motion: which way the player is facing or how fast a player is moving. The gyroscope helps us understand that.

The gyroscope is another important piece of wearable technology that actually has existed for nearly 200 years. The purpose of the gyroscope is to identify three-dimensional angular velocity. That is, understand when orientation is changing. One of the most common applications of the gyroscope is in Steadycam technology.

**Warning Techno-Babble: **Much like the accelerometer, the gyroscope of old are large devices. However, today’s gyroscopes can be modeled as a micro-electro-mechanical (MEM) system using silicon. In these small chips, a ring is typically suspended through an etching process, supported by a spoke system to help old the ring in place and measure its vibrations during movement. The vibrations then travel through the wired system where it is processed into vectors of motion. The result of this technology provides us with angular velocity and changes in orientation.

To illustrate its use, consider the simple running drill of sprinting to half court and turning to face and opponent; back-peddling the rest of the way. The accelerometer will identify the sudden drop in speed as you break into your turn, even providing the negative acceleration direction. The gyroscope will identify the actual speed and direction of speed throughout the process.

What neither the accelerometer nor the gyroscope tell us are, what direction is the player facing? To answer this, we use the **magnetometer**.

Magnetometers are effectively compasses. They identify directionality of an object. These devices are part of the MEMs technological package mentioned above and simply point to magnetic north. Thus, when fashioned to a player’s shorts at the logo along the waistline, the resulting vector is the direction at which the player is facing!

If we combine these three IMU components, we have the orientation of a player, which way they are moving, whether they are rotating, and how rapidly the changing their motion. Therefore, we are able to build a comprehensive model of player motion.

The only component we are missing is their actual location. Note: this is where the RF component of Kinexon comes in handy (and self-sustainable) and the camera-component of Second Spectrum helps.

By the way, with current technological capabilities, these devices are tiny and light-weight. Think roughly the weight of a AAA-battery and the size of a match-box.

So if we run with an IMU-based external measurement device and a position locating sensor, we are able to measure effectively all of our core mechanical motion. Set’s perform a simple exercise.

Suppose a player is located at **(87.0, 30.0,** **3.3****)**. Consider the value 3.3 as the height of the wearable. Then as the player jumps for a rebound, we see the acceleration vector have a fairly large magnitude downward, decreasing at the position at which the player explodes upward, and then large magnitude vectors upward towards the basket. Similarly, we will obtain slight motion in the forward-backward directions and the left-right directions as the player squats (body motion may move backwards if the player is a poor jumper) and tilts for the ball (towards the basket).

Of course, this is a simplified view of the acceleration. The data that comes out are x-,y-, and z-directed values relative to acceleration (or capacitance). Note that there is a sixth vector there, it’s just the value **(0,0,0)** as the player has come to rest before exploding upward.

The angular velocity plot is similar, but the vectors will be in much different directions, as they define the change in angular direction. Instead of plotting these vectors, instead focus on the acceleration plot and note what is striking. Got it? The vectors all come from the origin. This means, we do not know the players location. Therefore, we simply add these vectors to the position estimate to obtain the “Donnie Darko effect.” That is, a vector protruding from the player at each path between their initial point of the jump **(87.0, 30.0, 3.3) **and their position at some point after explosion **(****86.4, 28.7, 6.2)**.

The result is a diagram like such:

Piecing all four components together, we obtain the player motion. In the illustrative image above, we obtain the orientation of the player (green vector) showing that he is facing the baseline during a rebound. Similarly, we obtain the angular velocity of the player (blue line), which is point upward and away from the basket, indicating the player is rotating backwards, upwards, and away from the basket. Finally, we obtain the acceleration of the player (red line), which is point downward and towards the corner of the key, which indicates the player is starting to be initiated in contact and coming near his apex in his jump.All of this tracking cannot be obtained clearly from simple tracking points.

All this description has been about measuring the externals of a player, with very little mathematical modeling at the stochastic level. The reason why? Data is severely limited and enhanced modeling is in its infancy when it comes to player motion.

At the moment, we are able to improve the parameters of the stochastic model outlined in the previous article. However, that’s only a small piece of the puzzle. Instead, we’d like to measure load and fatigue; and study their effects on player performance. And to that end, we need to get working.

]]>One of the basic issues is that the tracking data isn’t nearly as it seems. In fact, each player is represented as a singleton: a single point on the court. This is effectively the center of a bounding-box fit around a player of interest. It does not take into account the players height, broadness, or wingspan. Therefore the single point will assume that Ty Lawson and Anthony Davis are the same person when given the same point. To combat this, we can augment the data and include personal information for each player. We’ve even done some of that in correcting “real-estate” for rebounds. The point is, each point is really a point estimate generated from a distribution of likely locations that a player resides.

So what does this mean for us?

Let’s take an excessively naive estimator of the velocity of a player. Assume that a player’s location at time **i** is given by **p_i**. If we want to estimate the velocity of the player at that time, we may compute

Note that we take the future time point and subtract the previous time point and divide by the amount of time elapsed between the measurements. For standard NBA tracking data, the delta-t value is typically .04 seconds. This is effectively the simplest estimator for the velocity, and is usually wrong when put into practice. Let’s see why.

Suppose a player is traveling at a constant speed of 9 miles per hour over a sequence of three points. Suppose the player starts at **p_1 = (32.8021, 19.0808)**. Over the following two time-steps, the player moves at a constant speed of 9 miles per hour to **p_2 = (33.2594, 19.3448)** and **p_3 = (33.7167, 19.6088)**. On the court, these three consecutive time points look like:

As we can immediately see, there appears to be very little movement over the .08 seconds. If we compute the speed of the player, we can apply the above formula, and we obtain a velocity vector of **v_i = (11.3575,6.600). **Computing the length of this vector, we obtain **13.1359 feet/second (8.96 miles per hour)**. We have a slight offset because we rounded during the process.

This means that the player of interest is moving at a speed of 8.96 miles per hour **at the second time step**. Without any extra information, we are unable to estimate the speeds using this estimation process for time steps 1 or 3. However, this isn’t the problem. Instead, we realize that the data points are still merely a sample estimate.

Let’s assume this player is Tobias Harris. His registered wingspan is 6’11”. Let’s assume, for the sake of argument, that Harris’ shoulder-to-shoulder measurement is roughly 1/5-th his wingspan; or 16 inches. Then, this is the bounding box at which the data measurement tool is attempting to collect. From camera resolution and speed/positioning of the player, we may end up with approximately 1-4 inches of error on the measurement. Let’s suppose best case scenario that the player is missed by one inch. Then the velocity estimate becomes can fluctuate to anywhere between **8.3 mph **and **9.6 mph**. And immediately, we have over an entire mile per hour change in measuring a player just due to sampling noise; or stochasticity of the collection process.

The takeaway here is that when using a naive, and rigid, estimator on tracking data that is stochastic in nature, we may end up with quite undesirable or misleading results. So how do we begin to incorporate the stochasticity of the tracking data?

Before we tackle stochasticity, let’s first revisit how players actually move. We visited this idea in a previous post last year, and in that exercise we used the naive estimators. It was simple [notice how “choppy” the velocity and acceleration plots are] but effective in introducing player motion.

First, for a player to move from point, **p_i,** to a different point, **p_i+1**, they must have a non-zero speed. This is captured in the equation

Similarly, we must identify changes in velocities. To capture this, we must estimate the acceleration of a player.Here, acceleration is captured using the equation

And from the kinematics equations, in the x-direction, we have

The result is analogous for the y-direction.

**The idea is this: **

For a series of two time points, **.04 seconds in duration**, we assume that acceleration is constant. That is, if a player is slowing down, they are slowing down constantly (piecewise) over a sequence of points. This assumption is required since we cannot estimate the acceleration between two time points. From this estimated constant acceleration, we can update the velocity of the player. And from this estimated velocity, we can retrieve the position of the player. However, for a measured value of the position, we can correct (or smooth) the estimates of the position, velocity, and acceleration.

This leads us to a basic stochastic framework called **filtering**. And if we make even more rigid assumptions (which are generally accepted), such as the errors are Gaussian, then we obtain **Kalman Filtering**.

With all this theory set up, let’s just walk through an exercise of motion for Tobias Harris. Recall that we only measure **position estimates**. From above, we see that these estimates may be fairly noisy. Let’s identify where we can model this noise.

To start, we have a **motion model**. This motion is the physics noted above. For two points, **p_i-1** and **p_i**, we make note that we have no information in-between these two time steps and therefore assume acceleration is constant over this .04 second period of time. **Note: **This does not assume that acceleration is the same between two different intervals; just constant within each interval… hence piecewise linear.

This motion model will update our **state **of the **system**. To be clear, the state of our system is the position and velocity of the player of interest. The state of the system and the motion model is given by

This ugly matrix formulation is just the same equations as above! We just broke out the x- and y-directions of the player motion. To make this a stochastic model, we inject randomness by suggesting that the **acceleration is noisy**. Therefore, we suggest that **a_i ****is a two-dimensional Gaussian centered at zero with some constant variance**. This acceleration will help us capture the changes we see in the velocity (recall the 8.3 versus 9.6 mph example above), and inherently capture the position error as well.

However, this is not all. We don’t measure velocities; so we must introduce a **measurement model** to help capture the velocity information. In our set-up, the measurement model is given by

We call the measurement **z**, while the true state is given by **x**. This means we never get to see **x** in the raw; but rather we see **z**. The values **e_x** and **e_y** are the x- and y-errors in measuring the position of a player. We call this the **measurement error**. In the case for Tobias Harris, this would be something to the effect of, say, 1 inch in each direction**.**

The way we interpret this model is as follows:

We hold an assumed value for the current state of the system: position and velocity of a player, **x**. We then observe a measurement for that player’s position, **z**. Using that measurement, **z**, we can update the expected state of the system**, x**, to a smoother, more realistic version **x|z**.

And it’s this conditional representation that gives rise to the use of **Hierarchical Bayesian** **Modeling **for estimating player position and velocities.

We start by rewriting the **motion model** as a simple matrix equation:

Similarly, we rewrite the **measurement model** as a simple matrix equation:

Our goal is to then find **x_i | z_i **using the stochastic model above. To do this, we adhere to Hierarchical Bayesian modeling, that suggests **given measurements z_1, …, z_i**:

These four equations are the mean and variances for the **filtering** and the **forecasting** distributions, respectively. The index **i|i** is the filter process obtained through the **measurement model**. This is an update of the state vector given the measurements. The index **i|i-1** is the forecast process obtained through the **motion model**. This is a prediction of the current state given the previous state and all previous measurements.

Since we are assuming a Gaussian model (from the error structure), we simply have a Gaussian-Gaussian Hierarchical model. Therefore, computing these expected values is straightforward.

For simplicity, let’s rewrite the matrix equations one more time:

All we have done is just absorbed the errors into an “error” matrix. Without bogging down the details of the mathematics, we obtain the following algorithm:

**Parameters of Interest: F, H, R, Q**

**Initial Conditions: x_0|0 = constant, P_0|0 = constant matrix**

- Forecast to time-step 1
- Apply the motion model with no noise to obtain the predicted state of the system:
**x_1|0 = F*x_0|0** - Apply the motion model with no noise to obtain the predicted covariance matrix of the system:
**P_1|0 = Q + F*P_0|0*F’**

- Apply the motion model with no noise to obtain the predicted state of the system:
- Compute the
**Kalman Gain****K_1 := P_1|0*H’*(H*P_1|0*H’ + R)^{-1}**

- Filter using the measurement at time-step 1
- Filter the state of the system:
**x_1|1 = x_1|0 + K_1*(z_1 – H*x_1|0)** - Filter the covariance matrix of the system:
**P_1|1 = (I – K_1*H)*P_1|0**

- Filter the state of the system:
- Repeat for all time-steps in the future.

There are two very special items of note here: the **Kalman Gain, K_i, **and the **innovations, z_i – H*x_i. **The Kalman gain is an artifact of a matrix inversion algorithm used when computing the posterior distribution of the Hierarchical Bayesian model. Through the algorithm, it identifies how much weight should be given to the measurement and current state of the system. We see it is heavily driven by the **measurement noise, ****R,** and the **process noise, Q.**

The innovations are actually measurements of the predicted value for **z_i** and the measured value of **z_i**. This is helpful in understanding how much correction is actually needed in the filtration step. And due to the smoothness of the system, the Kalman gain acts as a gate for how much correction is applied; as we now the measurement is still noisy.

With the stochastic model in hand, let’s compute the algorithm.

Let’s revisit Tobias Harris on a transition play. From the April 1st, 2018 game between the Indiana Pacers and the Los Angeles Clippers, we have a transition play during the first quarter. Harris leaks out on transition on the left side-line, eliciting a lead pass from Lou Williams. Harris accelerates to receive the pass and uses his momentum to blow by Indiana’s Darren Collison for a dunk.

Despite pushing the lead for the Clippers to 5, the Pacers would go on to win 111 – 104. But let’s break out the sequence of points that represent this drive. In total, there are roughly 100 points along this break. Plotting the transition, we see the player track:

If we are compute the naive velocities, we obtain the speed plot:

We see the moments where Harris slows upright before the pass is made, the acceleration and attempt to avoid contact with Collison, and then the pair of dribbles made before bursting towards the basket for the dunk. However, this is a very noisy plot and gives off the idea that Harris takes two major slow-downs to dribble. It’s not necessarily the case.

If we assume a favorable one-inch error in the measurement model, **R**, and a slight perturbation in the motion model, **Q**, we can start building the Kalman Filter for the stochastic distribution. Note that **R** is a 2×2 matrix representing the errors in the position estimate, and **Q** is a 4×4 matrix representing the errors associated with the model. Here, we just use **R** to be the one-inch error along the diagonal; zero everywhere else. For **Q**, we simply use an identity matrix.

The propagation matrix (motion model), **F**, is a 4×4 matrix with rows (1,0,.04,0), (0,1,0,0.4), (0,0,1,0), (0,0,0,1). The measurement matrix, **H, **is a 2×4 matrix with (1,0,0,0) and (0,1,0,0) as its rows.

Then, assume that the initial state vector is the first observation with zero velocity and the initial covariance matrix is just the identity matrix. We use this to forward propagate the system to obtain a predicted position and predicted covariance. The first predicted state is merely the first point again.

Due to the position scraping algorithm I’m employing for video, the locations are in a funky notation. Apologies in advance. But here’s the first iteration of the Kalman Filter process:

This may look a little overwhelming, but don’t let it fool you. It’s simple to perform by following the above “Four Step Process.” Carrying out this process, we obtain almost the identical path; except smoothed to account for measurement error.

This is what we expect! Next, we should hope to see the actual acceleration of Tobias Harris; with near collision with Collison and two dribbles. Watching the video, we know that he does not perform a “herky-jerky” motion but rather ramps up, avoids contact, and accelerates into the basket.

And this is indeed what we see. We also see the immediate termination of the dunk as Harris’ momentum carries him about the rim. Where as the naive estimate assumes Harris somehow accelerates 8 feet per second hanging on the rim.

So there you have it. A basic introduction to Kalman Filtering and introducing a basic model for Stochastically measuring tracking data. In case you are a glutton for punishment like I am, if you’d like to see the proof of the material, feel free to scroll through my handwritten notes below. Happy tracking!

Click to view slideshow.And yes… simple code:

]]>When the new probability structure came out for the NBA playoffs, analysts were quick to point out that the act of tanking wouldn’t necessarily be addressed. Expected draft pick models started to pop up and show that the probability adjustments just kicked the can down the road in terms of where tanking really starts to pick up. Let’s quickly rehash this argument before diving into insanity:

From the figure above, we see that the black line represents the old “worst team picks first” scenarios. Consider this the pure incentive for tanking: worst team will get best pick. There is absolutely no incentive, with respect to the draft, for a lottery team to win. With the introduction of the lottery, and its iterations over the years, we identified an “optimal” probability structure that lasted for roughly 20 years. This is represented as the red line. We see that the worst team still has the best chances of obtaining the best pick in the draft, but there was uncertainty. From the figure above, we see that a top 3 team is penalized. Their expected draft pick is worse than their seeding. All other lottery teams (except the fourth team) improve their odds of obtaining a top three pick. Unfortunately, the probabilities for the better teams is so low, there is effectively no incentive to continue losing. This effectively leads to a collection of **four-to-eight **teams that may aggressively pull back the reins on superstars in favor of G-League level talent in hopes to lose games.

To account for this gaming theory, the NBA introduced new probabilities that flatten out the top three seeds and effectively shifts the negative incentive to the top four teams in the draft. In this case, it becomes more attractive for a team to finish 7th, 8th, or 9th worse than before at the expense of being worst, second-worst, and third-worst. In fact, this does eliminate teams from losing as many games as possible to losing as many games as possible to be third-worst. Effectively kicking the can down the road.

So how can we radically change the draft lottery process? **By letting every team in the playoffs**.

You heard that right. Let’s include every team into the NBA playoffs. But instead of a traditional playoff format, create a “lottery” branch of games that gives every team a chance to play Cinderella while securing a spot in the lottery. The only way to pull this off is to manage a series of negative events: **travel**, **time off**, **intentional** **losing**, and **revenue.**

Currently, the NBA Playoff structure is a sequence of four “Best-of-Seven” series among sixteen teams. The teams are organized in a Western Conference and Eastern Conference; many times the organization eliminating a Top-16 team from making the playoffs. **Sorry 2017-18 Denver Nuggets**. The games are effectively spaced every other day with games played in a 2-2-1-1-1 format: Two games at home, Two games on the road, and then every other for the final three games. The format is to ensure that the “Home-Advantage” team has as many or more home games than their opponent at any time during the series, but that the “Home-Disadvantaged” team gets all their home games in before the “Home-Advantage” team gets all four of their home games.

The minimum number of possible games in the post-season is 60 games; the maximum is 105 games.

With this in mind, let’s start knocking out some playoff rules.

All lottery-bound teams are given a “Cinderella” spot in a two-tiered single-elimination tournament that plays at a home-location of the better seeded team. If you win, you play on. If you lose, you wait and see how the playoffs play out.

**Drawback**: Due to the 30-team nature of the NBA, this forces seeds 5 through 16 to play in single elimination games. In particular, teams 5 through 8 will be burdened with losing one-to-two home games in case they lose.

**Advantage: **These single elimination games will bring large amounts of drama and excitement. It forces teams to play hard until the end instead of “jockeying for position” heading down the stretch of the season.

With the influx of new single-elimination games, we are set to gain 14 new games. Therefore, by eliminating 2 games off each first round series, we reduce the maximum number of games by 2; while increasing the minimum number of games by 6. For those keeping track, instead of a playoff range being 60-to-105 games, we now have 66-to-103 games.

**Drawback: **The image of Dikembe Mutombo strikes fear in many when “Best-of-5” series is uttered. This was one of the flaws: an 8th seed team has a much higher chance of winning when the series is “Best-of-5” as opposed to “Best-of-7.”

**Advantage: **However, that 8th seeded team is coming off a travel day after playing an intense single elimination game against a team that may be a little thirsty for making some noise as a Cinderella.

As the games play out, the sooner a team loses, the higher up the lottery board they go. However, each round of games needs to have the teams filtered out. A simple way? Be in the weakest thread of winners to gain the top draft pick. That is, lose your first game to a team that loses their first game to a team that loses their Best-of-Five series to a team that loses the Conference Semi-Finals to a team that loses in the Conference Finals to a team that loses in the NBA Finals. That’s the top seed.

The non-lottery teams? They are Best-of-Five teams and are ordered based on records; just as we had in previous seasons.

**Drawback: **This ensures teams that are not in the “Bottom 12” have zero chance of obtaining a “Top 6” pick in the draft. Similarly, due to standard playoff builds, the worst teams in the draft have a smaller probability of gaining the top pick in the draft compared to the 5th and 6th worst teams in the league.

**Advantage: **This removes the incentive to fail in the regular season. If you want the highest probability of winning, aim for 5th or 6th worst in the league. Or better yet, try to be a home team that punts their first round game in hopes of getting a higher pick. Either way, it forces teams to not want to finish last in the league heading into the playoffs; but yet promotes weaker teams into better draft picks.

Without further adieu, if we apply this to the 2018 NBA playoffs, using conference placing, we obtain the proposed bracket:

Notice that we merely recreated that Minnesota-Denver “playoff” game from the end of the 2017-18 NBA season. If the lower seeds all lose out, then the lottery becomes:

- Orlando Magic (Actual: 6th, Seeded: 5th)
- Memphis Grizzlies (Actual: 4th, Seeded: 2nd)
- Chicago Bulls (Actual: 7th, Seeded: 6th)
- Dallas Mavericks (Actual: 5th, Seeded: 3rd)
- Atlanta Hawks (Actual: 3rd, Seeded: 4th)
- Phoenix Suns (Actual: 1st, Seeded: 1st)
- New York Knicks (Actual: 9th, Seeded: 9th)
- Los Angeles Lakers (Actual: 10th, Seeded: 10th)
- Brooklyn Nets (Actual: 8th, Seeded: 8th)
- Sacramento Kings (Actual: 2nd, Seeded: 7th)
- Charlotte Hornets (Actual: 11th, Seeded: 11th)
- Los Angeles Clippers (Actual: 13th, Seeded: 13th)
- Detroit Pistons (Actual: 12th, Seeded: 12th)
- Denver Nuggets (Actual: 14th, Seeded: 14th)

Now let’s suppose Utah pulls off the upset over Oklahoma City, but lose to Houston. Then nothing changes as no thread into OKC exists. However, if Phoenix goes on a two game win streak over the Clippers and the Spurs, the Suns have pulled themselves out of the lottery and into the 15th pick in the draft (can’t go any lower due to record). Assume for further sake they lose to the Warriors in the Best-of-5 Round.

The lottery order then becomes:

- Orlando Magic (Actual: 6th, Seeded: 5th)
- Memphis Grizzlies (Actual: 4th, Seeded: 2nd)
- Chicago Bulls (Actual: 7th, Seeded: 6th)
- Dallas Mavericks (Actual: 5th, Seeded: 3rd)
- Atlanta Hawks (Actual: 3rd, Seeded: 4th)
- Los Angeles Clippers (Actual: 13th, Seeded: 13th)
- New York Knicks (Actual: 9th, Seeded: 9th)
- Los Angeles Lakers (Actual: 10th, Seeded: 10th)
- Brooklyn Nets (Actual: 8th, Seeded: 8th)
- Sacramento Kings (Actual: 2nd, Seeded: 7th)
- Charlotte Hornets (Actual: 11th, Seeded: 11th)
- San Antonio Spurs (Actual: 18th, Seeded: 18th)
- Detroit Pistons (Actual: 12th, Seeded: 12th)
- Denver Nuggets (Actual: 14th, Seeded: 14th)

That’s right, **the trade-off for losing a potential two home playoff games is movement into the lottery. **Similarly, the trade-off for dropping a handful of spots in the draft is potentially multiple home games in the playoffs.

Now let’s suppose we end up with the higher seeds all winning **except for Warriors over Cavaliers** in the NBA Finals. Then the lottery order becomes:

- Orlando Magic (Actual: 6th, Seeded: 5th)
- Dallas Mavericks (Actual: 5th, Seeded: 3rd)
- Memphis Grizzlies (Actual: 4th, Seeded: 2nd)
- Atlanta Hawks (Actual: 3rd, Seeded: 4th)
- Chicago Bulls (Actual: 7th, Seeded: 6th)
- Phoenix Suns (Actual: 1st, Seeded: 1st)
- New York Knicks (Actual: 9th, Seeded: 9th)
- Sacramento Kings (Actual: 2nd, Seeded: 7th)
- Detroit Pistons (Actual: 12th, Seeded: 12th)
- Los Angeles Lakers (Actual: 10th, Seeded: 10th)
- Charlotte Hornets (Actual: 11th, Seeded: 11th)
- Denver Nuggets (Actual: 14th, Seeded: 14th)
- Brooklyn Nets (Actual: 8th, Seeded: 8th)
- Los Angeles Clippers (Actual: 13th, Seeded: 13th)

We see how the lottery results jostle about due to the final seven series of the playoffs. Talk about making fan bases more interested in the outcomes of games in which their teams are not even participating. Furthermore, we see how teams are put as a disadvantage for losing games late in the season as being the worst team no longer places you in position of the best lottery pick (or even top three).

A side benefit is that we no longer have to debate the veracity of the draft, even though it has been proven time and again that is an unbiased procedure. So let’s look at some arguments.

The main argument is commonly about travel. In fact, articles popped up about travel when discussion about reseeding the playoffs came up. Let’s work on understanding how travel is affected. First, there are **five** travel days built in per seven game series. For the course of the post-season, a team may find themselves traveling upwards of 20 travel days. In our current set-up, no team can travel more than 20 days; **and that requires them to play all games possible while being a bottom 12 team in the league**. So… travel is actually reduced.

They actually aren’t longer. It’s actually the same number of days, and in fact we reduced the number of maximum games possible from 105 down to 103; while increasing the number of minimum games from 60 to 66. Combine this with the fact that we increased the minimum number of elimination games from 15 to 29, we also increased the intensity level for fans watching.

Take note that while only one day is listed for the single-elimination games, it’s truly staggered over two; much like the first games of the NBA playoffs currently.

There is the same amount of rest, if not more rest in this set-up. The top 18 teams actually get an extra day off between the end of the season and the start of the playoffs. For the other 12 teams, they are on the same rest path as a seven-game series in the first round of the playoffs.

This argument is the collegiate argument: If every team makes the playoffs, the regular season is meaningless. That couldn’t be further from the truth. Imagine games where the 8th and 9th seed are on the line. That’s the difference from getting a series versus a single elimination game. Or even between teams trying to get away from the basement. Or games where a single elimination game gets home-court advantage. There’s many more scenarios where the positioning becomes the urgency.

What we can concede is that winning a division gains less value. But then again, can you recite the number of times the Orlando Magic had a chance to win the **Midwest Division **in the **Western Conference**? That’s right, Orlando was in the Western Conference in the 1990’s. Divisions aren’t as important as we think they once were; and recently the NBA agreed by eliminating required top four seeding for division champs. **Sorry 6th Seeded Miami Heat.**

This is probably the strongest argument out there. There is the real possibility that **eight teams** lose a pair of home playoff games. The tickets, television revenue, and merchandising for those games are huge. Teams have a very real possibility of losing money. However, in a utilitarianism framework, the money lost now is money gained later as the teams that don’t make the playoffs have a very real potential to get home games in the playoffs. A home elimination game none-the-less.

Sure, they could. We could see a team gain a home elimination game and then play a G-League quality team in hopes of securing a top 6 pick. But in order to do that, they have to win the right amount of games. It’s harder to make sure you go .500 in the final month than it is to go .100. That’s a tough strategy, but it is a strategy that really only be cashed in once the chips fall into place. And at that point, it’s one game you’re willing to tell your fan base that you really don’t want to make a run.

This is another legitimate argument, as generational talent comes once every few years. Therefore the bad teams must be at the top of the draft in order to cash in and make improvements. However, that’s not how it always fell in the past. Derrick Rose (pre-injury) was picked up by a 9th-seeded Bulls. John Wall was picked by a 5th-seeded Wizards. Many other star players managed to slip out of the top-5 as well. Like Kobe, Steph, Lowry, DeRozan, Kawhi, PG, Jimmy, Giannis, Rudy, etc. Hence it’s not necessarily true that the weak keep getting weaker; although the probabilities get slimmer against generational talent.

So while there are arguments, we can see that the process indeed reduces tanking, improves revenue league-wide, and restructures the lottery process while giving every team in the league something to play for late in the season.

It’s a radical idea. And there may be larger holes than the ones above. However, it’s a way to get Sacramento back in the playoffs. It’s been 12 years.

Sound off if you have ideas on improving the process; or provide your own radical changes! This is simply for fun and just shows a different way to think about all aspects of the playoffs. Remember where we started with this exercise: with absurdity.

]]>Let’s consider a simple play where an uncontested transition turns into an assisted, uncontested transition.

In this play, Rajon Rondo secures the ball on defense after a bad pass is made by the Chicago Bulls. Rondo, takes the ball nearly the length of the court uncontested. Instead of scoring, he drops the ball off to a trailing, also uncontested, Ray Allen. Allen finishes the “pick-six” transition with a dunk.

It’s easy to suggest this moment is a stat-padding situation for Rondo. However, the score would not have been made had Rondo not already initiated the transition. Similarly, Allen would not have scored had he not trailed the transition. Many arguments can be made here about the assist such as “empty” (zero) assist, or “equal” assist, or “scorer” assist. And the arguments, under certain assumptions, are all valid.

But to pull a page out of Dean Oliver’s book: “Two points is two points is two points.” And by definition, since this is an assist, credit needs to be split judiciously. Sorry zero assist guys…

In this example, we see a standard drive and dump that Steve Nash is well known for.

Here, Nash pulls the defense by driving through the lane. With the double team collapsing on him mid-lane, Amar’e Stoudemire pivots off his helping defender, taking a difficult pass for an uncontested dunk.

This is the style of play that has made Nash such a valuable player to teams and it’s easy to admit that most of the assist credit belongs to Nash. However, Stoudemire deserves some credit too for making himself available to Nash and allowing his defender to pull off him. But the question is… how much credit?

And to answer that, we can propose a probabilistic argument.

For many years running, the argument I have always made when crediting assists (or passing in general) is to credit the passer more whenever they execute a pass that increases the chances of scoring for a team. The argument is as follows: If a passer passes from a lower probability of scoring to a higher probability of scoring, then the passer has found a “more open” scorer. If a passer passes from a higher probability of scoring to a lower probability of scoring, then the passer has either made a bad pass or is looking for their teammate to bail them out of a situation (if an assist occurs). Furthermore, if the probability of scoring does not change, such as a meaningless touch pass between two players on the perimeter, then both players are interacting with equal responsibility.

The argument all comes down to the fundamental concept of blame.

Therefore, the problem of crediting assists merely turns into an exercise of computing the probability of scoring; yet another non-trivial task. Fortunately, there are several resources for developing such a probability model.

So for the sake of argument, we select one such model and jump into analyzing the probabilistic argument of crediting assists.

For the sake of argument, let us consider a pair of binary variables. The first binary variable is whether a potential assist occurs. The secondary variable is whether the field goal is made. This means that there are four outcomes when it comes to making a decision to pass for potential assist:

- Pass leads to a score.
- Pass leads to a miss.
- Kept leads to a score.
- Kept leads to a miss.

Taking these binary variables, we should be able to form a contingency table outlining potential assists and their relationship to scoring. The difficulty here is that we cannot simply count made and missed FG’s on non-potential assist situations. Fortunately through leveraging a probability model we do get to estimate the probability of scoring from where the pass was made, if such a pass did not exist.

That is, we key off the potential assist locations of the passer and the shooter. Using the probabilistic model, if we say the pass was not made, how likely will the team score? Similarly, if the pass was made (which it is), how likely will the team score? In this setting, we don’t count fictional makes and misses; but rather use the estimated and therefore known probabilistic quantities.

In this setting, we can think of a potential assist as a treatment being applied to a receiver’s itch to shoot. Since the potential assist comes from the passer, the probability of making a field goal becomes the dependent variable.

So let’s go back to that Rondo assist. On the play, Rondo obtains the rebound and has a clear path to the basket. He drives one-on-none and then pulls up, only to dump the pass to a teammate. Given the locations of the players, who the players are, and the state of the game, using a basic logistic regression method for estimating likelihood of scoring, Rondo has a .9342 chance of scoring. After the pass, Ray Allen has a clear path to the basket for an easy dunk with a .9736 chance of scoring. While the pass increases the odds of scoring, the impact of the assist is minimal. In the counting stats it simply reads as Rondo 1 assist, Allen 2 points.

So how much credit does Rondo deserve for this? Let’s reconvene on the binary variables:

In this setting, we can consider the **relative risk**; which looks at the impact a potential assist has on a made field goal in a particular situation. In this case, the relative risk is given by:

Computing it for the Rondo assist, we have a **relative risk of 1.0422**. So how do we interpret this value?

If the relative risk is one, then this shows that the “exposure” of a potential assist does not impact the probability of scoring. As the relative risk increases, we start to see that “exposure” to a potential assist actually **increases scoring** and therefore the passer has accurately identified a passing lane that leads to a better opportunity to score. This indicates that the passer not only identified the improved situation, but also reacted accordingly.

Analogously, as the relative risk decreases, we identify situations where the scorer effectively “bails out” the passer as the pass went from a higher opportunity of scoring to a worse scenario. In this situation, the scorer deserves more credit as they are able to convert a basket despite the incorrect decision made by the passer.

Using this construct, we can merely designate credit through the weighting of the relative risk. In the Rondo assist case, the relative risk is 1.0422. Assuming that no impact is one, we baseline the scorer with a value of 1 and therefore assign credit as

In this case, Rondo is credited with 0.5103 of an assist, and Ray Allen is credited with 0.4897 of an assist.

In the situation where Steve Nash dished to Stoudemire for a score, the probability that Nash would score under the double team was estimated to be 0.4273. While the uncontested dunk for Stoudemire was estimated to be 0.8842. For this play, the **relative risk is 2.0693**. Using the splitting credit computation, we suggest that Nash deserves 0.6742 of an assist; while Stoudemire earns 0.3258 of an assist.

As we can see, no longer are we being pushed towards a “fifty-fifty” split of credit and we are finding that credit can be obtained based on the relative degree of difficulty of scoring a basket through a probabilistic argument.

Suppose you feel we are being too stingy for giving Nash credit on that assist. That’s not a problem. We can introduce an amount of flexibility through the use of a **sigmoid** function. Consider the relative risk, **r**. As this is the variable for determining credit, the larger it is, the more credit is given to the passer. Therefore, the sigmoid function can “push” the value out a little further through the function

So let’s test this out. The value **beta** is the flexibility factor. If beta is 10. Then Steve Nash’s assist credit goes from 0.6742 to 0.999977. Similarly, if beta is 2, Nash’s assist credit becomes 0.8946.

Similarly in the Rondo setting, for **b****eta = 10** we have .6040 credit. For **beta = 2**, credit becomes 0.5211. So we see how this sigmoid function stretches higher probability changes to larger crediting of passers. The same is true for scorers if values of beta are below one. Hence the flexibility.

We should note, however, the sigmoid function is merely a transformation on the relative risk. As the assist credit formula above is the **exact same computation** except using the transformation

Now that we are armed with a method for crediting assists, we can leverage any probability model of our choosing and start revamping quantities such as **points produced** or even adjust **assist leaders**‘ **totals** to reflect the difficulty of assists. The former helps us start to understand how much a player actually produces without having to require a 50/50 split. The latter begins to deflate stat-padding situations.

That said, leveraging a data set obtained from a Western Conference team in 2015; we see this subtle change in assist totals:

Using the raw (beta = 1) adjustment, we see a bit of a shuffle. In fact, Deron Williams jumps up to nab the 15th spot after adjustment.

However the adjustment is applied, we can now start developing models to help determine credit for assists. And one such method can leverage the relative risk of a potential assist treatment.

]]>

In this post, we take a cursory look at streaming computations and perform a simple application to **scheduling in the NBA** in an effort to identify teams who have the most **compact schedules**; meaning they have the **least amount of rest between Game 1 and Game 82**.

**Note: **This is discussion about real data science problems. If you’re only here for the basketball analysis skip to the next section.

A common (and sometimes forgotten!) problem in data science is the ability to **compute** statistics. Recall that the definition of a statistic is merely a **function of the data**. What we mean to compute statistics is the ability perform **computations **that the computer is able to **store in memory**. Take for instance a 100 gigabit per second stream of data with the charge of calculating a mean.

If we can compute only 1 gigabit per second stream, we lose **99% of our data**. If we’d like to have a response in **real time**, we’d be forced to perform **sublinear computations**.

There is no way we can calculate the mean of the data. Suppose we get the mean in one calculation through some fairy tale manner, we are still requiring **100 seconds **to compute one second of data. If we need to compute an entire hour’s worth of data, we are stuck waiting for an **extra 356,400 seconds** for the computation to be complete. That’s and extra **four days and three hours**. Sorry, MapReduce won’t help you here either (it’s slower).

A sublinear algorithm is akin to **random sampling. **In this case, we sample data using some random number generator, selecting an adequate amount of data and computing the mean. The idea is straightforward, however several checks need to be performed to ensure the sample is appropriate enough to represent the global mean. We can do that through the process of **data forking** and working on multiple streams at the expense of requiring less data to perform computations.

Now if our data stream is only 1 gigabit per second, we are able to compute the true mean at real time, but only for **order 1 **calculations. This means we can only perform “one” action to the data as each data point comes in. Recall that the mean is computed by

From the formula above, the time to compute the mean is actually **order n**. This means we require all **n** data points to compute the mean. From this viewpoint, we are in trouble. However, computation of the mean is probably the most well-known streaming computation out there. So there’s hope!

In the streaming paradigm, we change the method of computation to be a **forked stream**. What this means is that we can construct a **window **of data by building **n** streams of data. Here, all we need to do is perform a series of three calculations, which has nothing to do with the size of the data stream. The only worry here is memory allocation; which is already assumed to be OK from our first sentence.

Let’s rewrite the mean calculation.

To perform this computation, we simply hold the sum and an number of data points in memory. We can start with an **initial fill** of all zeros. This means the first **n-1** means are **biased**. But this is alright as we only cared about the mean of **n** points at a given time.

As we fork the stream for **n** data points, for the **n+1** data point, we subtract the first stream, containing data point **x_1**, replace the stream element with **x_(n+1)**, and reassign the stream orders. By doing this, we perform **three (four)**** calculations on the data: **subtract the oldest data point, add the newest data point, and divide by the sample size. The (four) comment is performed when the **initial fill washes out**. The update equation is **n = n + 1** until the initial fill is removed.

So let’s apply this methodology to a simple NBA problem: **scheduling.**

Opening day for the 2018 NBA season is on **October 17th** and proceeds for the following **177 days**, concluding on **April 11th**. Over the course of these 177 days, a series of 1230 games are needed to be scheduled. The games are distributed to ensure that all 30 NBA teams have 82 total games with 41 games on the road and 41 games at home.

Of the 82 games, each team must play their own division **four times** for 16 games. They also must play every team in their opposing conference **two times** for 30 games. The remaining 36 games are distributed across the remaining 10 teams; resulting in six teams being played **four times** and the other four teams **three times**.

Furthermore, the NBA has a required set of nine days off:

- November 23rd: Thanksgiving
- December 24th: Christmas Eve
- February 16th – 21st: All-Star Break
- April 2nd: NCAA National Championship

As all teams need to be mixed, with no other days off for the league, and in such a way that all teams get an **acceptable amount of rest**. The NBA does a phenomenal job in scheduling, despite the acceptable amount of rest being well-defined across the years.

For the 2018 season, we can walk through the entire 1230 game schedule and construct a 30×177 binary matrix representing the entire schedule. Using the **imshow** command, we can view the matrix where **yellow** represents the **game played** and **black** represents the **day off**.

We immediately see the days off in the league as they are black columns. By running across the rows, we can start to measure the **compactness **of the schedule. A simple, naive, measure would be to simply count the number of days off. However, every team plays 82 games in 177 days. This means every team gets 95 days “off.” Therefore counting days off just doesn’t cut it.

Instead, we become interested in **compactness **of the schedule. Compactness means that the schedule has **accumulation points**. In this sense, an accumulation point is finding days where there are **many games within a neighborhood** of that day. For instance, a team **might **have two games before a day and two games after a day; seen as a **4-in-5** set of games. That day is an accumulation point.

We can then start to map accumulation points to **high volume sections** of the schedule. That is, we hunt for **short burst** games where 66-75% (or more) of the days are played. We will also focus the course of **two weeks intervals**. This allows us to **nest** bursts in the schedule.

Nesting is a situation where certain scenarios in the schedule **cannot happen** unless other scenarios occur. For instance, a **back-to-back** series of games is a high-volume set of games. However, a **3-in-4** burst of games **must require a back-to-back **to occur.

Similarly, a **4-in-6** burst of games **must require a back-to-back **and a **3-in-4 **to occur. Let’s illustrate these using **binary vectors**. Suppose that we have a three game set. Using a **one** to indicate a game is played, and **zero** to indicate a game is not played, then all possible 2-in-3 bursts are **011, 101,** and** 110. **This means two of three possibilities can result in back-to-back sets.

But for 3-in-4, there’s **always a back-to-back:**

- 0111 – Two Back-to-Back’s and a Three-In-A-Row!
- 1011 – Back-to-Back
- 1101 – Back-to-Back
- 1110 – Two Back-to-Back’s and a Three-In-A-Row!

Similarly, for 4-in-6, there’s **almost always a 3-in-4:**

- 001111 – Three Back-to-Back’s, Two 3-in-3, One 3-in-4, one 4-in-4, and one 4-in-5
- 010111 – Two Back-to-Back’s, one 3-in-3, two 3-in-4, and one 4-in-5
- 011011 – Two Back-to-Back’s, two 3-in-4, and one 4-in-5
- 011101 – Two Back-to-Back’s, a 3-in-3, three 3-in-4, and one 4-in-5
- 011110 – Three Back-to-Back’s, two 3-in-3, two 3-in-4, one 4-in-4, and two 4-in-5
- 100111 – Two Back-to-Back’s, one 3-in-3, one 3-in-4
- 101011 – One Back-to-Back, one 3-in-4
- 101101 – One Back-to-Back, one 3-in-4
- 101110 – Two Back-to-Back, one 3-in-3, two 3-in-4, and one 4-in-5
- 110011 – Two Back-to-Back’s…
**no 3-in-4** - 110101 – One Back-to-Back, one 3-in-4
- 110110 – Two Back-to-Back’s, two 3-in-4, and a 4-in-5
- 111001 – Two Back-to-Back’s, one 3-in-3, and a 3-in-4
- 111010 – Two Back-to-Back’s, one 3-in-3, two 3-in-4, and a 4-in-5
- 111100 – Three Back-to-Back’s, two 3-in-3, one 3-in-4, one 4-in-4, and a 4-in-5

That’s 15 total options. There is one exception to the 3-in-4 option. That’s the **110011** burst. In this case **there must be LOTS of rest days to avoid a 3-in-4**. In fact, in order for a 3-in-4 to not exist is to require there to be a **0011001100**; which is **four games in 10 days**. Ridiculous. There’s effectively a 3-in-4.

Starting in the 2018 season, the NBA announced that 4-in-5 games would be eliminated from the schedule after a series of studies had been produced on the effect of travel, lack of sleep, and game density (compactness). This resulted in a **red alert **system for games; with a **Charlotte Hornets **game being cited as one of the worst offenders: a 4-in-5 with a back-to-back to finish the 4-in-5 being a Memphis-Charlotte transfer; resulting in “three hours of sleep.” The Hornets were dispatched by the **Detroit Pistons** with ease: 112-89.

So let’s analyze the 2018 NBA season!

To perform this analysis, we take the entire schedule and walk through every scenario of **compactness**. We look for all back-to-back games, all 3-in-4, 4-in-6, 5-in-7, and so on. We can do this by rolling through the schedule, or we can perform **streaming computations**!

To perform the streaming computation, we first construct a **window** of games. Here, we are interested only in 12 day bursts of windows. Therefore, we build an initial fill of all zeros and walk through the process of the first 12 days of the season. This is **October 17th through October 28th. **

We then compute a fixed series of computations: add the first two elements of the binary representation. If this is two, we have a **back-to-back**. Similarly, we add the first four elements and if this is more than three, we have a **3-in-4**. We can do this, as there are no 3-in-3’s and 4-in-4’s. We perform this computation similarly for all other high volume bursts through the 12 games.

Once we perform this computation, we add in the new day. Remember in the streaming computation, we just **pop** off the oldest day and add in the new day at the end. Since the data is small scale, we can hold the windows in a 30×12 matrix. This can be performed in Python using the **numpy.roll** function and a wipe.

As we walk through the schedule, the window slides across the binary matrix of games and pushes the oldest games to the front of the matrix, where the fixed burst computations are performed. Therefore, we don’t have to hunt any games!

The only catch is the end of the season, where we can either place a **terminal fill** of zeros, or sweep across the final games. I chose the latter.

By taking in a schedule data file, we can walk through each line, strip the teams, and populate the games window matrix (**games**) and the season matrix (**gameMat**). We only populate **gameMat** in order to display the matrix image above.

# Walk through the scores file. Each line will consist of: # DATE: Winning Team Score Losing Team Score for line in lines: # Strip to ensure no white space messes with the key structure of the team dictionary. winner = line[12:30].strip() loser = line[41:60].strip() day = line[8:10].strip() if day == currentDate: if gameNumber < 12: games[int(teams[winner])][int(gameNumber)] = 1. games[int(teams[loser])][int(gameNumber)] = 1. gameMat[int(teams[winner])][int(gameNumber)] = 1. gameMat[int(teams[loser])][int(gameNumber)] = 1. else: games[int(teams[winner])][11] = 1. games[int(teams[loser])][11] = 1. gameMat[int(teams[winner])][int(gameNumber)] = 1. gameMat[int(teams[loser])][int(gameNumber)] = 1. else: if line[11:15] == 'NONE': print 'NO GAMES TODAY!', line[0:10] # New day shifts games. Let's get our counts before we run away! for i in range(30): specials = CountGames(games[i],i,specials) # Work on shifting games; as it is a new day! games = np.roll(games,-1,axis=1) # Must wipe out the last element of every row for i in range(30): games[int(i)][11] = 0. gameNumber += 1. continue # New Day! gameNumber += 1. currentDate = day if gameNumber < 12: games[int(teams[winner])][int(gameNumber)] = 1. games[int(teams[loser])][int(gameNumber)] = 1. gameMat[int(teams[winner])][int(gameNumber)] = 1. gameMat[int(teams[loser])][int(gameNumber)] = 1. else: # New day shifts games. Let's get our counts before we run away! for i in range(30): specials = CountGames(games[i],i,specials) # Work on shifting games; as it is a new day! games = np.roll(games,-1,axis=1) # Must wipe out the last element of every row for i in range(30): games[int(i)][11] = 0. # Now add the new guy! games[int(teams[winner])][11] = 1. games[int(teams[loser])][11] = 1. gameMat[int(teams[winner])][int(gameNumber)] = 1. gameMat[int(teams[loser])][int(gameNumber)] = 1.

What we see in this code block is that we apply the roll function and then wipe the new column of zeros in order to populate new data. **This is a cheat** as the data is small. If we performed a purely streaming computation, we hold the row sums for each burst type; search the new teams playing on the new day and add/subtract accordingly. Despite this, you can see how the streaming window interacts.

Performing the above computations, we can then look at a **compactness measure**. In this case, we perform a simple calculation of counting **high volume days**, weighted by their volume. In this case, we add all **back-to-back** games to **75% of 3-in-4 **games, **66.6% of 4-in-6 **games, to **71.4% of 5-in-7 **games, and so on. The higher the number, the more dense games are.

In total there were **425 instances of Back-to-Back games**, with each team averaging a total of **14** back-to-back games. The **Memphis Grizzlies **and **Utah Jazz** are the worst offenders with **16 Back-To-Back games**. Compare this to the **Charlotte Hornets, Cleveland Cavaliers, Detroit Pistons, Golden State Warriors, Los Angeles Lakers, Miami Heat, **and **New Orleans Pelicans**, who all have **13 Back-To-Back** games; we find that the discrepancy isn’t too high. This is arguable dependent on travel time/distance between games.

Three-In-Four games are fairly common as well. In this case, we find that each NBA team averages **18.9** three-in-four games during the season. As there were a total of **567** of these instances, we found that there was a much larger discrepancy among teams when compared to **Back-To-Back** games. For the 2018 season, the **Memphis Grizzlies **have **23 3-in-4 bursts**, while the **Cleveland Cavaliers have 10. **The next lowest total? The **Denver Nuggets ****have 15**.

Finally, the NBA season witness **zero 4-in-5 bursts!**

For 4-in-6 games, we see **611 instances** throughout the season. However, recall from the breakdown above, a sequence of **101101 **results in a pair of **3-in-4 bursts**. This is similar for **4-in-6 **situations when we expand the window. So don’t read this as 611 **unique** scenarios.

Despite this, teams witness **20.4** **4-in-6 bursts** per season. The worst offender is the **Charlotte Hornets with 27**. The team with the least? You guessed is… the **Cleveland Cavaliers with 14**. The **Los Angeles Lakers **come in second lowest with **15. **

The NBA attempted to reduce the number of 5-in-7 games this season, but were unable to eliminate them. Under this scenario, we find there are **35 total instances** where the **Minnesota Timberwolves **and the **San Antonio Spurs** take the brunt with three of these situations each.

There are eight teams that observe this burst **two times** during the season: **Atlanta, Boston, Chicago, Orlando, Philadelphia, Phoenix, Sacramento, **and **Toronto****. **There are thirteen teams with one observance. However, there are **seven teams** that escape the wrath of 5-in-7 bursts. These teams are **Cleveland, Golden State, Indiana, Los Angeles Lakers, New Orleans, New York, **and **Memphis**.

Fortunately, there are no 6-in-8 games this season.

Six-In-Nine games start to become fleeting, as there are **87 instances** of these bursts; each team averaging **2.9 6-in-9** bursts. Again, we find a large discrepancy across teams. The **Boston Celtics** appear in **7 games that are the tail end of a 6-in-9 burst.** **Phialdelphia **(6), **Orlando** (5), and **Minnesota **(5) take the brunt with a high number of these scenarios.

There are, however, two teams that avoid the 6-in-9 run. **What this means is they ALWAYS **get **FOUR days rest every 9 days**. These two fortunate teams? **Cleveland **and **New York. **

The final scenario we look at are 8-in-12 games. This is because there are **zero instances **of **7-in-9, 8-in-11, **and **9-in-12** bursts. In fact, there are **only three instances of 8-in-12 bursts**. The poor teams who suffer these bursts are the **Boston Celtics, Phoenix Suns, **and **Chicago Bulls**.

By computing the compactness score over this sliding window, we find that the **Philadelphia 76ers** (51.929),** Memphis Grizzlies** (51.917)**, **and **Orlando Magic** (51.595) suffer the most from the schedule. In fact, teams with compactness scores over 50 have dense schedules; with the least amount of rest. This includes the top three above as well as the **Boston Celtics **(50.512), **Phoenix Suns **(50.179), **Charlotte Hornets **(50.131), and the **Minnesota Timberwolves **(50.060).

There is a significant drop off after 50 (to 47). However, there is an exceptional outlier: **Cleveland **(29.833). This means that Cleveland’s schedule is roughly twice as spread out compared to **Philadelphia, Memphis, **and **Orlando**.

The entire table can be viewed here:

Looking at the distribution of scores, we find that Cleveland does indeed have a significant advantage in schedule. Denver finds itself in a similar situation, and this added rest along with their home court advantage may potentially be giving Denver a slight boost in the NBA standings.

Comparing to the previous season, we find that there are only 170 total days between opening day and the final day of the season. The 2018 season not only witnessed less 5-in-7 bursts and elimination of 4-in-5 bursts; but also obtained one extra week of play. Computing the binary matrix, we find that the is also no **NCAA National Game** off.

We find that the distribution of compactness is **much higher** in 2017 than in 2018.

So much higher that the number of Back-To-Back games totaled 486 (425 in 2018), 3-in-4 bursts totaled 714 (567 in 2018) and 4-in-6 bursts totaled 855 (611 in 2018). Similarly, there were **23 total 4-in-5 games in the 2017 season**. Also, there were dreaded **7-in-10 bursts** for teams in the 2017 NBA season; another non-existent burst in the 2018 season. The **Los Angeles Clippers**, **Philadelphia 76ers**, and **Orlando Magic** all experienced these during the season. And as a note, each of these teams suffered significant injuries during the season.

Continuing this path, the number of 8-in-12 games dropped from 22 (2017) to 3 (2018) while the number of 5-in-7 games dropped from 93 (2017) to 35 (2018).

For the 2017 season, we see almost every team is above the 50 score. The exceptions are **Dallas** and **Brooklyn**. Every team, however, dropped in compactness; indicating that every team technically obtains more rest this season than in the previous season. The lone real exception is the **Minnesota Timberwolves**, who dropped from 50.679 to 50.060. This may become a problem as the Timberwolves are notorious for not resting their players.

As we have seen the NBA help increase rest for the NBA season, we still find kinks in the scheduling format as some teams are generously given days off while others still find themselves in 5-in-7 ruts. So how would you improve scheduling the season? Note that we didn’t even factor in traveling and time-zone changes. This increases the problem with scheduling and rest; making the job of an NBA scheduler an unenviable one.

]]>