Did I find the right examples for you? yes no

All Samples(8)  |  Call(6)  |  Derive(0)  |  Import(2)

        def SortHistogram(histogram,key=True,doreverse=False):

        if type(histogram)!=type({}):
            sys.stderr.writelines("error: SortHistogram(h)...h isn't a histogram; h="+str(histogram)+"\n")
            return []
	sortedhistogram={}
	if key==False:
                items = histogram.items()
		items.sort(key=itemgetter(1), reverse=doreverse)
	else:
		titems=[]
		for k in histogram:
			titems.append([histogram[k],k])
			titems.sort(key=itemgetter(1), reverse=doreverse)
			#reverse v,k->k,v
			items=[]
			for vk in titems:
				items.append((vk[1],vk[0]))
				
	sortedhistogram=items
	return sortedhistogram
        


src/m/l/mlboost-0.4.1/mlboost/core/ppdataset.py   mlboost(Download)
import csv
from numpy import *
from pphisto import Histogram,SortHistogram
from ppdist import *
from __init__ import extract_features
	# print sorted corr
	if verbose:
	    scorr=SortHistogram(corr,False,True)
	    for el in scorr:
	        print el[0],el[1]*100,"% "
            #get highest info value (first one)...Yes we are computing 1-entropy
            if len(infov)>=1:
                [vi,info]=SortHistogram(infov,False,False)[0]
 
            if 0:
                #get max classification value (first one)
                if len(infov)>=1:
                    [vc,classprob]=SortHistogram(classprobv,False,True)[0]
 
        if 0:
            thresholdph[field]=vc
 
        sinfoh=SortHistogram(infoh,False,True)
 
        # print info

src/m/l/mlboost-0.4.1/mlboost/core/pylabhisto.py   mlboost(Download)
# simple fct to display an histogram sorted 
from pylab import *
from pphisto import SortHistogram
from numpy import arange,zeros,array,where
from ppcorr import probs2corr
 
    # sort histogram	
    shm=SortHistogram(hm,False,True)
    x=arange(n,dtype=float)
    y=zeros(n,float)