So in this lecture, you'll be given a few exercises to practice using as we do.
Previously, you weren't that served is helpful for reducing redundant dimensions.
So for instance, run and sprint might be combined into a single dimension.
And therefore, if you used a search engine, a user querying for the word run might also get back documents
that contain the word sprint.
So your first exercise is this We built a recommender system using TFI Taf earlier in the course.
It works by doing a nearest neighbor search on a TFI to effectors directly, but we know that TFI effectors
can have large dimensionality and further might contain redundant terms.
In our case, when we were looking at movie reviews, one example might be action and adventure.
Typically, these both occur together for the same movie.
In other words, they are redundant for this exercise.
You should modify that script to use latent semantic analysis on the TF RDF vectors.
So now your nearest neighbor search should be done on the Z vectors or the latent semantic analysis
vectors instead of the X vectors or the two Jovita effectors.
The next exercise will involve revisiting tax classification, which could be anything from classifying
the news to spam detection to sentiment analysis.
Note that we did these examples earlier in the course.
So your second task will be to take one of these notebooks and modify them to use lean semantic analysis
as a pre processing step.
That is, instead of training your model on X train and Y train and then testing on X tested and Y test,
you were going to transform the X matrix first.
As such, your classifier will be trained on Z Train and Y Train and tested on Z Test and Y Test.
It would be useful to do a comparison between the performance of the model with and without this step
using different numbers of features.
As you recall, the Count Vector Riser and TFI Taf can be told to keep only the most frequent words.
So for a fair comparison, if you're Z Matrix has Dimension K, then also keep K words in your TFT f
matrix and then plot your model's performance for different values of K.
So you'll have K on the horizontal axis and model performance, such as accuracy on the vertical axis.
Your next exercise is to revisit topic modeling, as you recall, topic modeling gives us back to matrices,
one with documents by topics and another with topics by words.
For this exercise, you're going to use lean semantic analysis instead of LDA or an AMF now to convince
you that speed gives us back the same matrices.
I have to discuss a little bit about how SVT works.
Essentially, speed splits up your input matrix into three matrices you multiplied by s multiplied by
v transpose.
Now, you don't really have to know what these matrices mean or why they're relevant, but you do have
to know their shapes.
Suppose that are x matrix has the shape and by D then are you?
Matrix will have the shape and by K s matrix will be a diagonal matrix with the shape K by K and R v
transpose matrix.
We'll have the shape K by D.
Because of this, v not transposed has the shape d by K, but we typically work with the K by D version
anyway.
But this should remind you a lot of enemies.
F enemy is simply another way to do a matrix decomposition where we say X is equal to W times h.
In this case, W has the shape and by K and H has the shape K by D.
So the V transpose matrix in CVD is analogous to the H matrix in an MF.
They are both topics by words.
In fact, inside you learn the V transpose matrix can be accessed by calling ASCVD components with an
underscore, just like an MF and LDA.
Furthermore, when you call Model Di Transform, you get back your Z matrix, which is of shape and
by K or, in other words, documents by topics.
So exactly the same as an MF and LDA as a side note for SVD.
This is equivalent to U times s, so in fact, no code changes are even required.
You simply need to plug in CVD wherever you see an MF for LDA.
Now there's one slight difference between us and the other methods which you will see for yourself when
you do this exercise.
Unlike LDA in an MF, there are no constraints on the values that we get back from CVD.
They can be either positive or negative, so you might find documents that contain negative amounts
of topics.
So that's why LDA and an MF would be conceptually better for a topic modeling compared to SVT.
So the final exercise is perhaps the most difficult, as you saw earlier in this course, latent semantic
analysis can also be applied to text summarization exactly how it does.
This is a bit non-trivial for this exercise.
I've attached two papers to extra reading Detox Tea, which explains how these methods work.
The first paper is the simplest.
The second paper references the first and tries to show that their method is better.
So the exercise is to read these two papers and implement the LSA.
Summarize you yourself using both of these methods.