Deviations from trajectory

deviations(df=None, traces=None)

Calculate the Mean Absolute Deviation (MAD) for the given DataFrame.

Parameters:
  • df (pd.DataFrame) – DataFrame containing ‘y’ column.

  • traces (dict) – A dictionary with keys as (sessionId) and values as lists of DataFrames. If None, traces will be computed from df.

Returns:

A dictionary with keys as (sessionId) and values as dictionaries with ‘mad_mean’ (mean of maximum absolute deviations), ‘mad_max’ (maximum absolute deviation across all traces), ‘mad_min’ (minimum absolute deviation across all traces) and ‘aad’ (average absolute deviation).

Return type:

dict