In lesson 11, when labeling data using label_by_func
ll = label_by_func(sd, parent_labeler, proc_y=CategoryProcessor())
gives the following error:
TypeError Traceback (most recent call last)
<ipython-input-34-38cd67685599> in <module>
----> 1 ll = label_by_func(sd, parent_labeler, proc_y=CategoryProcessor())
<ipython-input-33-d34bec34833b> in label_by_func(sd, f, proc_x, proc_y)
31
32 def label_by_func(sd, f, proc_x=None, proc_y=None):
---> 33 train = LabeledData.label_by_func(sd.train, f, proc_x=proc_x, proc_y=proc_y)
34 valid = LabeledData.label_by_func(sd.valid, f, proc_x=proc_x, proc_y=proc_y)
35 return SplitData(train,valid)
<ipython-input-33-d34bec34833b> in label_by_func(cls, il, f, proc_x, proc_y)
28 @classmethod
29 def label_by_func(cls, il, f, proc_x=None, proc_y=None):
---> 30 return cls(il, _label_by_func(il, f), proc_x=proc_x, proc_y=proc_y)
31
32 def label_by_func(sd, f, proc_x=None, proc_y=None):
<ipython-input-33-d34bec34833b> in __init__(self, x, y, proc_x, proc_y)
9
10 def __init__(self, x, y, proc_x=None, proc_y=None):
---> 11 self.x,self.y = self.process(x, proc_x),self.process(y, proc_y)
12 self.proc_x,self.proc_y = proc_x,proc_y
13
<ipython-input-33-d34bec34833b> in process(self, il, proc)
6 # we'll discuss the changes in lesson 11
7 class LabeledData():
----> 8 def process(self, il, proc): return il.new(compose(il.items, proc))
9
10 def __init__(self, x, y, proc_x=None, proc_y=None):
<ipython-input-32-e4cab730e9b2> in compose(x, funcs, order_key, *args, **kwargs)
1 def compose(x, funcs, *args, order_key='_order', **kwargs):
2 key = lambda o: getattr(o, order_key, 0)
----> 3 for f in sorted(listify(funcs), key=key): x = f(x, **kwargs)
4 return x
TypeError: 'NoneType' object is not callable
I think this is because of missing proc_x. Is this causing the issue or am i missing something? how do i fix this?