News for hackers. Stuff that matters.
Re:Every modeler is supposed to be a great Python programmer by FridgeSeal on Thursday December 08, 2022 @06:17PM (#33915136)
> every one of them wants Python. I haven’t seen a single one where they’re looking for R or even C++; Python rules this roost.

Tried putting R into production recently? It’s a frustrating and brittle experience. Don’t get me wrong, R is fantastic at what it does - analysis, research, statistics, and arguably the API’s on the R data frame packages are a lot saner than Pandas.

C++ is out for different reasons I suspect. As this touches on, “modellers” (and data scientists/engineers) ought to be decent developers, but a lot of them are not, and in my experience actively refuse to learn any of these skills, the comfort zone is “jupyter notebooks” and that’s it. Getting them to write C++ (disregarding language debates), a language that is unequivocally more difficult and fraught with complexity than Python is basically a non-starter.

Do I wish it was different? Yep. Do I wish there was some more variety in the “language ecosystem” so it’s more than just the “lowest common denominator Python” dominance? Absolutely.

Re:Every modeler is supposed to be a great Python programmer by fbdab103 on Thursday December 08, 2022 @08:59PM (#33916439)
>Tried putting R into production recently? It’s a frustrating and brittle experience.

Oh man, can I sign onto this rant. While Python has spent a decade+ trying-and-failing to standardize on one of a dozen tools to properly manage dependencies, at least it is trying. R is still global-namespace, no-pinning by default. Sorta-kinda you can squint where renv is going, but still needs a lot of development.

I had some hopes of Julia stealing the R mindshare and righting some of the more egregious wrongs in that ecosystem, but (as an outsider) it feels like Julia has lost a lot of steam.

Re:Every modeler is supposed to be a great Python programmer by lukego on Friday December 09, 2022 @12:04AM (#33917667)
I find it really painless to put bits of R into production using the Nix support: https://nixos.org/manual/nixpkgs/stable/#r

The same framework can provide an identical-to-production R or RStudio environment for development.

I have a harder time with Julia since its tooling is more opinionated. I don't know a better solution than wrapping it in a Docker container.

Re:Every modeler is supposed to be a great Python programmer by fbdab103 on Friday December 09, 2022 @12:13AM (#33917748)
If the cure for R is that I need to jump fully into the Nix ecosystem, I am not sure that is a solution.

Disappointing about Julia. Only played with it a small bit, but I had assumed it had identified dependency management as a huge problem that needed to be addressed.

Re:Every modeler is supposed to be a great Python programmer by FridgeSeal on Friday December 09, 2022 @12:49AM (#33917999)
Julia’s package management is miles ahead of R, and bests Python’s on a large number of factors. However the last time I used it, it still required you to issue commands into the repl to setup your packages. However, that might have been resolved by now? The language and tooling clips along at a pretty good pace.
Re:Every modeler is supposed to be a great Python programmer by Hasnep on Friday December 09, 2022 @01:12AM (#33918133)
You can now set up a Julia environment non-interactively from the command line by running:

    julia --project=. -e 'import Pkg; Pkg.instantiate()'
Not as clean as running

    python -m pip install -r requirements.txt
but it's something.
Re:Every modeler is supposed to be a great Python programmer by sundarurfriend on Friday December 09, 2022 @07:51AM (#33920655)
I find the flexibility of being able to setup and switch environments from within the REPL very enabling, and the Python approach of using the command-line shell feels kinda messy and cobbled together to me. (I felt this way about the Python approach before I even came across Julia, by the way.)

That said, there is a command-line utility jlpkg [1] that makes package management available from the shell. It's not very widely used, but maybe it suits your needs.

Although, the way you phrased

> it still required you to issue commands into the repl to setup your packages

makes me think maybe you didn't know about the Pkg mode in the REPL, and assumed you had to do everything with commands like `Pkg.add("DataFrames"); Pkg.update()` and such? If so, there's a package management mode to the REPL you can access with the ] key, which is kind of its own subshell within the REPL where you can do `add DataFrames`, `update`, and such instead.

[1] https://github.com/fredrikekre/jlpkg

Re:Every modeler is supposed to be a great Python programmer by FridgeSeal on Friday December 09, 2022 @05:43PM (#33927396)
I’m well aware of pkg mode in the repl, wasn’t aware of jlpkg though, that seems good.
Re:Every modeler is supposed to be a great Python programmer by FridgeSeal on Thursday December 08, 2022 @11:15PM (#33917362)
> Oh man, can I sign onto this rant.

Please, be my guest hahaha.

I think my issue with so many of these tools is that they’re fundamentally meant to be used interactively. R (renv/etc) doesn’t have a package manager separate from the runtime, so you can’t just “yarn/pip/cargo/etc install” and have your dependencies setup prior to your script running, you have to invoke manual R commands and hope everything goes off ok, it doesn’t spontaneously pick a different directory to install your stuff in, or have a tantrum about permissions because it wants to install in some root dir.

Re:Every modeler is supposed to be a great Python programmer by Bootvis on Friday December 09, 2022 @08:17AM (#33920897)
Just use renv (successor of packrat). I had multiple versions of R working with multiple versions of Shiny running in production.
Re:Every modeler is supposed to be a great Python programmer by fbdab103 on Friday December 09, 2022 @07:48PM (#33928509)
As I alluded to, renv exists, but it requires a lot of development work before it is a comparably robust option for the ecosystem. Basic things like a command-line interface [0], working with non-CRAN repos [1], using an existing DESCRIPTION file [2], etc. There are many use cases where renv does not work in a corporate environment (ie not open-source all public code scenarios). Some of those issues have been open for years.

I do not believe the situation is unsolvable, but there is significant work to be done. Renv provides value today, and I will encourage everyone to use it. However, it has significant blind spots which continue to make R deployments challenging.

[0] https://github.com/rstudio/renv/issues/1055 [1] https://github.com/rstudio/renv/issues/471 [2] https://github.com/rstudio/renv/issues/233

Re:Every modeler is supposed to be a great Python programmer by Tcepsa on Thursday December 08, 2022 @09:15PM (#33916550)
I believe that is one of the points the author of the article is trying to make: that the data scientists ought to be able to work in whatever language lets them develop the model most quickly and then hand it over to a software developer to make it work well in code, so that each can focus on doing what they do best and both aspects can be done very well.
Re:Every modeler is supposed to be a great Python programmer by bigger_cheese on Thursday December 08, 2022 @08:20PM (#33916171)
I work in an Industrial smelter (I'm a Materials/Chem Eng I look at outputs of models don't have a lot to do with developing them) the way the data pipelines are setup here the models are deployed as something called a "pickle file" I think this is something very specific to Python - maybe the equivalent would be a .dll file in C++ world.

From point of view of the integration process the pickle file is just a black box input data flows in, response flows out of it. If something changes with the model (trained it on a new dataset etc.) then it's just a matter of drop in a new pickle file and it all keeps working.

I don't know if you can do the equivalent with packaging R code like this. All of the tooling is setup around Python and I think this is pretty industry standard we use Azure and I'm pretty sure this is all out of the box stuff.

Re:Every modeler is supposed to be a great Python programmer by GeneralMayhem on Thursday December 08, 2022 @08:34PM (#33916269)
Pickles and .dlls solve completely different purposes. A .dll, which stands for "dynamic link library", is code - it's how you package parts of your implementation in certain environments (Windows). A pickle file is data - it's a way of serializing out the contents of the state of a data structure, using some magic built into Python reflection, and then loading it back later.

Pickling is very convenient for its purpose. It's also... very bad in production. The problem is that the serialization format is derived from the implementation and not very stable, so if the implementation changes - sometimes in subtle ways like upgrading your Python version - the serialized data isn't readable anymore. You're almost always better off either using an explicit data serialization format (JSON with schemas, protocol buffers, etc.) and writing your own logic for saving and restoring to/from it.

> the pickle file is just a black box input data flows in, response flows out of it

There's 100% more to it than that - there's got to be something that's evaluating the data in the pickle file and actually using it to compute the response. That substrate layer probably doesn't change often, but it should have its own versioning and deployment story.

Re:Every modeler is supposed to be a great Python programmer by fbdab103 on Thursday December 08, 2022 @10:47PM (#33917185)
>the serialization format is derived from the implementation and not very stable, so if the implementation changes - sometimes in subtle ways like upgrading your Python version - the serialized data isn't readable anymore.

Could be wrong, but I do not believe this is true anymore. There are pickle versions, but I believe the format has been standardized such that you should be able to freely move between Python releases.

Re:Every modeler is supposed to be a great Python programmer by jononor on Friday December 09, 2022 @03:19AM (#33918932)
The base serialization is stable and compatible across Python versions. However pickle files can serialize entire Python objects, including from custom and third party code. Compatibility of serialization then depends on the versions of the code that implements those objects, which is often not well managed.
Re:Every modeler is supposed to be a great Python programmer by fbdab103 on Friday December 09, 2022 @07:37PM (#33928430)
Ah that's fair. I was only considering serializing native types (for which there are much better options).
Re:Every modeler is supposed to be a great Python programmer by bigger_cheese on Thursday December 08, 2022 @09:42PM (#33916749)
> There's 100% more to it than that - there's got to be something that's evaluating the data in the pickle file and actually using it to compute the response.

I suspect that is the Microsoft Azure ML part I'm not sure. As I said I don't write the models, I just come along afterwards and review the results. I don't know anything about Python.

Re:Every modeler is supposed to be a great Python programmer by goosedragons on Thursday December 08, 2022 @08:42PM (#33916329)
I think the R equivalent of a pickle file is just an object(s) that's been saved with "save" or "saveRDS" to a file. These can then be loaded and could contain a trained model.
Re:Every modeler is supposed to be a great Python programmer by kgwgk on Friday December 09, 2022 @02:20AM (#33918583)
> something called a "pickle file" I think this is something very specific to Python - maybe the equivalent would be a .dll file in C++ world.

The equivalent would be a .dat file :-)

Re:Every modeler is supposed to be a great Python programmer by andy800 on Friday December 09, 2022 @02:55AM (#33918803)
> wish there was some more variety

Kotlin is coming up on the outside. Late to the party, but the data science ecosystem is progressing nicely.

Re:Every modeler is supposed to be a great Python programmer by hdespiritu on Wednesday December 14, 2022 @11:27AM (#33985813)
This is an interesting observation. Some of the data scientists I work with have been using Kotlin to define "analytic grammars", and is the first example (in my limited Kotlin awareness) i've seen of Kotlin outside of Android development.

It seems that Roman Elizarov (Kotlin Project Lead) has identified the opportunity for a better language ecosystem to enter the data science space

https://discuss.kotlinlang.org/t/ai-and-deep-learning-define...

Re:Every modeler is supposed to be a great Python programmer by pjmlp on Friday December 09, 2022 @04:38AM (#33919452)
CERN started diving into Python back in 2002, I was part of one of the first trainings that were taking place.

Same applies to many other research institutions.

Good luck catching up with a 20 years old ecosystem, with a language that only gets used mainly thanks to Google's sponsorhip for Android apps.

Re:Every modeler is supposed to be a great Python programmer by andy800 on Wednesday December 14, 2022 @08:35PM (#33993828)
Kind of ignorant... given that Kotlin is JVM-compatible, it works with libraries even more than 20 years old.

Do I care if it is at parity with Python? Hell no I don't, as long as it allows me to accomplish the tasks I need -- and it does, faster, easier, with fewer errors -- then I'm very happy.