Fork me on GitHub
#data-science
<
2021-02-09
>
metasoarous08:02:45

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

metasoarous08:02:11

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.

metasoarous08:02:54

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.

metasoarous08:02:05

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.

metasoarous08:02:03

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).

metasoarous08:02:36

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

metasoarous08:02:11

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.

blueberry13:02:25

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/

sheepy 18
🚀 6
paul.legato20:02:21

@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.

paul.legato20:02:58

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

metasoarous21:02:38

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

metasoarous21:02:53

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

metasoarous21:02:46

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

paul.legato21:02:00

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

metasoarous21:02:23

For atoms, it will have to render completely

metasoarous21:02:46

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

metasoarous21:02:24

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

paul.legato21:02:27

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

paul.legato21:02:39

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

paul.legato21:02:06

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

metasoarous21:02:18

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

metasoarous21:02:43

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

metasoarous21:02:50

For one, there will be less react rendering

metasoarous21:02:11

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

metasoarous21:02:28

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

metasoarous21:02:01

The webgl rendered may be helpful for you though

metasoarous21:02:39

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