snorkel.map.BaseMapper¶
-
class
snorkel.map.BaseMapper(name, pre, memoize)[source]¶ Bases:
objectBase class for
MapperandLambdaMapper.Implements nesting, memoization, and deep copy functionality. Used primarily for type checking.
- Parameters
name (
str) – Name of the mapperpre (
List[BaseMapper]) – Mappers to run before this mapper is executedmemoize (
bool) – Memoize mapper outputs?
- Raises
NotImplementedError – Subclasses need to implement
_generate_mapped_data_point
-
__init__(name, pre, memoize)[source]¶ Initialize self. See help(type(self)) for accurate signature.
- Return type
None
Methods
__init__(name, pre, memoize)Initialize self.
Reset the memoization cache.
-
__call__(x)[source]¶ Run mapping function on input data point.
Deep copies the data point first so as not to make accidental in-place changes. If
memoizeis set toTrue, an internal cache is checked for results. If no cached results are found, the computed results are added to the cache.- Parameters
x (
Any) – Data point to run mapping function on- Returns
Mapped data point of same format but possibly different fields
- Return type
DataPoint