Changeset 4676:7f14553550f7 in orange


Ignore:
Timestamp:
05/19/08 23:00:34 (6 years ago)
Author:
janezd <janez.demsar@…>
Branch:
default
Convert:
25d99a18c0c4c2f773b9bfa23e77c6356ba72785
Message:
  • fixed a crash when a continuous attribute has none or only one distinct value
File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/OrangeWidgets/Visualize/OWDistributions.py

    r4660 r4676  
    172172            equiDist = orange.EquiDistDiscretization(numberOfIntervals = self.numberOfBars) 
    173173            d_variable = equiDist(self.attributeName, self.data) 
    174             d_data = self.data.select([d_variable, self.data.domain.classVar]) 
    175             tmphdata = orange.DomainContingency(d_data)[0] 
    176             dc = orange.DomainContingency(self.data) #!!! 
    177             g = orange.ConditionalProbabilityEstimatorConstructor_loess(dc[self.attributeName], nPoints=200) #!!! 
     174#            d_data = self.data.select([d_variable, self.data.domain.classVar]) 
     175#            tmphdata = orange.DomainContingency(d_data)[0] 
     176#            dc = orange.DomainContingency(self.data) #!!! 
     177            tmphdata = orange.ContingencyAttrClass(d_variable, self.data) 
     178            try: 
     179                g = orange.ConditionalProbabilityEstimatorConstructor_loess(self.dc[self.attributeName], nPoints=200) #!!! 
     180                self.probGraphValues = [(x, ps, [(v>=0 and math.sqrt(v)*1.96 or 0.0) for v in ps.variances]) for (x, ps) in g.probabilities.items()] 
     181            except: 
     182                self.probGraphValues = []  
    178183            # print [ps.variances for (x, ps) in g.probabilities.items()] 
    179             self.probGraphValues = [(x, ps, [(v>=0 and math.sqrt(v)*1.96 or 0.0) for v in ps.variances]) for (x, ps) in g.probabilities.items()] 
    180184            # calculate the weighted CI=math.sqrt(prob*(1-prob)/(0.0+self.sums[curcol])), 
    181185            # where self.sums[curcol] = g.probabilities.items()[example][1].cases 
Note: See TracChangeset for help on using the changeset viewer.