def train(self,features):
        labels = getLabels(features)
        print "Ent:",entropy(labels)
        print "Max:",maxValue(labels)
        
        self.label = maxValue(labels)
        self.entropy = entropy(labels)
        
        if len(features) < self.cutoff or self.entropy < self.min_entropy:
            return
        
        no_feature = len(features[0][1])
        
        max_gain = 0.0
        max_feature = 0
        max_children = {}
        for i in range(no_feature):
            gain = self.entropy
            s = splitFeatures(i,features)
            for _,vals in s.iteritems():
                scale = float(len(vals))/float(len(features))
                e = entropy(getLabels(vals))
                #print "Split %3d:"%i,key,len(vals), e
                gain -= scale*e    
            if max_gain < gain:
                max_gain = gain
                max_feature = i
                max_children = s
        print "Gain: ",max_gain,max_feature
        self.feature = max_feature
        self.gain = max_gain
        
        self.children = {}
        for label,features in max_children.iteritems():
            self.children[label] = Node(features)
              
        #for i in range(features):
dataset/ETHPy150Open bolme/pyvision/src/pyvision/vector/id3.py/Node.train/original