Changeset 4997:3f65c6a715a8 in orange
 Timestamp:
 07/18/08 23:13:34 (6 years ago)
 Branch:
 default
 Convert:
 c2b4b61d9bd7cd443988f1d055fbf8f5c3c95a87
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

orange/orngInteract.py
r4795 r4997 32 32 # fixed an ugly bug in depdissimilarity matrix processing 33 33 34 import orange 34 import orange, statc 35 35 import orngContingency, numpy 36 36 import warnings, math, string, copy 37 37 38 from orangeom import Network 38 39 … … 155 156 self.ents = {} 156 157 self.corr = {} 158 self.chi2 = {} 157 159 self.simple = {} 158 160 for i in range(NA): … … 167 169 self.way2[(i,1,)] = atc 168 170 self.ents[(i,1)] = orngContingency.Entropy(atc.m) 171 N = sum(atc.a) 172 self.chi2[(i, i)] = statc.chisqprob(N * (numpy.sum(numpy.outer(atc.pa, atc.pa))  2 + len(atc.pa)), (len(atc.pa)1)**2) 173 174 # self.chi2[(i, i)] = N * (numpy.sum(numpy.outer(atc.pa, atc.pa))  2 + len(atc.pa)) 169 175 if simple_too: 170 176 simp = 0.0 … … 194 200 self.ents[(j,i,)] = orngContingency.Entropy(c.m) 195 201 self.corr[(j,i,)] = gai 202 self.chi2[(j,i)] = c.ChiSquareP() 196 203 if simple_too: 197 204 simp = 0.0 … … 334 341 335 342 perc = int(abs(ig)*100.0/max(max_igain,self.attlist[1][0])+0.5) 336 337 if self.entropy > 1e6: 338 w = float(100.0*ig/self.entropy) 339 else: 340 w = float(0.0) 341 342 graph[i, j] = w 343 graph[i, j] = perc / 30 + 1 343 344 344 345 if self.entropy > 1e6: … … 798 799 f.write("}\n") 799 800 801 def exportChi2Matrix(self, pretty_names = 1): 802 labels = [] 803 for i in range(self.NA): 804 t = '%s'%self.names[i] 805 if pretty_names: 806 t = string.replace(t,"ED_","") 807 t = string.replace(t,"D_","") 808 t = string.replace(t,"M_","") 809 labels.append(t) 810 811 diss = [[self.chi2[(i,j)] for i in range(j+1)] for j in range(self.NA)] 812 return diss, labels 813 800 814 def depExportDissimilarityMatrix(self, truncation = 1000, pretty_names = 1, jaccard = 1, simple_metric=0,color_coding = 0, verbose=0, include_label=0): 801 815 NA = self.NA
Note: See TracChangeset
for help on using the changeset viewer.