data-science

Data science, data analysis, and machine learning in Clojure https://scicloj.github.io/pages/chat_streams/ for additional discussions
2021-02-09T08:32:17.003700Z

Hey @paul.legato

2021-02-09T08:32:45.004100Z

Been meaning to update the GH issue about this (saw your post the other day).

2021-02-09T08:37:11.007Z

I checked a bit earlier, and I thought this was already possible, but after some poking around, I'm realizing it may not be. If you're using the reagent component directly (vs repl usage), then any options you pass through to the reagent component will get passed on to the embed api call.

2021-02-09T08:38:54.009100Z

I thought there was a callback option which would take the value of the created view object once it had been created, but I couldn't find it just now. If you're able to find that, then you should have everything you need (and I'm happy to help you get the usage right on that). If not, we can still add this functionality quite simply, but I probably won't have time to look at this for another week or so.

2021-02-09T08:40:05.010500Z

However, if you were intrepid and inspired enough, I can point you to where in the code base you would need to make a simple change, and as long as you're using shadow/deps.edn, you should be able to point to a gh branch until I get the PR merged in and deployed.

2021-02-09T08:41:52.010900Z

It's this chunk of code right here: https://github.com/metasoarous/oz/blob/master/src/cljs/oz/core.cljs#L40-L42

2021-02-09T08:47:03.015500Z

If you can't find an embed opt, then you just need to add a (.then (fn [thing] (run-callback (:view-callback opts) thing))), where thing is either an embed object with a .view , or a view object itself (I think the former, but check the embed api). Then when you pass :view-callback which takes a view object and does whatever you like with it, run callback is either just #(%1 %2) or #(%1 (.view %2).

2021-02-09T08:47:36.016100Z

Thanks for dusting this issue off and coaxing me to finish up on it!

2021-02-09T08:48:11.016800Z

PS If what you want is to be able to shuttle data from the repl, don't worry, I want that too, and have some ideas about that, but it might have to wait a bit longer.

2021-02-09T13:25:25.017500Z

New release: RC2! I've added the high-level chapter on CNNs, which uses Fashion-MNIST training as the example. The book is almost complete. Next: the chapter on cuDNN internals of convolution operation and pooling, a chapter on more complex architectures, and the Getting Started chapter. Note: it is much more than a Deep Learning book; it's a book that shows every single step of building real-world high-performance machine learning software, 100% in Clojure! Even if you are not that much interested in DL, you'll find tons of advice applicable on many other data crunching tasks. https://aiprobook.com/deep-learning-for-programmers/

🚀 2
6
2021-02-09T20:03:21.019400Z

@metasoarous Thanks, that’s all helpful starting points. I haven’t gotten into the cljs side at all - so far, I’ve been running everything from the REPL.

2021-02-09T20:03:58.020100Z

I tried doing (while true (oz/view! ... ) (Thread/sleep 100)), which worked surprisingly well other than using 700% CPU 😂

2021-02-09T21:02:38.020600Z

LOL; Yes, that would be a bit frequent unfortunately.

2021-02-09T21:02:53.021100Z

I do have some ideas more generally for how live updates could potentially happen through atoms or channels

2021-02-09T21:03:46.021700Z

But I think more hammock time will be needed on that one

2021-02-09T21:10:00.022100Z

Do you have any sense of roughly what refresh rate will ultimately be possible?

2021-02-09T21:10:23.022600Z

For atoms, it will have to render completely

2021-02-09T21:10:46.023100Z

But if you are really streaming data into the viz, that should be pretty quick thanks to vega

2021-02-09T21:11:24.023900Z

If you're gonna have a lot of data, you might want to set up a window on the viz so you don't end up with too many points

2021-02-09T21:11:27.024Z

My use case has ~500 to 1,000 data points, of which maybe half will update every 100 ms or so

2021-02-09T21:12:39.024600Z

https://github.com/GSI-CS-CO/chart-fx looks cool, but a bit overkill - they say 25 Hz updates on 5 million points 🙂

2021-02-09T21:13:06.025Z

What do you mean by ‘set up a window on the viz’?

2021-02-09T21:49:18.025400Z

Ah; I see. Then the atom approach might be fine for you, since most of the viz will have to update anyway

2021-02-09T21:49:43.026Z

My guess is that using the vega api to update just the data (but not the viz) will still be a bit more performant.

2021-02-09T21:49:50.026200Z

For one, there will be less react rendering

2021-02-09T21:50:11.026700Z

Second, the viz compilation structure will still be in place (uncertain how much of the time that takes though).

2021-02-09T21:50:28.027100Z

So I do think it'll be better than what you're doing now

2021-02-09T21:51:01.027400Z

The webgl rendered may be helpful for you though

2021-02-09T21:57:39.028900Z

I do have a mind to add an option to render using it, but I'm not sure how well maintained it was vs a proof of concept (I don't think it supports all of the available marks, for instance), but I've seen some impressive things done with it