su_calculation.py
def entropy(vec, base=2):
	"Returns the empirical entropy H(X) in the input vector"
	_, vec = np.unique(vec, return_counts=True)
	prob_vec = np.array(vec/float(sum(vec)))
	if base == 2:
		logfn = np.log2
	elif base == 10:
		logfn = np.log10
	else:
		logfn = np.log
	return prob_vec.dot(-logfn(prob_vec))
Returns the empirical entropy H(X) in the input vector
Returns the empirical entropy H(X) in the input vector
Returns the empirical entropy H ( X ) in the input vector
def entropy(vec, base=2):
	_, vec = np.unique(vec, return_counts=True)
	prob_vec = np.array(vec/float(sum(vec)))
	if base == 2:
		logfn = np.log2
	elif base == 10:
		logfn = np.log10
	else:
		logfn = np.log
	return prob_vec.dot(-logfn(prob_vec))
def entropy ( vec , base = 2 ) : _ , vec = np . unique ( vec , return_counts = True ) prob_vec = np . array ( vec / float ( sum ( vec ) ) ) if base == 2 : logfn = np . log2 elif base == 10 : logfn = np . log10 else : logfn = np . log return prob_vec . dot ( - logfn ( prob_vec ) )
Returns the empirical entropy H(X) in the input vector
Returns the empirical entropy H ( X ) in the input vector
"Returns the empirical entropy H(X) in the input vector"
vec
base