@@ -27,8 +27,6 @@ class LabelingFunction:
27
27
Labeling resources passed in to ``f`` via ``kwargs``
28
28
pre
29
29
Preprocessors to run on data points before LF execution
30
- fault_tolerant
31
- Output ``-1`` if LF execution fails?
32
30
33
31
Raises
34
32
------
@@ -39,8 +37,6 @@ class LabelingFunction:
39
37
----------
40
38
name
41
39
See above
42
- fault_tolerant
43
- See above
44
40
"""
45
41
46
42
def __init__ (
@@ -49,10 +45,8 @@ def __init__(
49
45
f : Callable [..., int ],
50
46
resources : Optional [Mapping [str , Any ]] = None ,
51
47
pre : Optional [List [BasePreprocessor ]] = None ,
52
- fault_tolerant : bool = False ,
53
48
) -> None :
54
49
self .name = name
55
- self .fault_tolerant = fault_tolerant
56
50
self ._f = f
57
51
self ._resources = resources or {}
58
52
self ._pre = pre or []
@@ -67,9 +61,7 @@ def _preprocess_data_point(self, x: DataPoint) -> DataPoint:
67
61
def __call__ (self , x : DataPoint ) -> int :
68
62
"""Label data point.
69
63
70
- Runs all preprocessors, then passes to LF. If an exception
71
- is encountered and the LF is in fault tolerant mode,
72
- the LF abstains from voting.
64
+ Runs all preprocessors, then passes preprocessed data point to LF.
73
65
74
66
Parameters
75
67
----------
@@ -82,11 +74,6 @@ def __call__(self, x: DataPoint) -> int:
82
74
Label for data point
83
75
"""
84
76
x = self ._preprocess_data_point (x )
85
- if self .fault_tolerant :
86
- try :
87
- return self ._f (x , ** self ._resources )
88
- except Exception :
89
- return - 1
90
77
return self ._f (x , ** self ._resources )
91
78
92
79
def __repr__ (self ) -> str :
@@ -105,8 +92,6 @@ class labeling_function:
105
92
Labeling resources passed in to ``f`` via ``kwargs``
106
93
preprocessors
107
94
Preprocessors to run on data points before LF execution
108
- fault_tolerant
109
- Output ``-1`` if LF execution fails?
110
95
111
96
Examples
112
97
--------
@@ -132,14 +117,12 @@ def __init__(
132
117
name : Optional [str ] = None ,
133
118
resources : Optional [Mapping [str , Any ]] = None ,
134
119
pre : Optional [List [BasePreprocessor ]] = None ,
135
- fault_tolerant : bool = False ,
136
120
) -> None :
137
121
if callable (name ):
138
122
raise ValueError ("Looks like this decorator is missing parentheses!" )
139
123
self .name = name
140
124
self .resources = resources
141
125
self .pre = pre
142
- self .fault_tolerant = fault_tolerant
143
126
144
127
def __call__ (self , f : Callable [..., int ]) -> LabelingFunction :
145
128
"""Wrap a function to create a ``LabelingFunction``.
@@ -155,10 +138,4 @@ def __call__(self, f: Callable[..., int]) -> LabelingFunction:
155
138
New ``LabelingFunction`` executing logic in wrapped function
156
139
"""
157
140
name = self .name or f .__name__
158
- return LabelingFunction (
159
- name = name ,
160
- f = f ,
161
- resources = self .resources ,
162
- pre = self .pre ,
163
- fault_tolerant = self .fault_tolerant ,
164
- )
141
+ return LabelingFunction (name = name , f = f , resources = self .resources , pre = self .pre )
0 commit comments