|
@@ -0,0 +1,25 @@ |
|
|
|
|
|
"""adjusters.py -- adjust the gathered Features |
|
|
|
|
|
|
|
|
|
|
|
This is usually done to either modify to reduce the Features in some way. |
|
|
|
|
|
|
|
|
|
|
|
For example: |
|
|
|
|
|
|
|
|
|
|
|
- TargetTimeAdjuster: drop Features until the target time is reached |
|
|
|
|
|
- FeatureCountAdjuster: drop Features until the target number of Features is reached |
|
|
|
|
|
|
|
|
|
|
|
TODO: Consider eg a generic PredicateAdjuster -- supply a predicate/lambda that will be used to determine whether to keep a Feature or not. |
|
|
|
|
|
""" |
|
|
|
|
|
|
|
|
|
|
|
class Adjuster(): |
|
|
|
|
|
"""Generic Adjuster class. Expects a list of Features and returns a list of Features.""" |
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, features: list=[]): |
|
|
|
|
|
"""Initialize the Adjuster with Features. |
|
|
|
|
|
|
|
|
|
|
|
NOTE: an empty feature list is permitted, since a FeatureExtractor may not produce features. Adjusters subclassing should be aware of this. |
|
|
|
|
|
""" |
|
|
|
|
|
self.features = features |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def adjust(self): |
|
|
|
|
|
"""Adjust the Features. Override this method in subclasses.""" |