sixseconds: expected possession value from NBA tracking

A transformer that reads NBA SportVU tracking (25 frames a second: all 10 players and the ball, with 4 s of history) and predicts, at every moment, how many points the team with the ball will score before it loses it: expected possession value (EPV). The same heads also predict how and when the possession ends, and who scores the next basket in which 2 s window over the next 24 s.

Trained on 505 games of the 2015-16 season (2.8M moments, 97,000 possessions). Validation is 63 later games (4-13 Jan 2016). The test set has not been used yet.

Files

folder model sees parameters
runs/poss-tf-L6-e10-s{0,1,2}/ transformer, 6 layers, d_model 128, 4 heads clocks, score, ball, 10 players 1,271,511
runs/poss-ball-e10-s{0,1,2}/ ball MLP (baseline) clocks, score, ball 161,879
runs/poss-context-e10-s{0,1,2}/ context MLP (baseline) clocks, score 155,735

Three seeds of each, trained for 10 epochs on one B300. Each folder has model.safetensors (the state dict of the last epoch, which was the best), config.json (the arguments build_model needs), metrics.json, history.csv, val_per_game.csv and calibration.png. The root model.safetensors.index.json points at the transformer's seed 0, so the parameter count shown here is that one model's.

Results (validation, mean of 3 seeds)

model points log loss skill vs base rates EPV Rยฒ calibration error knows who has the ball
base rates 1.0379 - - - -
context MLP 1.0353 0.25% 0.5% 0.024 pts 54.2%
ball MLP 1.0096 2.73% 2.2% 0.018 pts 94.8%
transformer, 6 layers 0.9963 4.00% 3.2% 0.023 pts 96.5%

Players vs ball, per-sample log loss: -0.0132, 95% interval -0.0145 to -0.0121 from a bootstrap over the 63 games. Expected points are calibrated by decile: the lowest tenth of moments scored 0.56 points (predicted 0.54), the top tenth 1.29 (predicted 1.30).

Load

From a checkout of the futml repository:

import json
from huggingface_hub import snapshot_download
from safetensors.torch import load_file
from futml.config import LAGS_S
from futml.model import build_model

run = snapshot_download("otterbox901/sixseconds") + "/runs/poss-tf-L6-e10-s0"
cfg = json.load(open(f"{run}/config.json"))
model = build_model(cfg["model"], len(LAGS_S), cfg["n_layers"], cfg["d_model"], cfg["n_heads"],
                    cfg["dropout"], poss_heads=cfg["poss_heads"])
model.load_state_dict(load_file(f"{run}/model.safetensors"))
model.eval()

The weights were trained from commit 44f2c5d plus uncommitted changes (git_dirty in each config.json), so the loader needs that working tree's futml.model.

Data

NBA SportVU 2015-16 (Oct 2015 - Jan 2016), mirrored at sealneaward/nba-movement-data, originally posted publicly by the NBA; play-by-play from the same mirror. The data is for research and portfolio use, not redistribution. No data is included here.

Downloads last month

-

Downloads are not tracked for this model. How to track
Safetensors
Model size
1.27M params
Tensor type
F32
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support