-
Notifications
You must be signed in to change notification settings - Fork 1
[Class] FeatureExtractor 📦
A Feature Extractor is a Pipeline Unit. Meaning, you can instantiate one and include it in a Pipeline.
Give a tuple of functions that compute features of an array of samples. You can create your own functions and pass them, or you can reference some of the most popular ones, like:
TimeFeatures.mean
TimeFeatures.variance
TimeFeatures.deviation
- Etc.
You may also name the Feature Extractor:
extractor = FeatureExtractor((TimeFeatures.mean, TimeFeatures.variance ...), name = 'My first feature extractor')
It's any function that receives an array float
s, computes what it should from them, and returns one float
-- the computed feature. You just have to define them and pass them to the initializer:
def my_feature_1(samples:np.array) -> float:
# TODO Do your thing and return the computed feature
extractor = FeatureExtractor((my_feature_1, TimeFeatures.variance, ...),
Add it to a Pipeline:
pipeline.add(extractor)
Or apply it directly to a Timeseries that is equally equally segmented:
features = extractor.apply(timeseries1)
A feature will be computed for every segment and a Features
object will be returned, from which you can obtain the computed features by indexing ([]
) operations:
average_timeseries = features['mean']