Skip to content

Merge SweepFeature and SweepSetFeature #10

@jnsbck

Description

@jnsbck

The dream would be to somehow merge SweepFeature and SweepSetFeature. This would enable the following:

  • Features could have the same name, i.e. Num_AP could exist on the sweep and sweepset level. Depending on if the input is a sweep or sweepset Num_AP either gets computed for only one sweep or the compute method gets broadcasted across the entire sweepset, i.e. applied to every sweep.
  • only one feature class would need to be defined for every feature containing _compute, _select and _aggregate methods.
  • Then calling value on a sweep feature only calls _compute, while calling it on a sweepset also calls _select and _aggregate afterwards
from abc import ABC, abstractmethod

class Feature(ABC):
    def __init__(self, data, **kwargs):
        self.data_init(data)
        self.feature_init()
        # depending on isinstance(data, Sweep) or isinstance(data, SweepSet), 
        # methods get called on data directly or broadcasted.
    
    @abstractmethod
    def _compute(self):
     # compute can be defined however and operate on both sweepsets and sweeps
         if isinstance(data, Sweep):
            # compute feature for sweep
         elif isinstance(data, SweepSet)
             # could operate on sweepset directly or just broadcast compute function to sweeps
        return value

    @abstractmethod
    def _select(self, fts):
        return fts

    @abstractmethod
    def _aggregate(self, fts):
        return value

Issues with this approach that need to be solved:

  • features are currently stored as objects in sweep.features and they + their methods/attrs can be accessed easily. If only one feature object is instantiated for all sweeps of a set this needs to be handled differently (only storing values / diagnostics potentially)
  • broadcasting is not trivial, since not all functions can be equally applied across all sweeps individually, i.e. _select or _data_init.
  • initialising self for every sweep does not work.
  • Should a sweep be handled as a sweepset with only one index? I think this is not ideal.

Ideas and drafts for this proposal are welcome. This is work in progress.

Feasability is questionable at this point.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions