gaitmap.stride_segmentation.hmm.BaseHmmFeatureTransformer#

class gaitmap.stride_segmentation.hmm.BaseHmmFeatureTransformer[source]#

Baseclass for HMM feature transformers used in combination with SimpleSegmentationModel.

Note

This algorithm is only available via the gaitmap_mad package and distributed under a AGPL3 licence. To use it, you need to explicitly install the gaitmap_mad package. Learn more about that here.

This is only required if gaitmap.stride_segmentation.hmm.RothHMMFeatureTransformer is not sufficient for your use case, when using RothSegmentationHmm.

In this case implement a custom subclass and pass it to the feature_transform parameter of RothSegmentationHmm. Note, that you need to implement the transform and inverse_transform_state_sequence methods.

Methods

clone()

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

from_json(json_str)

Import an gaitmap object from its json representation.

get_params([deep])

Get parameters for this algorithm.

inverse_transform_state_sequence(...)

Inverse transform a state sequence to the original sampling rate.

set_params(**params)

Set the parameters of this Algorithm.

to_json()

Export the current object parameters as json.

transform([data, roi_list, sampling_rate_hz])

Transform the data and the roi/stride list into to the feature space.

__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

classmethod from_json(json_str: str) Self[source]#

Import an gaitmap object from its json representation.

For details have a look at the this example.

You can use the to_json method of a class to export it as a compatible json string.

Parameters:
json_str

json formatted string

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.

inverse_transform_state_sequence(state_sequence: ndarray, *, data: array) ndarray[source]#

Inverse transform a state sequence to the original sampling rate.

Parameters:
state_sequence

The state sequence to be transformed back to the original sampling rate. This is done by repeating each state for the number of samples it was downsampled to.

data

The original data used for the transformation

Returns:
The state sequence in the original sampling rate
set_params(**params: Any) Self[source]#

Set the parameters of this Algorithm.

To set parameters of nested objects use nested_object_name__para_name=.

to_json() str[source]#

Export the current object parameters as json.

For details have a look at the this example.

You can use the from_json method of any gaitmap algorithm to load the object again.

Warning

This will only export the Parameters of the instance, but not any results!

transform(data: DataFrame | None = None, *, roi_list: DataFrame | None = None, sampling_rate_hz: float | None = None, **kwargs) NoReturn[source]#

Transform the data and the roi/stride list into to the feature space.

Transforming the roi/stride list is only required, if the sampling rate of the features space is different from the data space. If now down-sampling is required, set self.transformed_roi_list_ to roi_list.