 (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)
+(def autoencoder-size 1000)
 
 (defn build-and-create-network
   [description]

     :labels labels
     :loss-fn loss-fn}))

(def network-fns
  {:linear create-linear
   :logistic create-logistic
   :logistic-dropout-full create-dropout-logistic-full
   :multiple-target-dropout create-multi-target-dropout
   :mnist-multiple-target-dropout create-mnist-multi-target})


(defn train-and-evaluate

                               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")))
