                                encoder]))]
     (desc/build-and-create-network encoder)))
 
+
+(defn plot-raw-mnist-tsne
+  []
+  (let [data (vec (take 1000 @test-data))
+        labels (vec (take 1000 @test-labels))
+        label-idx (mapv nn-vis/index-of-label labels)
+        tsne-samples (tsne/tsne data 2)]
+    (nn-vis/scatter-plot-data tsne-samples label-idx "raw mnist")))
+
 (defn plot-network-tsne
   [net-key]
   (let [network (build-encoder-net net-key)]
     (nn-vis/plot-network-tsne network
                               (vec (take 1000 @test-data))
                               (vec (take 1000 @test-labels)) (name net-key))))
+
+
+(defn plot-tsne-encoder
+  []
+  (let [description (remove #(or (= :dropout (:type %))
+                                 (= :input (:type %)))
+                            (:network (get @networks :mnist-tsne-multi-target)))
+        split-item (last description)
+        first-linear (take 2 (first (:branches split-item)))
+        tsne-desc (vec (flatten (concat (drop-last description) [first-linear])))
+        data (vec (take 1000 @test-data))
+        labels (vec (take 1000 @test-labels))
+        label-idx (mapv nn-vis/index-of-label labels)
+        network (desc/build-and-create-network (concat (desc/input 28 28 1) tsne-desc))
+        samples (net/run network data)]
+    (nn-vis/scatter-plot-data samples label-idx "tsne autoencoder")))

(defonce normalized-data (future (mnist/normalized-data)))
(def training-data (future (:training-data @normalized-data)))
(def test-data  (future (:test-data @normalized-data)))
(def autoencoder-size 529)

(defn build-and-create-network
  [description]

            [cortex-gpu.nn.train :as gpu-train]
            [cortex-gpu.resource :as resource]
            [cortex-gpu.nn.cudnn :as cudnn]
            [cortex-visualization.nn.core :as nn-vis]
            [tsne.core :as tsne]))



