<jupyter_start><jupyter_text>Compute error exponents<jupyter_code>p = 0.25

capacity = it.capacity_bsc(p)
c1 = it.c1_bsc(p)
R_vec = np.linspace(0.0001, capacity, 100)
R_vec[-1] = capacity
R_size = len(R_vec)
div = 1000
bound = 0.05

err_exp_burnashev =np.zeros((R_size), dtype=float)
err_exp_random_coding = np.zeros((R_size), dtype=float)
err_exp_sphere_packing = np.zeros((R_size), dtype=float)

for i in range(R_size):
    rate = R_vec[i]
    err_exp_burnashev[i] = err_exp.burnashev_VL(p, rate)
    err_exp_random_coding[i] = err_exp.random_coding(p, rate, x0=p+0.001)
    err_exp_sphere_packing[i] = err_exp.sphere_packing_bound(p, rate, x0=p+0.001)
R_vec1 = np.linspace(0, capacity, 20)
R_vec1[-1] = capacity
R_size1 = len(R_vec1)

err_exp_henderson = np.zeros((R_size1), dtype=float)

for i in range(R_size1):
    rate = R_vec1[i]
    err_exp_henderson[i] = err_exp.henderson_FL(p, rate, div, bound)<jupyter_output><empty_output><jupyter_text>Plots of error exponents<jupyter_code>#colors 
#e41a1c
#377eb8
#4daf4a
#984ea3

width = 1.5

# plotting the error exponent 
#burnashev, = plt.plot(R_vec, err_exp_burnashev, color='#e41a1c', linewidth = width, label = 'Burnashev VL bound') 
sphere_packing, = plt.plot(R_vec, err_exp_sphere_packing, color='#377eb8', linewidth = width, label = 'Sphere Packing bound') 
random_coding, = plt.plot(R_vec, err_exp_random_coding, color='#4daf4a', linewidth = width, label = 'Random Coding bound') 
henderson, = plt.plot(R_vec1, err_exp_henderson, color='#984ea3', linewidth = width, label = 'Causal Posterior Matching bound') 
  
# setting x and y axis range 
#plt.ylim(0, c1+0.001)
plt.ylim(0, 0.21)
plt.xlim(0, capacity+0.001)
    
# naming the x axis 
plt.xlabel('Rate', fontsize=12) 
# naming the y axis 
plt.ylabel('Error Exponent', fontsize=12) 

# giving a legend to the graph
#plt.legend([burnashev, sphere_packing, random_coding, henderson,], 
          #['Burnashev VL bound', 'Sphere Packing bound', 'Random Coding bound', 'Causal Posterior Matching bound'])
plt.legend(fontsize=12)

# giving a title to the graph 
#plt.title('Error Exponent Vs Rate') 
  
#plt.savefig('causal_PM_err_exp.eps', dpi = 450)
plt.savefig('causal_PM_err_exp1.png', dpi= 450)
# function to show the plot 
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13620386643233742, 'fraction_numerical': 0.043497363796133566, 'mean_word_length': 5.6384839650145775, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '442296', 'license': 'MIT', 'n_tokens_mistral': 1032, 'n_tokens_neox': 942, 'n_words': 193, 'path': 'error_exp_plots.ipynb', 'repo_name': 'anushalalitha5/Information-theory-Causal-Posterior-Matching', 'size': '2276'}