<jupyter_start><jupyter_text>Read in the data<jupyter_code># Read files of the format N<number>.txt
N_list = np.array([64,128,256,512,1024,2048])
numfile = N_list.size

sigma_list = []
MSE_list = []

for i in N_list:
        filename = 'N' + str(i) + '.txt'
        f = open(filename, 'r')
        lines = f.readlines()
        f.close()
        
        numentries = len(lines)

        sigma = np.zeros(numentries)
        MSE = np.zeros(numentries)
        for j in range(numentries):
            sigma[j] = float(lines[j].split()[0])
            MSE[j] = float(lines[j].split()[1])
        ind_sort = np.argsort(sigma)
        sigma = sigma[ind_sort]
        MSE = MSE[ind_sort]
        
        sigma_list.append(sigma)
        MSE_list.append(MSE)<jupyter_output><empty_output><jupyter_text>Plot<jupyter_code>fig = plt.figure(figsize=(8,6))

colormap = plt.cm.winter
colors = [colormap(i) for i in np.linspace(0,1,numfile)]
for j in range(numfile):
    plt.semilogy(sigma_list[j],MSE_list[j],color=colors[j],marker='o',linestyle='-',label=N_list[j])
   
plt.xlabel('Tuning curve width',fontsize=15)
plt.ylabel('Mean squared error',fontsize=15)
plt.title('MSE vs. tuning curve width for different number of neurons')
plt.text(1.01,0.09,'Number of neurons',fontsize=12)
leg = plt.legend(handlelength=0, handletextpad=0, fancybox=True, frameon=False,bbox_to_anchor=(1.1,0.665),markerscale=0)
for item in leg.legendHandles:
    item.set_visible(False)
plt.show()

fig.savefig('matplotlib_jimmy.pdf',format='pdf', bbox_inches = 'tight')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1537970644543714, 'fraction_numerical': 0.029355456285896617, 'mean_word_length': 3.9, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, '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': '317646', 'license': 'MIT', 'n_tokens_mistral': 639, 'n_tokens_neox': 600, 'n_words': 99, 'path': 'matplotlib/StudentProjects/2017/JimmyKim/matplotlib_jimmy.ipynb', 'repo_name': 'ageller/IDEAS_FSS-Vis', 'size': '1567'}