You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Run the specified number of randomized trials
results = [__entrofy(df_binary.values, n, rng,
w=target_weight,
q=target_prob,
pre_selects=pre_selects_i,
quantile=quantile,
alpha=alpha)
for _ in range(n_trials)]
# Select the trial with the best score
max_score, best = results[0]
for score, solution in results[1:]:
if score > max_score:
max_score = score
best = solution
This could be replaced with
# Run the specified number of randomized trials
max_score = 0
for _ in range(n_trials):
score, solution = __entrofy(df_binary.values, n, rng,
w=target_weight,
q=target_prob,
pre_selects=pre_selects_i,
quantile=quantile,
alpha=alpha)
if score > max_score:
max_score = score
best = solution
The text was updated successfully, but these errors were encountered:
I think this is mostly my preference when coding and thinking about the logic behind it. I could try to write a technical reason related with memory (not allocate all the n_trials solution in memory) or speed (one n_trial for-loop instead of two) but I don't have data to support my idea.
entrofy/core.py
hasThis could be replaced with
The text was updated successfully, but these errors were encountered: