7 Understanding semantic similarity

 

This chapter covers

  • Learning dense word representations that capture semantic meaning
  • Visualizing semantic similarity of high-dimensional word embeddings using dimensionality-reduction techniques like PCA and t-SNE
  • Strengths and weaknesses of PCA and t-SNE
  • Validating visualizations generated by PCA and t-SNE qualitatively and quantitatively

In the previous chapter, we switched our focus from interpreting the complex processing and operations that happen within a black-box model to interpreting the representations or features learned by the model. We specifically looked at the network dissection framework to understand what concepts are learned by the feature-learning layers in a convolutional neural network (CNN). The framework consisted of three key steps: concept definition, network probing, and alignment measurement. The concept definition step is all about data collection, specifically collecting a labeled dataset of concepts at the pixel level. This is the most time-consuming and crucial step. The next step is to probe the network and determine what units in the CNN respond to those predefined concepts. The final step involves quantifying how well the units’ responses align with the concepts. The framework overcame the limitations of visual attribution methods by coming up with quantitative interpretations in the form of human-understandable concepts.

7.1 Sentiment analysis

7.2 Exploratory data analysis

7.3 Neural word embeddings

7.3.1 One-hot encoding

7.3.2 Word2Vec

7.3.3 GloVe embeddings

7.3.4 Model for sentiment analysis

7.4 Interpreting semantic similarity

7.4.1 Measuring similarity

7.4.2 Principal component analysis (PCA)

7.4.3 t-distributed stochastic neighbor embedding (t-SNE)

7.4.4 Validating semantic similarity visualizations

Summary