MCPcopy
hub / github.com/jesolem/PCV / train

Method train

pcv_book/bayes.py:14–25  ·  view source on GitHub ↗

Train on data (list of arrays n*dim). Labels are optional, default is 0...n-1.

(self,data,labels=None)

Source from the content-addressed store, hash-verified

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

Callers 3

build_bayes_graphFunction · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected