skills/cv/smm-spatial-observation-encoding/SKILL.md
Encode game state as a Super Mini Map (SMM) with separate binary channels for players, ball, and ownership, bit-packed for efficient transfer in RL training
npx skillsauth add wenmin-wu/ds-skills cv-smm-spatial-observation-encodingInstall 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.
For RL agents in spatial games (football, RTS), raw observation vectors (player positions as floats) lose spatial relationships. The Super Mini Map (SMM) renders game state onto a small 2D grid with separate binary channels: one for left team positions, one for right team, one for ball, one for active player. This gives CNN policies a spatial inductive bias while staying compact via bit-packing.
import numpy as np
from collections import deque
def render_smm(obs, width=96, height=72):
smm = np.zeros((height, width, 4), dtype=np.uint8)
def plot(positions, channel):
for x, y in positions:
px = int((x + 1) / 2 * (width - 1))
py = int((y + 0.42) / 0.84 * (height - 1))
px, py = np.clip(px, 0, width-1), np.clip(py, 0, height-1)
smm[py, px, channel] = 255
plot(obs["left_team"], 0)
plot(obs["right_team"], 1)
plot([obs["ball"][:2]], 2)
plot([obs["left_team"][obs["active"]]], 3)
return smm
# Frame stacking with bit-packing
frames = deque(maxlen=4)
obs = render_smm(raw_obs)
frames.extend([obs] * 4)
stacked = np.concatenate(list(frames), axis=-1)
packed = np.packbits(stacked, axis=-1)
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