GithubHelp home page GithubHelp logo

hswick / jutsu.ai Goto Github PK

View Code? Open in Web Editor NEW
100.0 12.0 10.0 98 KB

Clojure wrapper for deeplearning4j

License: Eclipse Public License 1.0

Clojure 100.00%
deeplearning4j clojure machine-learning jutsu

jutsu.ai's Introduction

jutsu.ai

Clojure wrapper for deeplearning4j with some added syntactic sugar.

What if I told you that you could do machine learning on the JVM without wanting to cry or set your hair on fire? The goal of this library is to be the most syntactically elegant machine learning library for Clojure/Java ecosystem. jutsu.ai uses Clojure specific code idioms, like Data as Code, to create an aesthetic and declarative api.

jutsu.ai makes use of my laziest but cleverest achievement which is that the network configuration translates clojure keywords into java method calls. The implication of this is that the majority of the config options provided by deeplearning4j are accessible with this library.

The best of all, no more snakes!

alt text

Currently this project is a work in progress. However, no drastic API changes are expected. Configurations have been tested on basic feedforward nets, RNN's, and CNN's. If you can't seem to find a configuration feature you are looking for submit an issue and I'll do my best to help.

If you have any suggestions or fixes please feel free to submit a PR as well!

Currently need help documenting the different configuration options. However, deeplearning4j has a very good resource that I recommend checking out.

Usage

Install jutsu.ai by including this in your project dependencies:

[hswick/jutsu.ai "0.1.5"]

You will also need to include a ND4J backend:

For CPU:

[org.nd4j/nd4j-native-platform "1.0.0-beta"]

For GPU:

[org.nd4j/nd4j-cuda-8.0-platform "1.0.0-beta"]

Here is a toy example demonstrating classifying the well known iris dataset.

(ns skynet.core
  (:require [jutsu.ai.core :as ai]))

;;Example configuration of a simple multilayer feedforward neural network architecture
;;classifying the iris dataset.
(def iris-net-config
	[:layers 
		[[:dense [:n-in 4 :n-out 10 :activation :relu]]
	 	 [:dense [:n-in 10 :n-out 10 :activation :relu]]
	 	 [:output :negative-log-likelihood [:n-in 10 :n-out 3 :activation :softmax]]]])

(def iris-net
	(-> iris-net-config
		ai/network
		ai/initialize-net))

(defn iris-train []
  (let [iris-iterator (ai/classification-csv-iterator "iris.csv" 150 4 3)]
    (-> iris-net
	(ai/train-net! 200 iris-iterator)
	(ai/save-model "iris-model"))
  (.reset iris-iterator)
  (println (ai/evaluate iris-net iris-iterator))))

(iris-train)

Documentation

Make sure to take a look at the wiki for more documentation.

Here is a video tutorial I made demonstrating the use of jutsu.ai.

Additional Resources

Here is a list of libraries that I have created to be used with jutsu.ai:

  • jutsu.matrix Clojure wrapper around ND4J to make it easier to work with the underlying matrices in DL4J.
  • jutsu.nlp Clojure wrapper around DL4J's NLP features. Provides useful abstractions for Word Vectors.
  • jutsu.ai.ui GUI for visualizing DL4J training
  • jutsu Simple web based graphing tool for Clojure

Here is a list of libraries that I've found useful when working with jutsu.ai:

  • claypoole Juiced up clojure functions like pmap. Very useful when working with big data sets.
  • tablesaw Table slicing tool for Java. Nice API and extremely performant.

Dev

Run boot night to startup nightlight and begin editing the project in a browser.

Contributing

When changing project dependencies or project version number, make sure to update this in the build.boot file. The Travis build uses boot, and will not pass the checks unless you update it.

The project.clj file is simple there to make it easier for other developers to contribute.

License

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

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.