All Projects → kieranbrowne → clojure-tensorflow

kieranbrowne / clojure-tensorflow

Licence: EPL-1.0 license
An extremely light layer over TensorFlow's Java api

Programming Languages

clojure
4091 projects

Projects that are alternatives of or similar to clojure-tensorflow

Java.interop
Java.Interop provides open-source bindings of Java's Java Native Interface (JNI) for use with .NET managed languages such as C#
Stars: ✭ 120 (+9.09%)
Mutual labels:  interop
Helix
A simple, easy to use library for React development in ClojureScript.
Stars: ✭ 235 (+113.64%)
Mutual labels:  interop
UnityNativeTool
Allows to unload native plugins in Unity3d editor
Stars: ✭ 147 (+33.64%)
Mutual labels:  interop
Colore
A powerful C# library for Razer Chroma's SDK
Stars: ✭ 121 (+10%)
Mutual labels:  interop
Cppsharp
Tools and libraries to glue C/C++ APIs to high-level languages
Stars: ✭ 2,221 (+1919.09%)
Mutual labels:  interop
terrafx.interop.windows
Interop bindings for Windows.
Stars: ✭ 183 (+66.36%)
Mutual labels:  interop
Smmalloc Csharp
Blazing fast memory allocator designed for video games meets .NET
Stars: ✭ 81 (-26.36%)
Mutual labels:  interop
Mail-Merge-Examples
Mail merge data to a Word document in C#, VB.NET without Microsoft Word or interop.
Stars: ✭ 26 (-76.36%)
Mutual labels:  interop
Vue 2 3
↔️ Interop Vue 2 components in Vue 3 apps and vice versa
Stars: ✭ 231 (+110%)
Mutual labels:  interop
DotNET.jl
Julia ❤️ .NET
Stars: ✭ 75 (-31.82%)
Mutual labels:  interop
Interopdotnet
Cross-platform AnyCPU P/Invoke for .NET
Stars: ✭ 131 (+19.09%)
Mutual labels:  interop
Add Reason
✨🐢 Dead simple tool for seamlessly integrating ReasonML into existing JavaScript projects.
Stars: ✭ 168 (+52.73%)
Mutual labels:  interop
speckle-blender
speckle.systems/tag/blender/
Stars: ✭ 38 (-65.45%)
Mutual labels:  interop
Reactivetradercloud
Real-time FX trading showcase by Adaptive.
Stars: ✭ 1,664 (+1412.73%)
Mutual labels:  interop
speckle-sharp
.NET SDK, Schema and Connectors: Revit, Rhino, Grasshopper, Dynamo, ETABS, AutoCAD, Civil3D & more.
Stars: ✭ 214 (+94.55%)
Mutual labels:  interop
Pinvoke
A library containing all P/Invoke code so you don't have to import it every time. Maintained and updated to support the latest Windows OS.
Stars: ✭ 1,288 (+1070.91%)
Mutual labels:  interop
Nimterop
Nimterop is a Nim package that aims to make C/C++ interop seamless
Stars: ✭ 244 (+121.82%)
Mutual labels:  interop
KodiSharp
Use Kodi python APIs in C#, and write rich addons using the .NET framework/Mono
Stars: ✭ 22 (-80%)
Mutual labels:  interop
haxe-c-bridge
Easily interact with haxe classes from C with an automatically generated C header
Stars: ✭ 46 (-58.18%)
Mutual labels:  interop
DotNetJS
Consume C# in JavaScript with comfort: single-file UMD library, auto-generated 2-way bindings and type definitions
Stars: ✭ 551 (+400.91%)
Mutual labels:  interop

This project is achived, thanks to all who took part

There are now many better supported solutions to doing machine learning via clojure. And a library is still not necessary to use tensorflow from clojure due to its firstclass interop, see my blog post on the topic.

Clojure and TensorFlow

A light layer of wrappers over Java interop for working with TensorFlow.

Clojars Project Build Status

Getting started

Example Neural Network

(ns example.core
  (:require [clojure-tensorflow.ops :as tf]
            [clojure-tensorflow.layers :as layer]
            [clojure-tensorflow.optimizers :as optimize]
            [clojure-tensorflow.core :refer [run with-graph with-session]]))

;; Training data
(def input (tf/constant [[0. 1.] [0. 0.] [1. 1.] [1. 0.]]))
(def target (tf/constant [[0.] [0.] [1.] [1.]]))

;; Define network / model
(def network
  ;; first layer is just the training input data
  (-> input
      ;; next is a hidden layer of six neurons
      ;; we can set the activation function like so
      (layer/linear 6 :activation tf/sigmoid)
      ;; next is a hidden layer of eight neurons
      ;; tf/sigmoid is used by default when we dont
      ;; specify an activation fn
      (layer/linear 8)
      ;; our last layer needs to be the same size as
      ;; our training target data, so one neuron.
      (layer/linear 1)))


;; Cost function; we're using the squared difference
(def error (tf/square (tf/sub target network)))

;; Initialize global variables
(run (tf/global-variables-initializer))

;; Train Network 1000 epochs
(run (repeat 1000 (optimize/gradient-descent error)))

;; Initialize global variables
(run (tf/mean error))
;; => [9.304908E-5]
;; the error is now incredibly small

Requirements

TensorFlow requires at least Java 8. This will already be the default on most machines, but if it isn't for you, it's possible to force lein to use it by adding the :java-cmd "/path/to/java" key to your project.clj.

License

Copyright © 2017 Kieran Browne

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].