Beispiel #1
0
 def getReplacementPotential(self):
     '''how useful is it to start a new classi from this node including it's redichotomisation'''
     ###gotta think it through!
     v = len(self.samples)
     if self.isTerminal:
         v *= helpers.getBoolEntropy(self.samples,self.keyStatements)
     else:
         v *= helpers.getInformationGain(self.samples,self.dichotomy,self.keyStatements)- self.getInformationGain(self)
     return v
Beispiel #2
0
    def update(self,onlyResult = False):
        '''updates result and, if asked, the entropy of a node'''
        if not onlyResult:
            self.entropy = helpers.getBoolEntropy(self.samples,self.keyStatements)            
        if not self.isMajorant:
            fchoose = helpers.getAverage
        else:
            fchoose = helpers.getMajorant

        self.result = fchoose(self.keyStatements,self.samples)
        self.updated = True
Beispiel #3
0
 def calculateOutput(self):
     '''updates result and the entropy of a node'''
     if self.updated:
         return self.result
     
     if not self.isMajorant:
         fchoose = helpers.getAverage
     else:
         fchoose = helpers.getMajorant
     self.result = fchoose(self.keyStatements,self.samples)
     self.entropy = helpers.getBoolEntropy(self.samples,self.keyStatements)
     self.updated = True
     return self.result