From the course: Deep Learning with Python and Keras: Build a Model for Sentiment Analysis
Unlock this course with a free trial
Join today to access over 24,900 courses taught by industry experts.
Training and evaluating the model
From the course: Deep Learning with Python and Keras: Build a Model for Sentiment Analysis
Training and evaluating the model
- [Instructor] With our datasets all set up, we are now ready to train our sentiment analysis model. We'll use the same Dense neural network as before, no change in the architecture. The only change here is how we have encoded the input text. We've used TF-IDF vectorization instead of count vectorization. The first block of code is where we set up our DNN model. The first Dense layers have tanh activation, and the last Dense layer with three units is the output layer. The output is in the raw logits form. The Dense neural network has the same two dropout layers with 10% dropout. We call model.compile. We configure the parameters for training the model. The same SparseCategoricalCrossentropy loss from logits is equal to true because we are not using softmax activation as our last layers, so the output scores will be raw logit scores rather than normalized probabilities. We use the Adam optimizer with a learning rate of…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
Feed forward neural networks4m 31s
-
(Locked)
Splitting data into training test and validation sets5m 3s
-
(Locked)
Representing text using count vectorization8m 32s
-
(Locked)
Configuring the dense neural network6m 11s
-
(Locked)
Training and evaluating the DNN3m 12s
-
(Locked)
Configuring the count vectorizer as a model layer2m 52s
-
(Locked)
Representing text using TF-IDF vectorization5m 9s
-
(Locked)
Training and evaluating the model3m 19s
-
(Locked)
Representing text using integer sequences3m 58s
-
(Locked)
Training a DNN using embeddings7m 21s
-
(Locked)
-
-