+probability(unfinished)
This commit is contained in:
parent
a8125246c2
commit
ce8127cadb
@ -210,9 +210,21 @@ def calculate_tweet_probability(tweet_count, days_to_next_friday, prob_start, pr
|
|||||||
|
|
||||||
a = prob_start - tweet_count
|
a = prob_start - tweet_count
|
||||||
b = prob_end - tweet_count
|
b = prob_end - tweet_count
|
||||||
|
|
||||||
|
if tweet_count > prob_end:
|
||||||
|
return "0.0000 - 0.0000"
|
||||||
|
|
||||||
if a < 0:
|
if a < 0:
|
||||||
return "0.0000 - 0.0000" if tweet_count > prob_end else "1.0000 - 1.0000"
|
a = 0
|
||||||
|
if b < 0:
|
||||||
|
return "0.0000 - 0.0000"
|
||||||
|
|
||||||
prob_low = norm.cdf((b - mu_low) / sigma_low) - norm.cdf((a - mu_low) / sigma_low)
|
prob_low = norm.cdf((b - mu_low) / sigma_low) - norm.cdf((a - mu_low) / sigma_low)
|
||||||
prob_high = norm.cdf((b - mu_high) / sigma_high) - norm.cdf((a - mu_high) / sigma_high)
|
prob_high = norm.cdf((b - mu_high) / sigma_high) - norm.cdf((a - mu_high) / sigma_high)
|
||||||
return f"{prob_low:.4f} - {prob_high:.4f}"
|
|
||||||
|
prob_low = max(0.0, min(1.0, prob_low))
|
||||||
|
prob_high = max(0.0, min(1.0, prob_high))
|
||||||
|
|
||||||
|
prob_min = min(prob_low, prob_high)
|
||||||
|
prob_max = max(prob_low, prob_high)
|
||||||
|
return f"{prob_min:.4f} - {prob_max:.4f}"
|
Loading…
x
Reference in New Issue
Block a user