Created
October 3, 2013 07:25
-
-
Save dcunited001/6806317 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns handwritten-digits.draw | |
(:use [incanter core charts])) | |
(declare ^:dynamic sizex) | |
(declare ^:dynamic sizey) | |
(declare ^:dynamic nx) | |
(declare ^:dynamic ny) | |
(defn get-pixel [x y] | |
;; translate 2-d coordinates | |
;; to retrieve from list of unwrapped matrices | |
(let [n (+ (quot x sizex) (* nx (quot y sizey))) | |
m (+ (mod x sizex) (* sizex (mod y sizey)))] | |
(sel data n m))) | |
(defn draw-digits [data sizex sizey nx ny] | |
(let [xmax (* sizex nx) | |
ymax (* sizey ny)] | |
(binding [sizex sizex | |
sizey sizey | |
nx nx | |
ny ny | |
data data] | |
(heat-map get-pixel | |
0 0 xmax ymax | |
:title "digits" | |
:color false)))) | |
;; (heat-map get-pixel 0 0 xmax ymax | |
;; :title "digits" | |
;; :color false))) | |
(defn draw-100-digits [data] | |
(draw-digits data 28 28 10 10)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment