Filter¶
-
dabstract.abstract.abstract.Filter(data: Iterable, filter_fct: Callable, return_none: bool = True, lazy: bool = True, workers: int = 1, buffer_len: int = 3, *arg: List, **kwargs: Dict) → Union[dabstract.abstract.abstract.FilterAbstract, dabstract.abstract.abstract.DataAbstract, numpy.ndarray, List]¶ Factory function to allow for choice between lazy and direct example selection.
For both an instance of FilterAbstract is created. Different from lazy filtering, is that with direct filtering all examples are immediately evaluated.
For more information on the functionality of Filter please check the docstring of FilterAbstract().
- Parameters
- dataIterable
Iterable object to be filtered
- filter_fctCallable
Callable function that needs to be applied.
- return_nonebool
If True, return None if filter_fct is False If False, raises IndexError
- lazybool
apply lazily or not (default = True)
- workersint
amount of workers used for loading the data (default = 1)
- buffer_lenint
buffer_len of the pool (default = 3)
- argList
additional param to provide to the function if needed
- kwargsDict
additional param to provide to the function if needed
- Returns
- FilterAbstract OR DataAbstract OR np.ndarray OR list
-
class
dabstract.abstract.abstract.FilterAbstract(data: Iterable, filter_fct: Callable, return_none: bool = False, *args, **kwargs)¶ Bases:
dabstract.abstract.abstract.AbstractFilter on the fly. Interesting when the variable to filter on takes long to compute.
When the FilterAbstract wrapper is applied, the length of your data is undefined as filtering is based on a net yet excecuted function ‘filter_fct’.
The FilterAbstract class contain the following methods :: .get - return entry from FilterAbstract .keys - show the set of keys
The full explanation for each method is provided as a docstring at each method.
- Parameters
- dataIterable
Iterable object to be filtered
- filter_fctCallable
Callable function that needs to be applied
- return_nonebool
If True, return None if filter_fct is False If False, raises IndexError
- kwargs:
additional param to provide to the function if needed
- Returns
- FilterAbstract class
-
get(index: int, return_info: bool = False, *arg: List, **kwargs: Dict) → Union[List, numpy.ndarray, Any]¶ - Parameters
- indexint
index to retrieve data from
- return_infobool
return tuple (data, info) if True else data (default = False)
- argList
additional param to provide to the function if needed
- kwargsDict
additional param to provide to the function if needed
- Returns
- List OR np.ndarray OR Any
-
property
len_defined¶