Training the network

Now that my sentiment analysis network is built, it's time to train:

data = load_data(20000)data = pad_sequences(data)model = build_network(vocab_size=data["vocab_size"],                      embedding_dim=100,                      sequence_length=data["sequence_length"])callbacks = create_callbacks("sentiment")model.fit(x=data["X_train"], y=data["y_train"],          batch_size=32,          epochs=10,          validation_data=(data["X_test"], data["y_test"]),          callbacks=callbacks)

Keeping all of my training parameters and data in a single dictionary like this is just really a question of style and less about function. You may prefer to handle everything separately. I like using a dictionary for everything because it keeps me from passing big lists of parameters back and forth.

Since we're ...

Get Deep Learning Quick Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.