ReorientationEmulationPipeline#

class mobgap.re_orientation.pipeline.ReorientationEmulationPipeline(
algo: BaseReorientationCorrector,
)[source]#

Run a reorientation algorithm on simulated sensor misorientations.

This pipeline uses the reference walking bouts of a datapoint. For every walking bout, it creates one copy for each supported rough mounting orientation using mobgap._gaitmap.utils.rotations.flip_dataset, runs the wrapped algorithm, and stores the detected orientation class.

Parameters:
algo

The reorientation algorithm to be run in the pipeline.

Other Parameters:
datapoint

The datapoint that was passed to the run method.

Attributes:
predictions_

Dataframe with one row per walking bout and simulated orientation. The dataframe is indexed by wb_id and has the columns label and prediction.

predictions_per_wb_

A dict containing one label/prediction dataframe per walking bout.

per_wb_algo_

A dict of the reorientation algorithm instances run on each walking bout and simulated orientation. The key is (wb_id, label).

Methods

clone()

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

get_params([deep])

Get parameters for this algorithm.

run(datapoint)

Run the pipeline on a single datapoint.

safe_run(datapoint)

Run the pipeline with some additional checks.

set_params(**params)

Set the parameters of this Algorithm.

__init__(
algo: BaseReorientationCorrector,
) None[source]#
clone() Self#

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]#

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.

run(
datapoint: BaseGaitDatasetWithReference,
) Self[source]#

Run the pipeline on a single datapoint.

safe_run(
datapoint: DatasetT,
) Self#

Run the pipeline with some additional checks.

It is preferred to use this method over run, as it can catch some simple implementation errors of custom pipelines. It does not validate that the provided dataset instance contains only a single datapoint/group.

The following things are checked:

  • The run method must return self (or at least an instance of the pipeline)

  • The run method must set result attributes on the pipeline

  • All result attributes must have a trailing _ in their name

  • The run method must not modify the input parameters of the pipeline

Parameters:
datapoint

An instance of a tpcp.Dataset containing only a single datapoint. The structure of the data will depend on the dataset.

Returns:
self

The class instance with all result attributes populated

set_params(
**params: Any,
) Self#

Set the parameters of this Algorithm.

To set parameters of nested objects use nested_object_name__para_name=.