scittle 2023-06-03

I used Scittle to embed this little digit recognition widget in https://matthewdowney.github.io/clojure-neural-networks-from-scratch-mnist I wrote up with some notes on getting started with neural nets. Very convenient to do this using Scittle instead of a whole cljs project because it was < 100 loc.

👍 3
👍🏼 1
🆒 4
😍 10

Wow that is cool!

Pretty cool! If you haven't already, share the article in #news-and-articles

❤️ 1

Wonderful!! It may be worth exploring in combination with @chris441's https://github.com/cnuernber/tmdjs (DataFrame and Numerics for ClojureScript). tmdjs does seem to work well with Scittle (currently this is supported by the https://github.com/scicloj/scittle, but should be also doable in the original Scittle itself using the new https://clojurians.slack.com/archives/C034FQN490E/p1683142333100929?thread_ts=1682156428.196199&amp;cid=C034FQN490E). I'd be happy to help exploring that.

Didn't realize mnist could be reduced down to:

(defn sigmoid [n] (/ 1.0 (+ 1.0 (Math/exp (- n)))))
  
  (defn feedforward [inputs weights biases]
    (for [[b ws :as _neuron] (map vector biases weights)]
      (let [weighted-input (reduce + (map * inputs ws))]
        (sigmoid (+ b weighted-input)))))
  
  (defn argmax [numbers]
    (let [idx+val (map-indexed vector numbers)]
      (first (apply max-key second idx+val))))
  
  (defn digit [pixels]
    (-> pixels (feedforward w0 b0) (feedforward w1 b1) argmax))

That's what I love about clojure/lisp though. Implementing a solution in Clojure makes the whole problem easier for me to understand. Thanks for putting this together

> OpenAI: Hey there son, you gotta license for those there sufficiently powerful Clojure functions?

And amazingly it works in the browser on android if you tap the individual pixels. It seems to default to 8 for a single pixel.

Yeah, and that's an interpreted in scittle. Such a rad demo

@daslu cool, tmdjs looks like a lifesaver for tackling "real" data tasks in JS

thanks @john! i was also surprised by how concise the inference could be. a friend showed me his c# implementation and i was like, oh, this seems like something i could actually figure out, at least at a basic level, without reading a whole textbook haha

➕ 1

@james427 haha yeah it's a bit of a hack, i gave up on mobile after a few attempts to make the https://github.com/matthewdowney/clojure-neural-networks-from-scratch/blob/main/mnist-scittle/canvas.js file handle the mobile touch / move events

I'm curious about changing this into a text completion API, for like an omnibox with NLP completion over a narrow domain, and have it running right in the browser