snorkel.labeling.LabelingFunction¶
-
class
snorkel.labeling.LabelingFunction(name, f, resources=None, pre=None)[source]¶ Bases:
objectBase class for labeling functions.
A labeling function (LF) is a function that takes a data point as input and produces an integer label, corresponding to a class. A labeling function can also abstain from voting by outputting
-1. For examples, see the Snorkel tutorials.This class wraps a Python function outputting a label. Extra functionality, such as running preprocessors and storing resources, is provided. Simple LFs can be defined via a decorator. See
labeling_function.- Parameters
name (
str) – Name of the LFf (
Callable[…,int]) – Function that implements the core LF logicresources (
Optional[Mapping[str,Any]]) – Labeling resources passed in tofviakwargspre (
Optional[List[BaseMapper]]) – Preprocessors to run on data points before LF execution
- Raises
ValueError – Calling incorrectly defined preprocessors
-
__init__(name, f, resources=None, pre=None)[source]¶ Initialize self. See help(type(self)) for accurate signature.
- Return type
None
Methods
__init__(name, f[, resources, pre])Initialize self.