```
class Calculate:
def __init__(self):
self.prior = {}
self.total = {}
self.count = 0
def add(self, cls, obs):
self.prior[cls] = self.prior.get(cls, 0) + 1
for idx, val in enumerate(obs):
key = cls, idx, val
self.total[key] = self.total.get(key, 0) + 1
self.count += 1
def discr(self, cls, obs):
result = self.prior[cls]/self.count
for idx, val in enumerate(obs):
freq = self.total.get((cls, idx, val), 0)
result *= freq/self.prior[cls]
return result
def classify(self, obs):
candidates = [(self.discr(c, obs), c) for c in self.prior]
return max(candidates)[1]
```

Dear Group,

If anyone of the learned members help me to understand the above code:

Apology for the indentation errors.

Regards,

Subhabrata.