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.
Configuring the count vectorizer as a model layer
From the course: Deep Learning with Python and Keras: Build a Model for Sentiment Analysis
Configuring the count vectorizer as a model layer
- [Narrator] I'll evaluate the model on the test dataset once again, but I'll show you a slightly different configuration for our model. In the previous example, we performed the pre-processing of text as a part of the dataset itself. In this example, I'm doing things a little differently. Ideally, you'd want your model itself to be capable of reprocessing the text data that is fed into the model, and this can be done by making the count vectorizer a layer in your model. This is what I've done here. Notice the export model is a sequential model that applies the count vectorizer as a layer, followed by our dense neural network model model. If you were to deploy this export model, you'd be able to feed in raw strings that would be pre-processed using our count vectorizer. Having the pre-processing as a part of the model itself makes it easier to use the model. I call model.compile to configure the model with various…
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)
-
-