I have a class structure definition as follows: What I fail to understand is, how does Super() use the code from the Super class in the function of the base class here?
class Std(object):
def __init__(self):
self.W = defaultdict(int)
def update(self, vect, label):
self.bias += label
for k, v in vect.items():
self.W[k] += v * label
class Avg(Std):
def __init__(self):
super(Avg, self).__init__()
self.U = defaultdict(int)
self.beta = 0
def update(self, vect, label):
super(Avg, self).update(vect, label)
self.beta += label * self.count
for k, v in vect.items():
self.U[k] += v * label * self.count
Can someone explain to me how many lines code are actually there in the update method of the Avg class and how does the Super() work here?