<jupyter_start><jupyter_text>Training & Testing for CNP<jupyter_code>sess = tf.Session()
sess.run(tf.global_variables_initializer())
sess = train_model(sess, n_iter=n_iter, verbose=False)


print("Model is", exp_type)
n_test_task = 100
n_context_test = 5
errors = []
for i in range(n_test_task):
  error, A = plot_out(sess, amp_ind = random.randint(5,K_amp-5), n_context=n_context_test, seed = i)
  errors.append(error)
print("n_context = ", n_context_test, "error =", np.mean(errors))

n_context_test = 10
errors = []
for i in range(n_test_task):
  error, A = plot_out(sess, amp_ind = random.randint(5,K_amp-5), n_context=n_context_test, seed = i)
  errors.append(error)
print("n_context = ", n_context_test, "error =", np.mean(errors))

fig, ax = plt.subplots(ncols=4, figsize=(16,4))
a_onehot = 15
error, A = plot_out(sess, a_onehot, seed = 1,  ax = ax[0]);
error, A  = plot_out(sess, a_onehot, seed = 3,  ax = ax[1]);
error, A = plot_out(sess, a_onehot, seed = 5,  ax = ax[2]);
error, A = plot_out(sess, a_onehot,  seed = 15,  ax = ax[3], legend='True');
for ax_i in ax:
    ax_i.tick_params(axis='both', which='major',length=0)<jupyter_output><empty_output><jupyter_text>Training & Testing for MR-CNP(A)<jupyter_code>sess = tf.Session()
sess.run(tf.global_variables_initializer())
sess = train_model(sess, n_iter=n_iter, verbose=False)


print("Model is", exp_type)
n_test_task = 100
n_context_test = 5
errors = []
for i in range(n_test_task):
  error, A = plot_out(sess, amp_ind = random.randint(5,K_amp-5), n_context=n_context_test, seed = i)
  errors.append(error)
print("n_context = ", n_context_test, "error =", np.mean(errors))

n_context_test = 10
errors = []
for i in range(n_test_task):
  error, A = plot_out(sess, amp_ind = random.randint(5,K_amp-5), n_context=n_context_test, seed = i)
  errors.append(error)
print("n_context = ", n_context_test, "error =", np.mean(errors))
fig, ax = plt.subplots(ncols=4, figsize=(16,4))
a_onehot = 15
error, A = plot_out(sess, a_onehot, seed = 1,  ax = ax[0]);
error, A  = plot_out(sess, a_onehot, seed = 3,  ax = ax[1]);
error, A = plot_out(sess, a_onehot, seed = 5,  ax = ax[2]);
error, A = plot_out(sess, a_onehot,  seed = 15,  ax = ax[3], legend='True');
for ax_i in ax:
    ax_i.tick_params(axis='both', which='major',length=0)<jupyter_output><empty_output><jupyter_text>Training & Testing for MR-CNP(W)<jupyter_code>n_iter = 120000
sess = tf.Session()
sess.run(tf.global_variables_initializer())
sess = train_model(sess, n_iter=n_iter, verbose=False)


print("Model is", exp_type)
n_test_task = 100
n_context_test = 5
errors = []
for i in range(n_test_task):
  error, A = plot_out(sess, amp_ind = random.randint(5,K_amp-5), n_context=n_context_test, seed = i)
  errors.append(error)
print("n_context = ", n_context_test, "error =", np.mean(errors))

n_context_test = 10
errors = []
for i in range(n_test_task):
  error, A = plot_out(sess, amp_ind = random.randint(5,K_amp-5), n_context=n_context_test, seed = i)
  errors.append(error)
print("n_context = ", n_context_test, "error =", np.mean(errors))
fig, ax = plt.subplots(ncols=4, figsize=(16,4))
a_onehot = 15
error, A = plot_out(sess, a_onehot, seed = 1,  ax = ax[0]);
error, A  = plot_out(sess, a_onehot, seed = 3,  ax = ax[1]);
error, A = plot_out(sess, a_onehot, seed = 5,  ax = ax[2]);
error, A = plot_out(sess, a_onehot,  seed = 15,  ax = ax[3], legend='True');
for ax_i in ax:
    ax_i.tick_params(axis='both', which='major',length=0)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1636990235496841, 'fraction_numerical': 0.024124066628374498, 'mean_word_length': 5.776264591439689, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '384417', 'license': 'Apache-2.0', 'n_tokens_mistral': 1520, 'n_tokens_neox': 1449, 'n_words': 300, 'path': 'meta_learning_without_memorization/sinusoid/MR_CNP.ipynb', 'repo_name': 'ojInc/google-research', 'size': '3482'}