Source code for shennong.features.postprocessor.base

"""A post-processor takes features as input and output new features:

    :class:`~shennong.features.features.Features` -->
    FeaturesPostProcessor -->
    :class:`~shennong.features.features.Features`

"""

import abc
import copy

from shennong.features.processor.base import FeaturesProcessor


[docs]class FeaturesPostProcessor(FeaturesProcessor):
[docs] @abc.abstractmethod def process(self, features): """Returns features post-processed from input `features`""" pass # pragma: no cover
[docs] def get_properties(self, features): properties = copy.deepcopy(features.properties) properties[self.name] = self.get_params() if 'pipeline' not in properties: properties['pipeline'] = [] properties['pipeline'].append({ 'name': self.name, 'columns': [0, self.ndims - 1]}) return properties