data-science

Data science, data analysis, and machine learning in Clojure https://scicloj.github.io/pages/chat_streams/ for additional discussions
2020-07-09T18:22:23.397Z

@chris441 Is it possible to evaluate a string of python with libpython-clj?

2020-07-09T18:40:24.397700Z

What I'm interested in, for the record, is whether I'd be able to make it possible for Oz to execute code blocks of python, as it can with clj code.

2020-07-09T18:57:23.398700Z

You can probably use the eval built-in python function?

jsa-aerial 2020-07-09T19:06:59.400800Z

@metasoarous run-simple-string should do that for you. As an FYI, you will often get faster / better response over on Zulip. That's where Clojure data science folks hang out all the time. For example, there have just been a bunch of changes to TMD.

👍 1
2020-07-09T19:07:28.401Z

LOL; OK... ok...

2020-07-09T19:07:39.401300Z

I know you guys keep telling me I need to get over there.

2020-07-09T19:08:05.401800Z

I've just been dying from "death by a thousand chat apps"

💯 1
2020-07-09T19:08:37.402200Z

@neo2551 @jsa-aerial Thank you both though 🙂

2020-07-09T19:10:26.404200Z

@jsa-aerial the crazy stuff is the speed at which the changes happened lol. I think the idea of having datasets acting like maps of sequence is cool.

jsa-aerial 2020-07-09T19:15:44.407800Z

I'm not so keen on having datasets acting like seqs of maps. As I stated in one of the threads, this is very misleading because they are absolutely nothing like seqs of maps. This 'clojury' kind of interface is handy in someways (for novices) but if you are more a R data.table/dplyr sort (or pandas for that matter) it is confusing. I am moving to just using tablecloth so I don't need to look at this stuff! 😁

❤️ 1
2020-07-09T19:47:50.410400Z

I'm a big fan of seq of maps approach; I realize it's in conflict with pandas, but it's actually the thing I don't like about pandas, so it's fine with me 🙂 Somehow, the approach in R seems more reasonable given that it's an array/vector oriented language; Somehow, the decisions come together in a more comprehensive way to me. In python, it feels in conflict with traditional pythonic programming practices, and that conflict has always bugged me.

💯 1
1
2020-07-09T19:47:57.410600Z

But to each their own 🙂

2020-07-09T19:49:46.411500Z

So using run-simple-string you can only get back a 1 or 0. Any way to get a reference to the last evaluated form?

2020-07-10T18:07:17.423Z

why not just shell out to python if you have straightup python code?

2020-07-10T18:22:26.423200Z

Well, ideally it would be possible to share the same process/environment

2020-07-10T18:22:57.423400Z

It's ok though; I think I can work around it.

🤘 1
2020-07-10T18:23:15.423600Z

Thanks for considering/asking @aaelony!

jsa-aerial 2020-07-10T20:45:09.424100Z

The big reason to use libpython-clj and not just shell out to python, is that you can then interactively work with python from clj/cljs. This is seriously cool and can be extremely useful - when you can get python to actually work...

✔️ 1
2020-07-09T19:52:05.412300Z

I can imagine definging variables in the python code that you might be able to retrieve data from clojure side, but that limits what I was hoping to do somewhat

jsa-aerial 2020-07-09T19:57:56.415800Z

I think Chris in an much early thread about this (what should the interface look like) had a great point. Which was that TMD was adding an important and orthogonal capability to Clojure. As I stated in one of the recent threads, we don't want to start sliding into 'ORM land', which is very similar to this situation: "why not have RDB databases look and act like objects - if you squint enough, they sort of do, and developers will be happier" (until they aren't).

jsa-aerial 2020-07-09T20:03:33.416500Z

Yeah, it sucks - but that's Python for you! ¯\(ツ)

2020-07-09T20:07:33.418900Z

Phooey! Thanks for explaining though. I guess for what I want I'll need to have a function you call from python when you want to render/view something.

jsa-aerial 2020-07-09T20:15:56.421800Z

The way I've been approaching this (R is vastly better at doing it) is to just calculate data on the py side of things and have the result come back to clj/cljs (typically as TMD DS). Then you do any final expl and massaging (say to put it into VGL/VG data shape) in clj/cljs. Not sure if that fits in with what you are doing though