Skip to content

About

Standard Euclidean shape features cannot distinguish two trajectories that trace the same spatial outline in opposite directions — they are entirely order-blind. This repository provides a minimal, interpretable remedy, i.e., the signed area accumulated along a trajectory, derived from the geometry of the Heisenberg group.

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Signed Area as an Order-Sensitive Augmentation for Planar Trajectory Classification

Official code for the paper:

Order-Sensitive Feature Extraction via Signed-Area Accumulation for Planar Trajectories
Hassan Ugail and Newton Howard


Overview

Standard Euclidean shape features cannot distinguish two trajectories that trace the same spatial outline in opposite directions — they are entirely order-blind. This repository provides a minimal, interpretable remedy: the signed area accumulated along a trajectory, derived from the geometry of the Heisenberg group.

The contribution is organised in two tiers:

Tier 1 — Minimal scalar augmentation (recommended for most use cases)
Append the terminal signed area z(T), a single scalar computed in O(T) with no learned parameters, to any existing Euclidean feature set. This 26-dimensional combined descriptor (Euc+z(T)) consistently outperforms the 25-dimensional Euclidean baseline.

Tier 2 — Full Heisenberg profile (for noisy or loop-heavy data)
A 15-dimensional profile of how the signed area evolves over time, constructed via a noncommutative subdivision scheme S_H on the Heisenberg group. Most beneficial under noise and for short or loop-heavy trajectories.


Key Results

Method UCI Characters (20-class) RF Pen Digits (10-class) RF
Euclidean (25-dim, baseline) 0.833 0.925
Euc + z(T) (26-dim, +1 scalar) 0.889 0.949
Euc + Heis (40-dim, full profile) 0.901 0.970
ROCKET (upper bound, Ridge) 0.975 0.995
  • On the hardest character pair 'o' vs 'y', z(T) alone achieves 1.000 accuracy while 25 Euclidean features reach only 0.964
  • At noise level σ=0.20, Euc+z(T) leads Euclidean by +10.9 pp on UCI Characters
  • McNemar tests confirm all gains are geometric (not dimensional): a dimension-matched random augmentation is never significant (p = 1.000)

Repository Structure

signed-area-trajectory/
├── heisenberg_trajectory_classification.ipynb   # Main notebook (runs end-to-end)
├── README.md
├── LICENSE
└── figures/                                     # Created automatically when running
    ├── fig1_motivation.png
    ├── fig2_datasets.png
    ├── fig3_pipeline.png
    ├── fig4_noise_robustness.png
    ├── fig5_dimension_ablation.png
    ├── fig6_hard_binary.png
    └── fig_confusion.png                        # Supplementary

Quick Start

Google Colab (recommended, no setup required)

Click the badge at the top of this README, or open the notebook directly in Colab.
All dependencies are installed automatically in the first cell.

Requirements: Python ≥ 3.8, NumPy, SciPy, scikit-learn, Matplotlib.
No GPU required. Full run time: approximately 10–15 minutes on CPU.


Notebook Structure

Cell Content
1 Install dependencies
2 Imports, plotting style, core functions
3 Load UCI Character Trajectories (auto-download)
4 Load UCI Pen-Based Digit Recognition (auto-download)
5 Build all feature matrices (Euc, z(T), Euc+z(T), Heis, Sig L2/L3)
6 Synthetic CW/CCW validation experiment
7 UCI 20-class main results
8 Hard binary pair analysis ('o' vs 'y')
9 UCI noise robustness
10 Pen Digits main results
11 Pen Digits noise robustness
12 Writer-independent split verification
13 ROCKET baseline (~2 min)
14 McNemar statistical significance tests
Fig 1–6 Paper figures (saved to ./figures/)

Core Functions

heis_lift(xy)

Discrete Heisenberg lift. Given a trajectory xy of shape (T, 2), computes the signed-area accumulation z(t) via:

z[0] = 0
z[t+1] = z[t] + 0.5 * (x[t]*y[t+1] - y[t]*x[t+1])

For a counter-clockwise loop of radius r, z(T) ≈ +πr². For clockwise, z(T) ≈ −πr². For open paths, |z(T)| ≈ 0.

sh_subdivide(xyz, n_steps=5, omega=1/16)

Noncommutative four-point subdivision scheme on the Heisenberg group. Refines a (T, 3) control polygon — where the third column is the z(t) profile — to 32(T−1)+1 points while preserving the group-law structure of the lift.

z_terminal(xy)

Returns z(T) as a 1-dimensional feature vector (Tier 1 augmentation).

z_profile_feats(xy)

Returns the full 15-dimensional Heisenberg feature vector (Tier 2):

  • Features 1–10: order-sensitive statistics of the z(t) profile (final value, max, min, range, total variation, sign-change count, mean, std, energy, skewness)
  • Features 11–15: horizontal geometry (arc length, endpoint displacement, curvature proxy, z-slope, z-skewness)

euc_feats(xy)

25-dimensional Euclidean baseline: arc length, endpoint displacement, mean curvature, and 22 DFT amplitudes.


Datasets

Both datasets are downloaded automatically from the UCI Machine Learning Repository when the notebook first runs.

Dataset Classes Samples T Source
UCI Character Trajectories 20 2858 60 (resampled) Williams 2006
UCI Pen-Based Digit Recognition 10 10992 8 Alpaydin & Alimoglu 1998

Reproducing the Paper

Run cells 1–14 in order. All tables and figures in the paper are produced by this notebook with fixed random_state=42. Expected runtimes:

Cell Description Time (CPU)
3–5 Data loading + feature extraction ~2 min
7–12 All accuracy experiments ~5 min
13 ROCKET (1000 kernels) ~2 min
14 McNemar tests <1 min
Fig 1–6 All figures ~2 min


License

License: MIT

MIT License — see LICENSE for details.


Contact

Hassan Ugail — Centre for Visual Computing and Intelligent Systems,
University of Bradford, UK — h.ugail@bradford.ac.uk

About

Standard Euclidean shape features cannot distinguish two trajectories that trace the same spatial outline in opposite directions — they are entirely order-blind. This repository provides a minimal, interpretable remedy, i.e., the signed area accumulated along a trajectory, derived from the geometry of the Heisenberg group.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages