<jupyter_start><jupyter_text>Creating bottleneck i.e reducing number of neurons in the intermediate layer<jupyter_code>x_val = x_train[:1000]
x_train = x_train[1000:]
y_val = y_train[:1000]
y_train = y_train[1000:]
model = models.Sequential()
model.add(layers.Dense(64, activation='relu', input_shape=(10000,)))
model.add(layers.Dense(4, activation='relu'))
model.add(layers.Dense(46, activation='softmax'))

model.compile(optimizer='rmsprop',
              loss='categorical_crossentropy',
              metrics=['accuracy'])
history = model.fit(x_train, y_train, epochs=20, batch_size=128,
                    validation_data=(x_val, y_val))<jupyter_output>Train on 7982 samples, validate on 1000 samples
Epoch 1/20
7982/7982 [==============================] - 1s 91us/sample - loss: 2.9408 - acc: 0.2224 - val_loss: 2.3374 - val_acc: 0.2410
Epoch 2/20
7982/7982 [==============================] - 1s 69us/sample - loss: 1.9511 - acc: 0.5558 - val_loss: 1.7112 - val_acc: [...]<jupyter_text>Using more hidden units<jupyter_code>model = models.Sequential()
model.add(layers.Dense(128, activation='relu', input_shape=(10000,)))
model.add(layers.Dense(64, activation='relu'))
model.add(layers.Dense(46, activation='softmax'))

model.compile(optimizer='rmsprop',
              loss='categorical_crossentropy',
              metrics=['accuracy'])
history = model.fit(x_train, y_train, epochs=10, batch_size=512,
                    validation_data=(x_val, y_val))<jupyter_output>Train on 7982 samples, validate on 1000 samples
Epoch 1/10
7982/7982 [==============================] - 1s 125us/sample - loss: 2.2944 - acc: 0.5629 - val_loss: 1.4402 - val_acc: 0.6940
Epoch 2/10
7982/7982 [==============================] - 1s 87us/sample - loss: 1.1563 - acc: 0.7514 - val_loss: 1.1383 - val_acc: 0.7560[...]<jupyter_text>Using Single layer network<jupyter_code>model = models.Sequential()
model.add(layers.Dense(128, activation='relu', input_shape=(10000,)))
model.add(layers.Dense(46, activation='softmax'))

model.compile(optimizer='rmsprop',
              loss='categorical_crossentropy',
              metrics=['accuracy'])
history = model.fit(x_train, y_train, epochs=10, batch_size=512,
                    validation_data=(x_val, y_val))
model = models.Sequential()
model.add(layers.Dense(64, activation='relu', input_shape=(10000,)))
model.add(layers.Dense(46, activation='softmax'))

model.compile(optimizer='rmsprop',
              loss='categorical_crossentropy',
              metrics=['accuracy'])
history = model.fit(x_train, y_train, epochs=10, batch_size=512,
                    validation_data=(x_val, y_val))<jupyter_output>Train on 7982 samples, validate on 1000 samples
Epoch 1/10
7982/7982 [==============================] - 1s 99us/sample - loss: 2.7160 - acc: 0.5650 - val_loss: 1.9206 - val_acc: 0.6790
Epoch 2/10
7982/7982 [==============================] - 1s 82us/sample - loss: 1.5542 - acc: 0.7290 - val_loss: 1.3884 - val_acc: 0.7340[...]
{'fraction_non_alphanumeric': 0.5272618334331935, 'fraction_numerical': 0.06011583782704214, 'mean_word_length': 8.105454545454545, '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': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '497792', 'license': 'Apache-2.0', 'n_tokens_mistral': 3283, 'n_tokens_neox': 3057, 'n_words': 193, 'path': 'notebooks/dl-chollet/scripts/Reuter News Multiclass Classification.ipynb', 'repo_name': 'yantraguru/deeplearning', 'size': '5007'}