<jupyter_start><jupyter_text>Thresh algorithm  TODO:- Check estimation part (works well only for epoch=0)<jupyter_code>4*(np.floor(np.log(12)) + 2)
np.log(12*n*T/delta)
import numpy as np
np.sqrt(np.log(10**15)/10000)
n = 2 * 10 ** 8 # num users
T = 12 # num epochs
L = 10**6 # min subgroup size
m = 5 # num subgroups
l = 5*10**7  # epochs length
eps = 5 # privacy parameter
delta = 1e-7 # failure parameter
from thresh import Ber, Users, Aggregator
agg = Aggregator(eps, delta, T, l, n, L)
agg.accuracy_guarantee()
usr_info = agg.init_users()

user_sizes = [3*10**5, 10*10**7, 17*10**5, 9*10**7, 8*10**6]
user_means = [0.5, 0.1, 0.4, 0.1, 0.1]
usr = Users(T,l,usr_info['a'],usr_info['b'],eps,usr_info['tau'],n,m,user_sizes,user_means)
usr.get_true_avg()
%%timeit
res = agg.epoch(0, usr)
res
res - usr.get_true_avg()
agg.epoch(1, usr)
agg.epoch(50, usr)
usr.means[1] = 0.3
usr.get_true_avg()
agg.epoch(50, usr)<jupyter_output>diff max: 0.20089970529079437
diff mean: 0.10005398094654083
b*=3.0
0.4999964
0.020578086233566426
Global update!
{'fraction_non_alphanumeric': 0.17324350336862368, 'fraction_numerical': 0.13378248315688163, 'mean_word_length': 5.303030303030303, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '600991', 'license': 'MIT', 'n_tokens_mistral': 547, 'n_tokens_neox': 462, 'n_words': 106, 'path': 'diff_privacy/project/One.ipynb', 'repo_name': 'wolterlw/UB_assignments', 'size': '1039'}