Skip to main content

A package for extracting metrics from group movement GPS data

Project description

APPROVED FOR PUBLIC RELEASE: PR2024-1237

FLOCK - Feature Learning of Organized Collective Kinetics

Welcome to the FLOCK-GPS repository

The purpose of this package is to serve as a processing and feature extraction toolkit for assessing group movement dynamics from GPS location data.

Quick start

Installation

pip install FLOCK-GPS

FLOCK-GPS for Python >= 3.8 and all its dependancies are available from PyPi

Tutorials

To run the tutorials, download the repository to your local storage and open the notebooks from there.

The Tutorials folder contains a walkthrough for each preprocessing and feature extraction step, while the ExtractAllFeatures script shows how to combine and run all processing and extraction. To run the predictive modeling analysis, fist instantiate your R home in the Predictive-Modeling notebook.

Documentation

Documentation can be found in the Docs folder of this repository. The HTML files will open in your default browser from the downloaded repository.

FLOCK functions

  • DataLoading.py

    • Functions for loading and re-formatting data from a directory of .csv files
    • See the SampleData folder for input data format examples
    • GPX data from different devices can be formatted uniquely, data is assumed to be in teh format of the example .csv files in the SampleData folder
  • Preprocessing.py View Jupyter Notebook

    • Preprocessing functions such as outlier sample detection, interpolation of missing datapoints, path smothing and break detection for identifying movement periods
  • VelocityFeats.py View Jupyter Notebook

    • Feature extraction functions for finding the velocity of each individual over time and features related to difference in velocities across group members
  • SpatialFeats.py View Jupyter Notebook

    • Feature extraction functions for spatio-temporal features (spatial features over time). Such as the stretch index, convex hull surface area and voronoi spaces

Spatial feature figure
Spatial features such as distance to centroid (stretch index), convex hull surface area, and voronoi spaces

  • PACS.py View Jupyter Notebook
    • Path-adapted coordinate system transformation

PACS figure
Path-adapted coordinate system example. The leftmost figure shows the raw path and one timepoint while the next figures show the straightened PACS path and coordinates of group members over a time-window in the PACS space.

  • PacsFeats.py View Jupyter Notebook

    • Feature extraction for path adapted coordinate system tranaformed data. Such as the spatial exploration index of each individual, the nearest neighbor (left/right and front/back), the length/width ratio of the group and the consistency of member positions in different movement periods
  • DirectionalCorrelation.py View Jupyter Notebook

    • Directional correlation time delay leadership metrics from Nagy et. al. including the directional correlation time delay for each individual, Highly correlated segments (HCS) for each pair and directed graph representation of the directional correaltion time dealy leadership heirarchy for each movement period

Directional correlation time delay figure
Leadership heirarchy from the directional correlation time delay analysis

  • ClusteringFeats.py View Jupyter Notebook
    • Features from clustering analysis using a density-based clustering method (DBSCAN) and/or a heirarchical density-based clustering method (HDBSCAN)

Clustering gif
HDBSCAN clustering in action, tick lines are 5m apart
Outliers are labelled cluster -1
Plotly express doesn't allow for categorical legends in scatter animations

  • Regularity.py View Jupyter Notebook
    • Movement regularity feature extraction including PACS coordinate entropy for each individual at each movement period, Vector autoregression with and without exogenous varaibles for predicability of each individual's movement over time, and entropy measures for all features that are calculated over time

Predictive modelling View Jupyter Notebook

Case study: During a 72 hour field study, 16 groups of soldiers complete a 'loaded ruck march' before engaging in strategic and tactical exercises the next day. During these exercises, experts score each of the groups. Our goal is to predict the expert's score of each group from features calculated with this toolbox during the loaded ruck march. To select features, we employ the Terminating Random Experiments (TRex) method. We then train a linear regression model using only the selected features.

  • Explanatory model
    • Here we use all of our datapoints (16 groups) to select important features and we report the model's performance on the training data. This exploratory model achieves an R squared score of 0.82.

Explanatory Model Results
Explanatory Model Results

  • Predictive model
    • Here we employ a Leave-One-Out cross validation method, where we select features and train a new model for each iteration, then test the model on the left out datapoint. This predictive model achieves an R squared score of 0.63.

Predictive Model Results
Predictive Model Results

Why the T-Rex selector?
Compared with a basic Least Absolute Shrinkage and Selection Operator (LASSO) feature selection method, the TRex achieves a much higher stability (i.e. the selcted features in each Leave-One-Out iteration are more similar). The LASSO struggles with wide datasets (small number of observations and large number of features), especially when there is a low sparsity (a high amount of relevant features) such as with our sample study dataset.

Citation information

Please cite [0] when using FLOCK-GPS in your research and reference the appropriate release version.

Publications

About FLOCK-GPS

[0] COMING SOON

APPROVED FOR PUBLIC RELEASE: PR2024-1237

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flock_gps-0.0.2.tar.gz (26.8 MB view details)

Uploaded Source

Built Distribution

flock_gps-0.0.2-py3-none-any.whl (38.3 kB view details)

Uploaded Python 3

File details

Details for the file flock_gps-0.0.2.tar.gz.

File metadata

  • Download URL: flock_gps-0.0.2.tar.gz
  • Upload date:
  • Size: 26.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.13

File hashes

Hashes for flock_gps-0.0.2.tar.gz
Algorithm Hash digest
SHA256 21df4bb625a23fe82d503011ad4e00aabbeb043aa104ebcce489aa3b6a77b44b
MD5 91de104a55a4c018c010cfce39b45a58
BLAKE2b-256 b8733fe3362df1dd2bb11c7d6cb4d1f9719e9f8e59d2195e18bc2729be769437

See more details on using hashes here.

File details

Details for the file flock_gps-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: flock_gps-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 38.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.13

File hashes

Hashes for flock_gps-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 892b69de76073b36e732ea8241dcec030edcc4432cb6e5a6b0009dc50b5f6f17
MD5 6026dc5157eda0ed188343e0273e029a
BLAKE2b-256 a0430247dc2db1a274d4acc136cde201eafce2d9d874ad9107b67b83fa4c3f29

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page