API Reference¶
The features library provides common features for machine learning models of behavioral modes from acceleration data, as well as a mechanism to extend and add additional features.
pyecoacc.features.transform
¶
ACCStatsTransformer(single_ax_stat_list='all', multi_ax_stat_list='all')
¶
Bases: BaseEstimator, TransformerMixin
sklearn style Transformer to computes the statistics for each ACC sample. This is then used as a first step in Pipeline objects. The input data is expected to be a 2D numpy array of shape (n_samples, n_timesteps*3) where each sample contains interleaved x, y, z accelerometer data. The output is a pandas DataFrame where each row corresponds to a sample and each column to a computed feature.
Features computed include both single-axis statistics (like mean, std, etc.) for each axis (x, y, z) and the norm, as well as multi-axis statistics (like correlation between axes).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
single_ax_stat_list
|
str
|
The features to use on each axis. Defaults to "all". |
'all'
|
multi_ax_stat_list
|
str
|
The multiple-axis features to use. Defaults to "all". |
'all'
|
Source code in pyecoacc/features/transform.py
15 16 17 18 19 20 21 22 23 | |
pyecoacc.features.stats
¶
register_multiple_axis_feature(name, func)
¶
Add a multiple-axis feature to the feature registry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
the name of the added feature. |
required |
func
|
function
|
the function that computes the feature. The function should take four 2D numpy arrays (X, Y, Z, norm) and return a 1D numpy array (samples,). |
required |
Source code in pyecoacc/features/stats.py
90 91 92 93 94 95 96 97 | |
register_single_axis_feature(name, func)
¶
Add a single-axis feature to the feature registry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
the name of the added feature. |
required |
func
|
function
|
the function that computes the feature. The function should take a 2D numpy array (samples x timepoints) and return a 1D numpy array (samples,). |
required |
Source code in pyecoacc/features/stats.py
81 82 83 84 85 86 87 88 | |
set_ODBA_low_pass_window(window_size)
¶
Set the smoothing window size for the ODBA calculations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
window_size
|
int
|
the number of samples to use in the moving average filter. |
required |
Source code in pyecoacc/features/stats.py
99 100 101 102 103 104 105 106 107 | |