AWS for M&E Blog

Opportunity Analysis gives new insight into the quality of a shot

This brand new analytic, part of National Hockey League (NHL) EDGE IQ powered by Amazon Web Services (AWS), uses a novel machine learning (ML) model that analyzes millions of historical and real-time data points to show fans how difficult a shot was at the moment of release, calculated just seconds after the play. 

Imagine you’re watching your favorite hockey team battle it out against a divisional rival. Nobody has scored yet. Suddenly, in the middle of a fierce battle, the rookie left wing steals the puck and turns the play in the other direction. Willing him to generate an opportunity to score, you’re ticking the boxes in your mind of what he needs to do to increase his chances of beating the goalie: shot location, puck movement, goalie positioning, traffic on the ice, and rush of the play. Whether you’re new to the sport or have been die-hard hockey fan your entire life, there’s never been a way to figure out for sure what will happen next. You hold your breath as every piece of the play falls into place. He shoots—he misses. What looked like a guaranteed goal was, somehow, not even close. Would a more experienced player have scored? Or was the shot deceptively impossible? If only there was some way to know.

Now, there is. The NHL has tapped Amazon Web Services (AWS) data scientists and machine learning engineers to launch a groundbreaking new analytic: Opportunity Analysis, part of NHL EDGE IQ powered by AWS. Using a powerfully comprehensive combination of historical and real-time data, the machine learning model describes how likely an in-game situation preceding a shot is to result in a successful goal, and explains how the various factors present in the in-game situation contributed to the predicted likelihood. For the first time ever, NHL fans, broadcasters, coaches, and teams have access to quantitative, predictive results in near real time.

If that sounds like an impressive feat of ML engineering, it is. Consider first the volume of data: over a decade of NHL seasons – each with 1200+ games broken down into fractions of a second, with each fraction of a second divided among a constellation of variables on the ice. Hundreds of data points are collected per second in each game using new NHL EDGE puck and player tracking data, which tracks inputs from sensors in players’ clothing as well as in the puck, and multiplied by the speed at which hockey games are played. It doesn’t take long to see how exponentially bigger the already daunting questions about mining data, determining key inputs, and then harnessing enough power to turn it into something meaningful are when you’re working with this much raw material.

So how does Opportunity Analysis actually work? The machine learning model starts by looking at the impact of dozens of factors present on the ice in real-time, such as shot location, puck movement, goalie positioning, traffic, and positioning of the puck. During each live game, NHL EDGE puck and player tracking data is streamed into the AWS Cloud, where it is combined with historical NHL statistical data and processed through the ML model to predict the likelihood of each shot attempt resulting in a goal, and how much each factor increased or decreased that probability. Effectively, the Opportunity Analysis machine learning model takes a highly detailed picture of the scenario surrounding a shot at the moment of release, compares it to thousands of others, and outputs a high, medium, or low rating with factor explanations based on how many times similar scenarios resulted in a successful shot.

To build the Opportunity Analysis model, data scientists and engineers at AWS collaborated closely with NHL analytics and hockey experts to evaluate influential factors that affect a given shot’s opportunity rating. At the moment the shooter seizes an opportunity to take a shot (at the release of the shot), the project team evaluated elements such as distance, locations, angles, speed, and how many times the puck changed directions or whether it crossed the middle of the ice before the shot was taken. It’s been critical to make sure these factors are accurate, as they form the backbone the ML model uses to make the prediction.

The working team from AWS and the NHL anchored the effort with expert understanding of the mechanics of a professional hockey game, and layered the AWS technology over the data with appropriate nuance. After training the Opportunity Analysis model and diligently working through multiple iterations, engineers were able to dial in the accuracy of the factor generation and get a highly accurate prediction. Amazon SageMaker was essential to the success and completion of this project thanks to its unique ability to scale up on demand (up to 32 CPU cores in this use case for data parsing and training of the model). AWS was able to quickly experiment with, iterate, and develop the model, and the ease of deploying and scaling SageMaker endpoints simplified the architecture for in-game live inference. Furthermore, use of the security controls of Amazon SageMaker enabling least privilege data access along with other AWS security services including AWS Identity and Access Management (AWS IAM), AWS CloudTrail, and AWS Key Management Service (AWS KMS). This level of security allowed the NHL to trust that its confidential and valuable data would be safe with AWS, and allowed for the development of the Opportunity Analysis model within the AWS Cloud infrastructure.

At current pace, the processing time for the model to return a result is attributed to the number of factors, variables, and data points used in the calculation, as well as the ability to explain the in-game situations underlying the prediction. With this, the impressiveness of the undertaking becomes very clear. Amazon Kinesis Data Streams and Amazon Kinesis Data Analytics applications were critical to making live, in-game predictions, enabling the system to perform opportunity analysis calculations for up to 16 live NHL games simultaneously, and the out-of-the-box multi-availability zone replication and automatic failover features of Kinesis contributed to the resilience of the real time application. Amazon EventBridge, AWS Lambda, Amazon CloudWatch Metrics, and Amazon SNS also formed part of the live in-game architecture to operate the infrastructure based on the NHL game schedule, and enabled a robust system to monitor system operations and alert operators during live games. Engineers continue to make progress reducing latency, which has exciting implications for the game experience on the ice and in the stands (or your living room). The possibilities for engineering at large are pretty exciting, too. What stories could the wide world of data tell if latency wasn’t a concern?

In the future, AWS and NHL are interested in furthering the work on Opportunity Analysis to explore a prescriptive model, one that would go beyond describing a specific shot opportunity to help assess strategy and determine whether or not a tactic that was used in a specific shot opportunity was effective. In the short term, the introduction of Opportunity Analysis is helping provide fans with a more detailed and nuanced story of why a player missed or scored, based on the assessment of the shot at the time of release. And while it might not soften the blow of a tough loss, it could help build a deeper sense of connection and understanding for fans who are looking to get more out of this incredible game.

To learn more about this new stat, go to aws.amazon.com/sports/nhl-opportunity-analysis/

Ari Entin

Ari Entin

Ari Entin is Head, Sports & Entertainment Marketing at AWS, based in Silicon Valley. He joined Amazon in 2021 from Facebook where he led AI communications and marketing. He has driven integrated media campaigns for top-tier consumer electronics, sports and entertainment, and technology companies for decades.