Changeset 413:7770e279977e in orange-bioinformatics


Ignore:
Timestamp:
07/07/08 15:19:25 (6 years ago)
Author:
ales_erjavec <ales.erjavec@…>
Branch:
default
Convert:
82bfd618f6a2aa2d5bab8261d2663b63c8573d38
Message:

-fixed the select n-best features for two-tail measures
-fixed p-value for t_test and anova which scored best for worst attributes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • widgets/OWFeatureSelection.py

    r410 r413  
    4949        self.scoreMethods = [("chi-square", orange.MeasureAttribute_chiSquare, oneTailTestHi), 
    5050                             ("info gain", orange.MeasureAttribute_info, oneTailTestHi), 
    51                              ("signal to noise ratio", lambda attr, data:MA_signalToNoise()(attr, data), twoTailTest), 
    52                              ("t-test",lambda attr, data:MA_t_test()(attr, data), twoTailTest), 
    53                              ("t-test p-value",lambda attr, data:1.0 - MA_t_test(prob=True)(attr, data), oneTailTestLow), 
    54                              ("fold change", lambda attr, data:MA_fold_change()(attr, data), twoTailTest), 
    55                              ("log2 fold change", lambda attr, data:math.log(max(min(MA_fold_change()(attr, data), 1e300), 1e-300)), twoTailTest), 
    56                              ("anova", lambda attr, data:MA_anova()(attr, data), oneTailTestHi), 
    57                              ("anova p-value", lambda attr, data:1.0-MA_anova(prob=True)(attr, data), oneTailTestLow)] 
     51                             ("signal to noise ratio", lambda attr, data: MA_signalToNoise()(attr, data), twoTailTest), 
     52                             ("t-test",lambda attr, data: MA_t_test()(attr, data), twoTailTest), 
     53                             ("t-test p-value",lambda attr, data: MA_t_test(prob=True)(attr, data), oneTailTestLow), 
     54                             ("fold change", lambda attr, data: MA_fold_change()(attr, data), twoTailTest), 
     55                             ("log2 fold change", lambda attr, data: math.log(max(min(MA_fold_change()(attr, data), 1e300), 1e-300), 2.0), twoTailTest), 
     56                             ("anova", lambda attr, data: MA_anova()(attr, data), oneTailTestHi), 
     57                             ("anova p-value", lambda attr, data: MA_anova(prob=True)(attr, data), oneTailTestLow)] 
    5858 
    5959        boxHistogram = OWGUI.widgetBox(self.mainArea) 
     
    174174            self.histogram.setBoundary(scores[-1][1], scores[-1][1]) 
    175175        else: 
    176             scoresHi = scores[-max(self.selectNBest/2, 1):] 
    177             scoresLo = scores[:max(self.selectNBest/2+self.selectNBest%2, 1)] 
    178             self.histogram.setBoundary(scoresLo[-1][1], scoresHi[0][1]) 
     176            scoresHi = scores[-max(min(self.selectNBest, len(scores)/2), 1):] 
     177            scoresLo = scores[:max(min(self.selectNBest, len(scores)/2), 1)] 
     178            scores = [(abs(score), 1) for attr, score in scoresHi] + [(abs(score), -1) for attr, score in scoresLo] 
     179            if self.scoreMethods[self.methodIndex][0]=="fold change": ## fold change is on a logaritmic scale 
     180                scores =  [(abs(math.log(max(min(score, 1e300), 1e-300), 2.0)), sign) for score, sign in scores] 
     181            scores.sort() 
     182            scores = scores[-max(self.selectNBest, 1):] 
     183            countHi = len([score for score, sign in scores if sign==1]) 
     184            countLo = len([score for score, sign in scores if sign==-1]) 
     185            cutHi = scoresHi[-countHi][1] if countHi else scoresHi[-1][1]+1e-10 
     186            cutLo = scoresLo[countLo-1][1] if countLo else scoresLo[0][1]-1e-10 
     187            self.histogram.setBoundary(cutLo, cutHi) 
    179188         
    180189    def Commit(self): 
Note: See TracChangeset for help on using the changeset viewer.