Reputation: 101
I have users who connect from source device to a target one, randomly. Each at his own frequency.
If a user has done a connexion in the last N days before his next one occurs, the system will remember him. Some user connect fewer than one in N days.
The question, how to compute the connexion frequency a user should have to be remembered by the system, at a certain confidence.
Upvotes: -1
Views: 23
Reputation: 101
from scipy.stats import binom
import numpy as np
def compute_p_param(n_trial, confidence):
for p in np.arange(0, 1, 0.05):
connexion = binom(n_trial, p)
if p == 0:
continue
# Looking for p(at least 2 connexions in N days)
proba = 1 - connexion.cdf(1)
if proba >= confidence:
print("p param:", p, "n:", n_trial, "confidence", confidence)
break
if __name__ == '__main__':
compute_p_param(n_trial=30, 0.80 )
Upvotes: -1