So in this lecture, we'll be looking at the notebook to do tax classification using an art end or begin
by downloading our data set, which will be the BBC News data once again.
But note that at this point in the course, you've learned the skills to plug in any data set you like,
so please feel free to do that as an exercise.
The next step is to import everything we need for this notebook.
The next step is to load in our CSB using PD that reads GSV.
The next step is to call the effect head to remind ourselves what our data frame looks like.
As you can see, we have two columns, text and labels.
The next step is to assign a numerical targets for each of our labels.
The next step is to determine the number of classes which we'll call K.
The next step is to split our data into training test.
The next step is to convert our text sentences into sequences.
Note that we are now not using TFI Taf, but instead will be representing each document as a list of
integers.
Note that we've set the max vocab size to two thousand.
The next step is to assign our word to index mapping to a variable and also to check the true vocab
size.
As you can see, there are over 27000 tokens.
The next step is to pad our training sequences.
As you can see, our documents are quite long with a maximum of about a few thousand tokens.
This makes sense since they are news articles.
The next step is to pad the test sequences as well.
But this time, setting the max length to tee this will emulate how we use this model in the real world,
since we wouldn't know the length of any future data that we want to use this model on.
The next step is to create a model.
You can see that I've chosen an embedding size of 20.
But you should feel free to change this as an exercise.
The next step is to create our aunt and layers, so we have the input followed by embedding followed
by Elysium, followed by global max pooling, followed by dense.
Now, it's important to remember that there is no formula for hyper parameters.
You simply choose them based on experiments.
As such, your exercise for this lecture is to do these experiments.
I've listed some ideas, such as using a multiple Elysium layers instead of just one using the G R U
instead of the LSD M and using the symbol or an N instead of the last year.
In addition, a setting return sequences to false and not using global max pooling.
As you recall, this will just keep the final hidden state.
Note that for all the above options, you should also try different values for the number of hidden
units.
And finally, note that you can also do combinations of the above.
So, for example, multiple TR U layers instead of just one or a simple or an N with return sequences
set to false.
The next step is to call, compile and fit all of which you've seen before.
The next step is to plot the loss per epoch.
So the last free pork looks good.
The next step is to plot the accuracy per epoch.
So the accuracy for E-block looks good, as expected, performance on the train set is better.
Note that training in Elysium network appears to be less stable than a CNN.
This is just par for the course as your models get more complex.
Your loss per epoch starts to get more erratic and less robust to different hyper parameter values.
So as a final exercise for this lecture, please continue computing other metrics like the F1 and the
AUC.
In addition, compare the performance of this model to previous models we used on this dataset.
You may be surprised at the result.
Consider why this is the case and think about how this might help guide your decisions about which models
to use in the real world.