<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                # 使用 t-SNE 可視化單詞嵌入 讓我們可視化我們在上一節中生成的單詞嵌入。 t-SNE 是在二維空間中顯示高維數據的最流行的方法。我們將使用 scikit-learn 庫中的方法并重用 TensorFlow 文檔中給出的代碼來繪制我們剛學過的嵌入詞的圖形。 TensorFlow 文檔中的原始代碼可從以下鏈接獲得:[https://github.com/tensorflow/tensorflow/blob/r1.3/tensorflow/examples/tutorials/word2vec/word2vec_basic.py.](https://github.com/tensorflow/tensorflow/blob/r1.3/tensorflow/examples/tutorials/word2vec/word2vec_basic.py) 以下是我們如何實現該程序: 1. 創建`tsne`模型: ```py tsne = TSNE(perplexity=30, n_components=2, init='pca', n_iter=5000, method='exact') ``` 1. 將要顯示的嵌入數限制為 500,否則,圖形變得非常難以理解: ```py n_embeddings = 500 ``` 1. 通過調用`tsne`模型上的`fit_transform()`方法并將`final_embeddings`的第一個`n_embeddings`作為輸入來創建低維表示。 ```py low_dim_embeddings = tsne.fit_transform( final_embeddings[:n_embeddings, :]) ``` 1. 找到我們為圖表選擇的單詞向量的文本表示: ```py labels = [ptb.id2word[i] for i in range(n_embeddings)] ``` 1. 最后,繪制嵌入圖: ```py plot_with_labels(low_dim_embeddings, labels) ``` 我們得到以下繪圖: ![](https://img.kancloud.cn/39/00/3900e73576bc929ef85e83594244985b_1050x1013.png)t-SNE visualization of embeddings for PTB data set 同樣,從 text8 模型中,我們得到以下圖: ![](https://img.kancloud.cn/e9/d6/e9d6ce5f402bc112cd513f93e871822b_1062x1013.png)t-SNE visualization of embeddings for text8 data set
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看