BaseGsDetector#

class mobgap.gait_sequences.base.BaseGsDetector[source]#

Base class for GS-detectors.

This base class should be used for all gait sequence detection algorithms. Algorithms should implement the detect method, which will perform all relevant processing steps. The method should then return the instance of the class, with the gs_list_ attribute set to the detected gait sequences. Further, the detect method should set self.data and self.sampling_rate_hz to the parameters passed to the method.

We allow that subclasses specify further parameters for the detect methods (hence, this baseclass supports **kwargs). However, you should only use them, if you really need them and apply active checks, that they are passed correctly. In 99% of the time, you should add a new parameter to the algorithm itself, instead of adding a new parameter to the detect method.

Other Parameters:
data

The raw IMU data in the body frame passed to the detect method.

sampling_rate_hz

The sampling rate of the IMU data in Hz passed to the detect method.

Attributes:
gs_list_

A dataframe specifying the detected gait sequences. The dataframe has a start and end column, specifying the start and end index of the gait sequence. The values are specified as samples after the start of the recording (i.e. the start of the data).

Notes

You can use the base_gsd_docfiller decorator to fill common parts of the docstring for your subclass. See the source of this class for an example.

Methods

clone()

Create a new instance of the class with all parameters copied over.

detect(data, *, sampling_rate_hz, **kwargs)

Detect gait sequences in the passed data.

get_params([deep])

Get parameters for this algorithm.

self_optimize(data_sequences, ...)

Optimize the internal parameters of the algorithm.

set_params(**params)

Set the parameters of this Algorithm.

__init__(*args, **kwargs)#
clone() Self[source]#

Create a new instance of the class with all parameters copied over.

This will create a new instance of the class itself and all nested objects

detect(
data: DataFrame,
*,
sampling_rate_hz: float,
**kwargs: Unpack[dict[str, Any]],
) Self[source]#

Detect gait sequences in the passed data.

Parameters:
data

The raw IMU data in the body frame.

sampling_rate_hz

The sampling rate of the IMU data in Hz.

Returns:
self

The instance of the class with the gs_list_ attribute set to the detected gait sequences.

get_params(deep: bool = True) dict[str, Any][source]#

Get parameters for this algorithm.

Parameters:
deep

Only relevant if object contains nested algorithm objects. If this is the case and deep is True, the params of these nested objects are included in the output using a prefix like nested_object_name__ (Note the two “_” at the end)

Returns:
params

Parameter names mapped to their values.

self_optimize(
data_sequences: Iterable[DataFrame],
ref_gsd_list_per_sequence: Iterable[DataFrame],
*,
sampling_rate_hz: float | Iterable[float],
**kwargs: Unpack[dict[str, Any]],
) Self[source]#

Optimize the internal parameters of the algorithm.

This is only relevant for algorithms that have a special internal optimization approach (like ML based algos).

Parameters:
data_sequences

A sequence/iterable/list of dataframes, each containing the raw IMU data of a single sensor. This could be individual trials or data from different participants. The optimization will be performed over all sequences combined.

ref_gsd_list_per_sequence

A sequence/iterable/list of gsd-list, each containing the reference gait sequences for the respective data sequence. They are used as ground-truth to validate the output of the algorithm during optimization.

sampling_rate_hz

The sampling rate of the IMU data in Hz. This can either be a single float, in case all sequences have the same sampling rate, or a sequence of floats, in case the sampling rate differs between the sequences.

Returns:
self

The instance of the class with the internal parameters optimized.

set_params(**params: Any) Self[source]#

Set the parameters of this Algorithm.

To set parameters of nested objects use nested_object_name__para_name=.

Examples using mobgap.gait_sequences.base.BaseGsDetector#

Custom Data and Datasets

Custom Data and Datasets

The Mobilise-D pipeline: Step-by-Step Breakdown

The Mobilise-D pipeline: Step-by-Step Breakdown

Preconfigured Mobilised Pipelines

Preconfigured Mobilised Pipelines

GSD Iluz

This example shows how to use the GSD Iluz algorithm and some examples on how the results compare to the original

GSD Paraschiv-Ionescu

GSD Paraschiv-Ionescu

GSD Evaluation

GSD Evaluation

GSD Evaluation Challenges

GSD Evaluation Challenges