Accessible Unlicensed Requires Authentication Published by De Gruyter February 28, 2019

Automatic event detection in basketball using HMM with energy based defensive assignment

Suraj Keshri, Min-hwan Oh, Sheng Zhang and Garud Iyengar


We propose a unsupervised learning framework for automatically labeling events in a basketball game. Our framework uses the the optical player tracking data in the NBA. We first learn the time series of defensive assignments using a novel player and location dependent attraction based model which uses hidden Markov models (HMMs), Gaussian processes, and a “bond breaking” model for changes in defensive assignments. Next, we use the learned defensive assignments as an input to a set of HMMs that automatically detect events such as ball screens, drives and post-ups. We show that our models provide significant improvements over existing benchmarks both on defensive assignments and event detection.

A Appendix

A.1 Derivation of posterior distribution of Γ

The data likelihood is


where Wk=j=1NpkZkjZkjT and Vk=j=1NpkZkjDkj.

Note that we no longer write the likelihood with respect to time. Only thing that time tells us is the assignment of defensive players to offensive players. Once we have estimated the sequence I, then we no longer have time dependence in our data. From the estimation perspective, it is more efficient to write the likelihood in terms of events.

Let V=[V1,,VK] and Γp=[Γp1,,ΓpK]. Also, we define W to be a block diagonal matrix with each block being Wk for k = 1, …, K. Then, we can express the data likelihood as the following:


Using the GP prior on Γp mentioned above


we can compute the posterior distribution


where μ=(WσD2+𝒦1)1(VσD2+𝒦1μΓ) and Σ=(WσD2+𝒦1)1. Hence, the posterior distribution is

ΓpD,I,σD2N(μ,Σ)with ΓpkT1=1.

A.2 Sampling of multivariate gaussian distribution with linear constraints

We want to simulate zN(μ,Σ) conditioned on Fz = v. Without loss of generality, assume that Fm×n has full row rank. Define:

  1. P=F(FF)1F: projection onto ={Fv:vm}

  2. P=IP: projection onto the linear space orthogonal to

Then, the distribution of z conditioned on Fz = v is given by


where v¯=F(FF)1v.

A.3 Convergences

Figure 10: Convergence Of data log-likelihood in defense assignment modeling.

Figure 10:

Convergence Of data log-likelihood in defense assignment modeling.

Figure 11: Convergence Of BFGS algorithm for defense transition modeling.

Figure 11:

Convergence Of BFGS algorithm for defense transition modeling.


Bishop, C. M. 2006. Pattern Recognition and Machine Learning (information science and statistics). Secaucus, NJ, USA: Springer-Verlag New York Inc.Search in Google Scholar

Cervone, D., A. D’Amour, L. Bornn, and K. Goldsberry. 2016. “A Multiresolution Stochastic Process Model for Predicting Basketball Possession Outcomes.” Journal of the American Statistical Association 111(514):585–599.Search in Google Scholar

Franks, A., A. Miller, L. Bornn, and K. Goldsberry. 2015. “Characterizing the Spatial Structure of Defensive Skill in Professional Basketball.” The Annals of Applied Statistics 9(1):94–121.Search in Google Scholar

Hansen, L. P. 1982. “Large Sample Properties of Generalized Method of Moments Estimators.” Econometrica: Journal of the Econometric Society 50:1029–1054.Search in Google Scholar

Glossary of basketball terms. n.d. In Wikipedia. Retrieved May 12, 2017. .Search in Google Scholar

McQueen, A., J. Wiens, and J. Guttag. 2014. “Automatically Recognizing on-Ball Screens.” In 2014 MIT Sloan Sports Analytics Conference. Boston, MA, USA.Search in Google Scholar

National Basketball Association. n.d. A Glossary of NBA Terms. Retrieved May 12, 2017. .Search in Google Scholar

Oh, M.-H., S. Keshri, and G. Iyengar. 2015. “Graphical Model for Baskeball Match Simulation.” In Proceedings of the 2015 MIT Sloan Sports Analytics Conference, vol. 2728. Boston, MA, USA.Search in Google Scholar

Pelton, K. 2014. “Explaining Gravity in Basketball.” ESPN, Oct 22, 2014. .Search in Google Scholar

Rasmussen, Carl E., and C. K. Williams. 2006. Gaussian processes for machine learning. Vol. 1. Cambridge: MIT press.Search in Google Scholar

Viterbi, A. 1967. “Error bounds for convolutional codes and an asymptotically optimum decoding algorithm.” IEEE Transactions on Information Theory 13(2):260–269.Search in Google Scholar

Wang, K. C., and R. Zemel. 2016. “Classifying NBA Offensive Plays Using Neural Networks.” In Proceedings of MIT Sloan Sports Analytics Conference. Boston, MA, USASearch in Google Scholar

Wright, S. J., and J. Nocedal. 1999. “Numerical Optimization.” Springer Science 35(67–68):7.Search in Google Scholar

Published Online: 2019-02-28
Published in Print: 2019-06-26

©2019 Walter de Gruyter GmbH, Berlin/Boston