skills/tabular/play-direction-normalization/SKILL.md
Mirror spatial coordinates and angles so all plays face the same direction — removes left/right asymmetry from sports and spatial data
npx skillsauth add wenmin-wu/ds-skills tabular-play-direction-normalizationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
In spatial datasets (sports tracking, autonomous driving, robotics), events can occur in either direction. Normalize by flipping X-coordinates, orientation, and direction angles so all events face the same way. This halves the effective feature space and prevents models from learning spurious left/right patterns.
import numpy as np
def normalize_direction(df, direction_col='PlayDirection',
x_col='X', orient_col='Orientation',
dir_col='Dir', field_length=120.0):
"""Mirror coordinates so all plays go left-to-right."""
df = df.copy()
is_left = df[direction_col] == 'left'
# Flip X coordinate
df.loc[is_left, x_col] = field_length - df.loc[is_left, x_col]
# Flip Y coordinate (optional, for symmetry)
# df.loc[is_left, 'Y'] = field_width - df.loc[is_left, 'Y']
# Flip angles (0-360 degrees)
for col in [orient_col, dir_col]:
flipped = 360.0 - df.loc[is_left, col]
flipped[flipped == 360.0] = 0.0
df.loc[is_left, col] = flipped
return df
df = normalize_direction(tracking_data)
data-ai
Scaled Pinball Loss (SPL) metric for evaluating quantile forecasts, normalized by mean absolute successive differences of training data
data-ai
Walk backward through a time series and multiplicatively rescale segments when jumps exceed a fraction of the running mean to correct data collection anomalies
testing
Transform forecasting target to next/current ratio minus one so that optimizing MAE or squared error implicitly minimizes SMAPE
tools
Convert point forecasts to prediction intervals by scaling with logit-transformed quantile ratios passed through a Normal CDF