snorkel.labeling.labeling_function¶
-
class
snorkel.labeling.
labeling_function
(name=None, resources=None, pre=None)[source]¶ Bases:
object
Decorator to define a LabelingFunction object from a function.
- Parameters
name (
Optional
[str
]) – Name of the LFresources (
Optional
[Mapping
[str
,Any
]]) – Labeling resources passed in tof
viakwargs
pre (
Optional
[List
[BaseMapper
]]) – Preprocessors to run on data points before LF execution
Examples
>>> @labeling_function() ... def f(x): ... return 0 if x.a > 42 else -1 >>> f LabelingFunction f, Preprocessors: [] >>> from types import SimpleNamespace >>> x = SimpleNamespace(a=90, b=12) >>> f(x) 0
>>> @labeling_function(name="my_lf") ... def g(x): ... return 0 if x.a > 42 else -1 >>> g LabelingFunction my_lf, Preprocessors: []
-
__init__
(name=None, resources=None, pre=None)[source]¶ Initialize self. See help(type(self)) for accurate signature.
- Return type
None
Methods
__init__
([name, resources, pre])Initialize self.