<jupyter_start><jupyter_text>Encoder-Decoder Analysis  Model Architecture<jupyter_code>report_file = '/Users/bking/IdeaProjects/LanguageModelRNN/reports/encdec_250_800_dr.json'
log_file = '/Users/bking/IdeaProjects/LanguageModelRNN/logs/encdec_250_800_dr_logs.json'

import json
import matplotlib.pyplot as plt
with open(report_file) as f:
    report = json.loads(f.read())
with open(log_file) as f:
    logs = json.loads(f.read())
print'Encoder: \n\n', report['architecture']['encoder']
print'Decoder: \n\n', report['architecture']['decoder']<jupyter_output>Encoder: 

nn.Sequential {
  [input -> (1) -> (2) -> (3) -> output]
  (1): nn.LookupTable
  (2): nn.LSTM(250 -> 800)
  (3): nn.Dropout(0.500000)
}
Decoder: 

nn.gModule<jupyter_text>Perplexity on Each Dataset<jupyter_code>print('Train Perplexity: ', report['train_perplexity'])
print('Valid Perplexity: ', report['valid_perplexity'])
print('Test Perplexity: ', report['test_perplexity'])<jupyter_output>('Train Perplexity: ', 5.5018499958222)
('Valid Perplexity: ', 27.312297195403)
('Test Perplexity: ', 25.383458037513)<jupyter_text>Loss vs. Epoch<jupyter_code>%matplotlib inline
for k in logs.keys():
    plt.plot(logs[k][0], logs[k][1], label=str(k) + ' (train)')
    plt.plot(logs[k][0], logs[k][2], label=str(k) + ' (valid)')
plt.title('Loss v. Epoch')
plt.xlabel('Epoch')
plt.ylabel('Loss')
plt.legend()
plt.show()<jupyter_output><empty_output><jupyter_text>Perplexity vs. Epoch<jupyter_code>%matplotlib inline
for k in logs.keys():
    plt.plot(logs[k][0], logs[k][3], label=str(k) + ' (train)')
    plt.plot(logs[k][0], logs[k][4], label=str(k) + ' (valid)')
plt.title('Perplexity v. Epoch')
plt.xlabel('Epoch')
plt.ylabel('Perplexity')
plt.legend()
plt.show()<jupyter_output><empty_output><jupyter_text>Generations<jupyter_code>def print_sample(sample):
    enc_input = ' '.join([w for w in sample['encoder_input'].split(' ') if w != '<pad>'])
    gold = ' '.join([w for w in sample['gold'].split(' ') if w != '<mask>'])
    print('Input: '+ enc_input + '\n')
    print('Gend: ' + sample['generated'] + '\n')
    print('True: ' + gold + '\n')
    print('\n')
    
for sample in report['train_samples']:
    print_sample(sample)
for sample in report['valid_samples']:
    print_sample(sample)
for sample in report['test_samples']:
    print_sample(sample)<jupyter_output>Input:  vegan celery root mashed potatoes <begin_ingredients> 1 celery root , diced <ing> 4 small or 2 large idaho potatoes , peeled and diced <ing> 1 / 4 cup olive oil , plus more to taste <ing> kosher salt <ing> chopped fresh parsley , for serving <end>

Gend:  <beg> in a large bowl , combine the cream cheese , sour cream , mayonnaise , garlic , salt , pepper and lemon juice . <step> mix well and set aside . <step> in a large bowl , combine the tomatoes , tomatoes , olives , olives , olives , onion , parsley , salt and

True:  1 . put the celery root and potatoes in a saucepan . cover with 1 inch of water . bring to a boil and then simmer until tender , about 20 minutes depending on the size of the dice . <step> 2 . drain the water from the celery root and potatoes . add the olive oil and use a potato masher until you reach your desired chunkiness level . season with salt and add more olive oil as desired . <step> 3 . transfer to a bowl , drizzle a little extra olive oil on top , and[...]<jupyter_text>BLEU Analysis<jupyter_code>print 'Overall Score: ', report['bleu']['score'], '\n'
print '1-gram Score: ', report['bleu']['components']['1']
print '2-gram Score: ', report['bleu']['components']['2']
print '3-gram Score: ', report['bleu']['components']['3']
print '4-gram Score: ', report['bleu']['components']['4']<jupyter_output>Overall Score:  0.05 

1-gram Score:  39.1
2-gram Score:  8.7
3-gram Score:  1.2
4-gram Score:  0.4
{'fraction_non_alphanumeric': 0.16217643951399893, 'fraction_numerical': 0.0306391970417327, 'mean_word_length': 5.078651685393258, 'pattern_counts': {'":': 0, '<': 34, '<?xml version=': 0, '>': 39, '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': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '243532', 'license': 'MIT', 'n_tokens_mistral': 1421, 'n_tokens_neox': 1314, 'n_words': 358, 'path': 'report_notebooks/encdec_250_800_dr.ipynb', 'repo_name': 'kingb12/recipeGenerationRNN', 'size': '3786'}