skdh.features.Bank#
- class skdh.features.Bank(bank_file=None)#
A feature bank object for ease in creating a table or pipeline of features to be computed.
- Parameters:
- bank_file{None, path-like}, optional
Path to a saved bank file to load. Optional
Methods
add(features[, index])Add a feature or features to the pipeline.
compute(signal[, fs, axis, index_axis, ...])Compute the specified features for the given signal
load(file)Load a previously saved feature Bank from a json file.
save(file)Save the feature Bank to a file for a persistent object that can be loaded later to create the same Bank as before
- add(features, index=None)#
Add a feature or features to the pipeline.
- Parameters:
- features{Feature, list}
Single signal Feature, or list of signal Features to add to the feature Bank
- index{int, slice, list}, optional
Index to be applied to data input to each features. Either a index that will apply to every feature, or a list of features corresponding to each feature being added.
- compute(signal, fs=1.0, *, axis=-1, index_axis=None, indices=None, columns=None)#
Compute the specified features for the given signal
- Parameters:
- signal{array-like}
Array-like signal to have features computed for.
- fsfloat, optional
Sampling frequency in Hz. Default is 1Hz
- axisint, optional
Axis along which to compute the features. Default is -1.
- index_axis{None, int}, optional
Axis corresponding to the indices specified in Bank.add or indices. Default is None, which assumes that this axis is not part of the signal. Note that setting this to None means values for indices or the indices set in Bank.add will be ignored.
- indices{None, int, list-like, slice, ellipsis}, optional
Indices to apply to the input signal. Either None, a integer, list-like, slice to apply to each feature, or a list-like of lists/objects with a 1:1 correspondence to the features present in the Bank. If provided, takes precedence over any values given in Bank.add. Default is None, which will use indices from Bank.add.
- columns{None, list}, optional
Columns to use if providing a dataframe. Default is None (uses all columns).
- Returns:
- featsnumpy.ndarray
Computed features.
- load(file)#
Load a previously saved feature Bank from a json file.
- Parameters:
- filepath-like
File to be read to create the feature Bank.
- save(file)#
Save the feature Bank to a file for a persistent object that can be loaded later to create the same Bank as before
- Parameters:
- filepath-like
File to be saved to. Creates a new file or overwrites an existing file.