Train on data (list of arrays n*dim). Labels are optional, default is 0...n-1.
(self,data,labels=None)
| 12 | self.n = 0 # nbr of classes |
| 13 | |
| 14 | def train(self,data,labels=None): |
| 15 | """ Train on data (list of arrays n*dim). |
| 16 | Labels are optional, default is 0...n-1. """ |
| 17 | |
| 18 | if labels==None: |
| 19 | labels = range(len(data)) |
| 20 | self.labels = labels |
| 21 | self.n = len(labels) |
| 22 | |
| 23 | for c in data: |
| 24 | self.mean.append(mean(c,axis=0)) |
| 25 | self.var.append(var(c,axis=0)) |
| 26 | |
| 27 | def classify(self,points): |
| 28 | """ Classify the points by computing probabilities |
no outgoing calls
no test coverage detected