FLOCK.RegularityFeats
index
c:\users\james\gitrepos\gps-ruck\flock\regularityfeats.py

This script contains functions for finding:
    - The regularity of soldier movement with entropy and autoregressive modeling
    - The variability of kinematic measures over time with entropy

 
Modules
       
EntropyHub
numpy
pandas
matplotlib.pyplot

 
Functions
       
PACS_entropy(ruck_slices_oriented, names)
Get entropy from PACS locations
Using heatmaps and their shannon entropy
 
Args:
    ruck_slices_oriented (list): DataFrames for each movement period
    names (list): list of soldier names
 
Returns:
    entropy_df (DataFrame): dataframe of entropy values, index corresponds to movement periods and columns are names
VARX_model(ruck_slices_oriented, names, time_window=100, resid=False)
a vector autoregressive model with moving average and exogenous variables
for each soldier in their PACS coord system
exog vars are other soldiers
 
Args:
    ruck_slices_oriented (list): list of oriented dataset dfs
    names (list): list of names
    time_window (int, optional): rolling time window for predictions. Defaults to 100.
    resid (bool, optional): using the resudials of the model as the error if True, otherwise predict a 'test'. Defaults to False.
 
Returns:
    VARX_errs (list): list of dataframes for each movement period, showing the VARX error over time
VAR_model(ruck_slices_oriented, names, time_window=100, resid=False)
a vector autoregressive model for each soldier in their PACS coord system
 
Args:
    ruck_slices_oriented (list): list of PACS oriented dataset dfs
    names (list): list of names
    time_window (int, optional): rolling time window for predictions. Defaults to 100.
    resid (bool, optional): using the resudials of the model as the error if True, otherwise predict a 'test'. Defaults to False.
 
Returns:
    VAR_errs (list): list of dataset dfs that show each soldiers VAR error over time
time_series_metric_entropy(metric, range=[-10, 10], bins=100)
Get an approximate entropy value from time-series metrics extracted from the GPS data
Most metrics are in a list of dataframes, one for each movement period
 
Get Approximate Entropy for each movement period and return the average
 
Customize range and bin count          
 
Args:
    metric (list): list of DataFrames that include a metric over time for each individual
    range (list, optional): range of bins for Entropy Histogram. Defaults to [-10,10].
    bins (int, optional): number of bins for Entropy Histogram. Defaults to 100.
 
Returns:
    entropies (pd.Series): Series with the average entropy over movement periods for each individual