How to Plot Vectorized documents in matplotlib?

Viewed 17

I tried finding the similarity of two documents by means of using TF-IDF Vectorizer for word vectorization along with cosine similarity.

    
        tfidf_vectorizer = TfidfVectorizer()
        vectorizer = tfidf_vectorizer.fit_transform([doc1])
        query_tfidf = tfidf_vectorizer.transform([doc2])
    
    Vectorizer results in the following sparse matrix,
    
        128x79 sparse matrix of type 'class 'numpy.float64'
        with 96 stored elements in Compressed Sparse Row format>

I have tried MatPlotLib for visualizing some random columns from dataframe so far. But I wonder is there any way to visualize these vectors in graph depicting the similar words of two sentences ?

0 Answers
Related