Giter Site home page Giter Site logo

tfjs-cljs's Introduction

tfjs-cljs

A ClojureScript wrapper library for TensorFlow.js.

Usage

Add a dependency to your project.clj.

Clojars Project

Example

Clojure idiomatic rewrite of linear regression example from #getting-started.

(def model
  (-> (models/sequential)
      (models/add (layers/dense {:units 1 :inputShape [1]}))
      (models/compile {:loss "meanSquaredError" :optimizer "sgd"})))

(let [xs     (tf/tensor2d [1 2 3 4] [4 1])
      ys     (tf/tensor2d [1 3 5 7] [4 1])]
  (.then (models/fit model xs ys config {:epochs 10})
         #(tf/print (models/predict model (tf/tensor2d [5] [1 1])))))

Should I use it?

No. This library only contains a subset of TensorFlow.js to the extent of my knowledge.

tfjs-cljs's People

Contributors

namenu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

damienstanton

tfjs-cljs's Issues

Uncaught ReferenceError: tf is not defined

Not sure if there is a bug in your code but just having the library in my project.clj as

[namenu/tfjs-cljs "0.1.0-SNAPSHOT"]

and an import

(ns app.my.namespace
(:require [tfjs-cljs.core :as t :refer-macros [defvar with-tidy]]
            [tfjs-cljs.train :as train]))

i get the error above. I am actually trying to use this in a react-native app so there is not much of a message

ExceptionsManager.js:73 Error: Uncaught ReferenceError: tf is not defined
    at syncImportScripts (figwheel-bridge.js:133)
    at importJs (figwheel-bridge.js:150)
    at goog.writeScriptTag_ (figwheel-bridge.js:246)
    at Object.goog.importScript_ (base.js:951)
    at Object.goog.writeScripts_ (base.js:1394)
    at goog.require (base.js:706)
    at figwheel-bridge.js:217
    at syncImportScripts (figwheel-bridge.js:136)
    at importJs (figwheel-bridge.js:150)
    at figwheel-bridge.js:212

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.