August 2018
Intermediate to advanced
438 pages
12h 3m
English
In our document CNN model, we have the document embedding layer. Let's try to visualize what features the model has learned at this layer. We will first take the test set and calculate the document embeddings as follows:
doc_embeddings = newsgrp_model.get_document_model().predict(x_test)print(doc_embeddings.shape)(7318, 80)
We get 80 dimensional embedding vectors for all the test documents. To visualize these vectors, we will use the popular t-SNE dimentionality reduction technique to project the vectors in two-dimensionality space and graph a scatter plot as follows:
from utils import scatter_plotdoc_proj = TSNE(n_components=2, random_state=42, ).fit_transform(doc_embeddings)f, ax, sc, txts = scatter_plot(doc_proj, ...
Read now
Unlock full access