def count_ps_from_beta(N, beta, verbose=False, A=4, log_cols=None, entropies=None): iterator = (lambda x:tqdm(x, total=partitions(N, A))) if verbose else (lambda x:x) if log_cols is None or entropies is None: log_ws = np.array([log_counts_to_cols(count, A=A) + (-beta*entropy_from_counts(count)) for count in iterator(enumerate_counts_iter(N, A=A))]) else: log_ws = log_cols + -beta*entropies return np.exp(np_log_normalize(log_ws))
def count_ps_from_beta(N, beta, verbose=False, A=4, log_cols=None, entropies=None): iterator = (lambda x: tqdm(x, total=partitions(N, A))) if verbose else ( lambda x: x) if log_cols is None or entropies is None: log_ws = np.array([ log_counts_to_cols(count, A=A) + (-beta * entropy_from_counts(count)) for count in iterator(enumerate_counts_iter(N, A=A)) ]) else: log_ws = log_cols + -beta * entropies return np.exp(np_log_normalize(log_ws))
def f2(beta): log_phats = np_log_normalize(log_cols + -beta * entropies) expected_entropy = np.exp(log_phats).dot(entropies) return log2(A) - expected_entropy - desired_ic_per_col
def f2(beta): log_phats = np_log_normalize(log_cols + -beta*entropies) expected_entropy = np.exp(log_phats).dot(entropies) return log2(A) - expected_entropy - desired_ic_per_col