Changeset 1803:e8183616f755 in orange-bioinformatics for _bioinformatics/obiGeneSetSig.py


Ignore:
Timestamp:
05/29/13 13:22:07 (11 months ago)
Author:
markotoplak
Branch:
default
Children:
1804:4981b5cd8411, 1811:d89e4d232162
Message:

obiGeneSetSig: slow implementation of LLR to test correctness

File:
1 edited

Legend:

Unmodified
Added
Removed
  • _bioinformatics/obiGeneSetSig.py

    r1802 r1803  
    732732        return at 
    733733 
     734class LLR_slow(ParametrizedTransformation): 
     735    """ Slow and rough implementation of LLR (testing correctness).""" 
     736 
     737    def _get_par(self, datao): 
     738        gaussiane = [ estimate_gaussian_per_class(datao, at, common_if_extreme=True) for at in range(len(datao.domain.attributes)) ] 
     739        normalizec = [] 
     740        for i,g in zip(range(len(datao.domain.attributes)), gaussiane): 
     741            r = [ _llrlogratio(ex[i].value, *g) for ex in datao ] 
     742            normalizec.append((statc.mean(r), statc.std(r))) 
     743        return gaussiane, normalizec 
     744 
     745    def _use_par(self, arr, constructt): 
     746        gaussiane, normalizec = constructt 
     747        arr = [ arr[i].value for i in range(len(arr.domain.attributes)) ] 
     748        return sum ( (_llrlogratio(v, *g)-m)/s for v,g,n in zip(arr, gaussiane, normalizec)) 
     749 
     750 
    734751def estimate_linear_fit(data, i): 
    735752    """ 
     
    888905        print '\n'.join([ a + ": " +str(b) for a,b in ol]) 
    889906 
    890     ass = LLR(data, matcher=matcher, gene_sets=gsets, class_values=choosen_cv, min_part=0.0, normalize=True, cv=True) 
     907    ass = LLR(data, matcher=matcher, gene_sets=gsets, class_values=choosen_cv, min_part=0.0, normalize=True) 
     908    #ass = LLR_slow(data, matcher=matcher, gene_sets=gsets, class_values=choosen_cv, min_part=0.0) 
    891909    ar = to_old_dic(ass.domain, data[:5]) 
    892910    pp2(ar) 
Note: See TracChangeset for help on using the changeset viewer.