def get_counts(d,U): rates = [] for i in range(0,100): if len(d[i]['solutions'])>=U: if d[i]['solutions'][U]['eq'] == set([-1]): #supercliques rates.append(1000) else: #not a superclique s = d[i]['solutions'][U]['eq'] H = bfutils.undersample(d[i]['gt'],U) all_rates = unknownrate.withrates(s,H).values() #print all_rates for rate in all_rates: rates.append(rate[0]) else:#<U tempu = len(d[i]['solutions']) if d[i]['solutions'][tempu]['eq'] == set([-1]): #supercliques rates.append(1000) else: #not a superclique s = d[i]['solutions'][tempu]['eq'] H = bfutils.undersample(d[i]['gt'],tempu) all_rates = unknownrate.withrates(s,H).values() #print all_rates for rate in all_rates: rates.append(rate[0]) keys = np.sort(np.unique(rates)) c = {} for k in keys: c[k] = len(np.where(rates == k)[0]) #key is rate and value is frequency #print c return c
def get_counts(d, U): rates = [] for i in range(0, 100): if len(d[i]['solutions']) >= U: if d[i]['solutions'][U]['eq'] == set([-1]): #supercliques rates.append(1000) else: #not a superclique s = d[i]['solutions'][U]['eq'] H = bfutils.undersample(d[i]['gt'], U) all_rates = unknownrate.withrates(s, H).values() #print all_rates for rate in all_rates: rates.append(rate[0]) else: #<U tempu = len(d[i]['solutions']) if d[i]['solutions'][tempu]['eq'] == set([-1]): #supercliques rates.append(1000) else: #not a superclique s = d[i]['solutions'][tempu]['eq'] H = bfutils.undersample(d[i]['gt'], tempu) all_rates = unknownrate.withrates(s, H).values() #print all_rates for rate in all_rates: rates.append(rate[0]) keys = np.sort(np.unique(rates)) c = {} for k in keys: c[k] = len( np.where(rates == k)[0]) #key is rate and value is frequency #print c return c