Git Product home page Git Product logo

deep-book-clojure's Introduction

deep-book-clojure

MXNet Clojure version of the code for the Neural Networks and Deep Learning free book

Installation

Note, that you will need to download and unzip MNIST images into the data directory. Use script from the MXNet project which I put into utils/get_mnist_data.sh, it should do the right thing. The data files are about 50Mb in size, so I didn't commit them to github.

git clone https://github.com/deem0n/deep-book-clojure.git
cd deep-book-clojure
utils/get_mnist_data.sh

Usage

lein test
lein run

Code comparasion

Python Clojure
class Network(object):

  def __init__(self, sizes):
      self.num_layers = len(sizes)
      self.sizes = sizes
      self.biases = [np.random.randn(y, 1) for y in sizes[1:]]
      self.weights = [np.random.randn(y, x) 
                      for x, y in zip(sizes[:-1], sizes[1:])]
(defrecord Network [^java.lang.Long num_layers
                  ^clojure.lang.PersistentVector sizes
                  ^clojure.lang.LazySeq biases
                  ^clojure.lang.LazySeq weights])

;Constructor
(defn make-network ([sizes]
                  (->Network
                   (count sizes)
                   sizes
                   (map #(random/normal 0 1 [% 1]) (subvec sizes 1))
                   (map #(random/normal 0 1 [%2 %1]) (butlast sizes) (subvec sizes 1)))))

JVM tuning

Someone suggested to use the following:

JVM_FLAGS="-server  \
-XX:+UseConcMarkSweepGC \
-XX:+UseCompressedOops \
-XX:+DoEscapeAnalysis \
-XX:+UseBiasedLocking \
-Xmx2g"

License

Copyright © 2019 Dmitry Dorofeev

MIT LICENSE

deep-book-clojure's People

Contributors

deem0n avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.