BaseAggregator#

class mobgap.aggregation.base.BaseAggregator[source]#

Base class for aggregators.

This base class should be used for all aggregation algorithms. Algorithms should implement the aggregate method, which will perform all relevant processing steps. The method should then return the instance of the class, with the aggregated_data_ attribute set to the calculated aggregations.

We allow that subclasses specify further parameters for the aggregate 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 aggregate method.

Other Parameters:
wb_dmos

The DMO data per walking bout passed to the aggregate method.

Attributes:
aggregated_data_

A dataframe containing the aggregated results. The index of the dataframe contains the groupby_columns. Consequently, there is one row which aggregation results for each group.

Notes

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

Methods

aggregate(wb_dmos, **kwargs)

Aggregate parameters across walking bouts..

clone()

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

get_params([deep])

Get parameters for this algorithm.

set_params(**params)

Set the parameters of this Algorithm.

__init__(*args, **kwargs)#
aggregate(
wb_dmos: DataFrame,
**kwargs: Unpack[dict[str, Any]],
) Self[source]#

Aggregate parameters across walking bouts..

Parameters:
wb_dmos

The DMO data per walking bout. This is a dataframe with one row for every walking bout and one column for every DMO parameter. This should further have relevant metadata (i.e. participant_id, visit_date, wb_id) as columns or indices. The specific requirements depend on the aggregation algorithm.

Returns:
self

The instance of the class with the aggregated_data_ attribute set to the aggregation results.

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

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.

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.aggregation.base.BaseAggregator#

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

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

Mobilised Aggregator

Mobilised Aggregator