Over the last two years, the Warriors and Cavaliers have run the best offenses in the NBA. Stephen Curry and LeBron James are the engines -- but by no means the only parts -- that made these teams soar.

NBA player-tracking data enables us to take a look behind the curtain by allowing a "machine" to learn and understand sports at the level of a coach. Machine learning is a set of tools that allows computers to recognize patterns in very large data sets. Here, that means defining moves like dribble-handoffs and back screens. Then these tools allow coaches to easily find and study those plays.

One thing the machine understands is quantified Shooter Impact (qSI) -- how much better a player is compared to an average NBA player at making the shots he takes. It reflects the reality we see with our eyes. Editor's Picks Trade, free-agent forecasts for every NBA team

2016 NBA Finals: Complete coverage 1 Related

Over the past two years, Curry is the most impactful overall shooter (plus-12.1), the most impactful 3-point shooter (plus-18.0) and the most impactful 3-point shooter off the dribble (plus-17.5). Similarly, LeBron is ridiculously good in the paint (plus-8.3) and even better in the paint in transition (plus-14.0). But we know this.

What we may not realize is how much Steve Kerr and Tyronn Lue do to let their stars -- and their teams -- shine.

We'll give you a taste of this eagle-eye capability here, using the same software that informs more than half the teams in the league, including both the Warriors and Cavaliers.

The Golden State minefield

Curry is amazing off the dribble. He is the top pick-and-roll ball handler in the league. What is often overlooked, however, is the Warriors' creative ability to use off-ball screens to free up their dangerous shooters. Here's an example:

Curry -- guarded by Westbrook -- sets an off-ball screen on Serge Ibaka to free up Harrison Barnes, who drags Westbrook with him into the paint. Roberson is sticking to Klay. Andrew Bogut sets an off-ball screen on both Ibaka and Steven Adams, freeing Curry up for a wide-open 3.

This play is no isolated incident. This "Pin-In" screen is a basic basketball action that the Warriors have used with regularity to let Steph be Steph. Here's a sample of the many, many times this has happened this year:

This is just the start of how the Warriors create space for Curry. If you overplay or jump on top of the screen to run Curry off the 3-point line, he can reverse direction and run you off multiple screens, with the ball handler patiently waiting for him to find a spot on the opposite 3-point line. This play is often called "loop."

Even if a team successfully navigates the minefield of screens lined up for Curry, the Warriors can double the trouble by adding Thompson to the off-ball equation. Steph and Klay work together -- both moving around off-ball screens and screening for each other in an improvisational probe -- to pick their moment and method to exploit the defense.

While fans are often watching the ball, NBA coaches (and the machines that think like them) know that so much more of the game happens away from it. The Warriors' creative use of off-ball action is an incredibly effective part of their offense.

Curry and Thompson Play type Rank Guard-guard off-ball screen total 1 Guard-guard off-ball screen efficiency 1 Moving catch-and-shoot FGM* (Thompson) 1 Moving catch-and-shoot FGM* (Curry) 3 Field-goals made

Tyronn Lue uses LeBron James' playmaking skills to create offense from the elbow. David Liam Kyle/Getty Images

Power of LeBron at the elbow

With Kyrie Irving and Kevin Love healthy heading into the Finals, James had been carrying less of the shooting load this postseason. He was taking roughly one in five shots this year compared to one in three last year.

However, just the threat of LeBron is terrifying for defenses. While we know how great James is in the paint, we may not catch how effective the Cavs are with James at the elbow.

In this video segment, LeBron gets the ball at the elbow. Matthew Dellavedova comes to set a back screen for Richard Jefferson and takes a handoff from James. Cory Joseph trails Dellavedova, having to protect against the Jefferson threat. Patrick Patterson has to leave James (danger!) to protect against the Dellavedova threat.

James rolls, forcing Bismack Biyombo to pick between James in the paint and another threat, Channing Frye, who is moving away from the paint for a wide-open 3. Starting James at the elbow forces the defense to pick between multiple threats. This play is no isolated incident.

LeBron is an elite screener. He was the second-most efficient screener in the NBA, behind only Draymond Green, who, as you may have heard, has a couple of elite teammates who help him out. When James rolls to the paint, where he attempted the most shots of any non-center this season, he's even more dangerous. These examples show why:

So what happens when teams help on James' rolls to the rim? Remember Biyombo chasing Frye instead of James? Yeah, Frye is the top 3-point shooter this playoffs with an effective field-goal percentage (eFG) of 79. That's better than any action near the rim. Here's what happens when James gets attention in the paint:

James is dangerous even before he gets into the paint. Go back to the first example, with the back screen Dellavedova set for Jefferson. What worried Joseph? This is what LeBron can do if you don't pay attention:

While James might not be taking as many shots, we see how LeBron at the elbow powers the Cavs by not just rolling to the rim, but also passing and simply using the threat of his movement to open things up for his teammates.

LeBron James Play type Rank Paint FGA (non-center)* 1 Paint EFG (non-center) 1 Pick-and-roll screener efficiency 2 Passes to the paint (non-guard) 3 Field-goal attempts

The Warriors and Cavaliers leverage and maximize the impact of their stars in ways that are often invisible to fans but obvious to coaches.

Machine understanding of sports doesn't need to tell coaches what is happening -- NBA coaches are ridiculously good at that. Still, watching every second of every game with a coach's eye can help them figure out how to react.

But that's a story for another day.

Rajiv Maheswaran is CEO and Mike D'Auria is Director of Business Development of Second Spectrum, which provides optical-tracking data and analytics to teams in the NBA.