pdfcoffee
Chapter 10TensorFlow Embedding APITensorFlow also offers an Embedding API where one can find and visualize PCAand tSNE [1] clusters using TensorBoard. You can see the live PCA on MNISTimages here: http://projector.tensorflow.org. The following image isreproduced for reference:Figure 1: A visualization of a principal component analysis, applied to the MNIST datasetYou can process your data using TensorBoard. It contains a tool called EmbeddingProjector that allows one to interactively visualize embedding. The EmbeddingProjector tool has three panels:• Data Panel: It is located at the top left, and you can choose the data, labels,and so on in this panel.• Projections Panel: Available at the bottom left, you can choose the type ofprojections you want here. It offers three choices: PCA, t-SNE, and custom.[ 379 ]
Unsupervised Learning• Inspector Panel: On the right-hand side, here you can search for particularpoints and see a list of nearest neighbors.Figure 2: Screenshow of the Embedding Projector toolK-means clusteringK-means clustering, as the name suggests, is a technique to cluster data, that is, topartition data into a specified number of data points. It is an unsupervised learningtechnique. It works by identifying patterns in the given data. Remember the sortinghat of Harry Potter fame? What it is doing in the book is clustering—dividing new(unlabeled) students into four different clusters: Gryffindor, Ravenclaw, Hufflepuff,and Slytherin.Humans are very good at grouping objects together; clustering algorithms tryto give a similar capability to computers. There are many clustering techniquesavailable, such as Hierarchical, Bayesian, or Partitional. K-means clustering belongsto partitional clustering; it partitions the data into k clusters. Each cluster has acenter, called the centroid. The number of clusters k has to be specified by the user.The k-means algorithm works in the following manner:1. Randomly choose k data points as the initial centroids (cluster centers)2. Assign each data point to the closest centroid; there can be different measuresto find closeness, the most common being the Euclidean distance[ 380 ]
- Page 363 and 364: Recurrent Neural NetworksAttention
- Page 365 and 366: Recurrent Neural NetworksFinally, V
- Page 367 and 368: Recurrent Neural Networks# query.sh
- Page 369 and 370: Recurrent Neural Networksself.atten
- Page 371 and 372: Recurrent Neural Networks30 try to
- Page 373 and 374: Recurrent Neural Networks3. Because
- Page 375 and 376: Recurrent Neural NetworksSummaryIn
- Page 377 and 378: Recurrent Neural Networks18. Shi, X
- Page 380 and 381: AutoencodersAutoencoders are feed-f
- Page 382 and 383: Depending upon the actual dimension
- Page 384 and 385: • __init__(): Here, you define al
- Page 386 and 387: Chapter 9And then we reshape the te
- Page 388 and 389: Chapter 9plt.imshow(x_test[index].r
- Page 390 and 391: Chapter 9Keeping the rest of the co
- Page 392 and 393: noise = np.random.normal(loc=0.5, s
- Page 394 and 395: Chapter 9x_train,validation_data=(x
- Page 396 and 397: Chapter 9import matplotlib.pyplot a
- Page 398 and 399: Chapter 9self.conv4 = Conv2D(1, 3,
- Page 400 and 401: Chapter 9You can see that the image
- Page 402 and 403: [ 367 ]Chapter 9Let us use the prec
- Page 404 and 405: Chapter 9Our autoencoder model take
- Page 406 and 407: We train the autoencoder for 20 epo
- Page 408 and 409: Chapter 90.97905576229095460.989323
- Page 410 and 411: Unsupervised LearningThis chapter d
- Page 412 and 413: Chapter 10Next we load the MNIST da
- Page 416 and 417: 3. Recompute the centroids using cu
- Page 418 and 419: Chapter 10Figure 4: Plot of the fin
- Page 420 and 421: Chapter 10In SOMs, neurons are usua
- Page 422 and 423: [ 387 ]Chapter 10Colour mapping usi
- Page 424 and 425: Chapter 10# Calculating Neighbourho
- Page 426 and 427: We will also need to normalize the
- Page 428 and 429: Chapter 10ρρ(vv oo |h oo ) = σσ
- Page 430 and 431: # Generate the sample probabilityde
- Page 432 and 433: Chapter 10And the reconstructed ima
- Page 434 and 435: Chapter 10inpX = rbm.rbm_output(inp
- Page 436 and 437: Chapter 10(60000, 28, 28) (60000,)(
- Page 438 and 439: Chapter 10Figure 11: Summary of the
- Page 440 and 441: Chapter 10This chapter, along with
- Page 442 and 443: Reinforcement LearningThis chapter
- Page 444 and 445: Chapter 11And unlike unsupervised l
- Page 446 and 447: Chapter 11Normally, the value is de
- Page 448 and 449: Chapter 11• The next question tha
- Page 450 and 451: Chapter 11This neural network takes
- Page 452 and 453: Chapter 11The MuJoCo environment re
- Page 454 and 455: Chapter 11We will first import the
- Page 456 and 457: Chapter 11The αα is the learning
- Page 458 and 459: Chapter 11We set up the global valu
- Page 460 and 461: Chapter 11else:return np.argmax(sel
- Page 462 and 463: Chapter 11DQN to play a game of Ata
Chapter 10
TensorFlow Embedding API
TensorFlow also offers an Embedding API where one can find and visualize PCA
and tSNE [1] clusters using TensorBoard. You can see the live PCA on MNIST
images here: http://projector.tensorflow.org. The following image is
reproduced for reference:
Figure 1: A visualization of a principal component analysis, applied to the MNIST dataset
You can process your data using TensorBoard. It contains a tool called Embedding
Projector that allows one to interactively visualize embedding. The Embedding
Projector tool has three panels:
• Data Panel: It is located at the top left, and you can choose the data, labels,
and so on in this panel.
• Projections Panel: Available at the bottom left, you can choose the type of
projections you want here. It offers three choices: PCA, t-SNE, and custom.
[ 379 ]