Live data from Hacker News

Statistical Physics with R: Ising Model with Monte Carlo

github.com

61–70 of 70 posts

Re: Statistical Physics with R: Ising Model with Monte Carlo

#61

Earlier quoted context omitted.

I love and use R, but it never became the dominant ML in part because it has three (or more) different object systems and many libraries sort of use their own style. This makes it seem a bit disjointed, in a way that other languages don’t. The R community should have anointed one object system and made tidyverse a core part of R. All that said, R is fantastic and the depth of libraries is extensive. Libs are often wr…

> The R community should have anointed one object system > and made tidyverse a core part of R. Not a tidyverse fan. It doesn't scale well. Learn data.table, which has a much more R-like interface and is fast fast fast even for large data sizes. More powerful and more expressive than pandas, and again, faster See https://cran.r-project.org/web/packages/data.table/vignettes...

And if you still prefer the language of tidyverse, use tidytable and you get the best of both worlds!

Re: Statistical Physics with R: Ising Model with Monte Carlo

#62

Earlier quoted context omitted.

How is Julia in terms of data science dev experience? Nothing ever felt as good as the R+tidyverse combo to me, at least in Python.

Julia is pretty good at basic data science. Working with dataframes is comparable to R's data.tables with the benefit that I don't need to switch languages if I want to run a fast loop over some data as part of a calculation or use a custom data structure. I'm not a fan of pandas, so I'd say Julia and R beat python at basic dataframe manipulation. Nothing beats kdb+/q at dataframes though imo.

Have you tried Polars in Python? When you get going it's pretty similar to tidyverse, except you're chaining methods instead of piping, and it's lazily evaluated + parallel because of the underlying Rust engine. IME it's tidyverse > polars > pandas > data.table in terms of ergonomics

Re: Statistical Physics with R: Ising Model with Monte Carlo

#63
post #55

Earlier quoted context omitted.

People have also used “statistical physics” to refer to the former concept since forever. For example Landau. “Statistical mechanics” is also used in a broad sense, just like “quantum mechanics” is often used for anything “quantum”.

What I'm getting from this discussion is that we use Statistical Physics to refer to anything covered by Statistical Physics AND Statistical Mechanics, while we use Statistical Mechanics in a narrower context, but it is also possible that some use SM loosely.

> it is also possible that some use SM loosely

I think it’s frequent. For example: https://teach-me-codes.github.io/computational-physics/the_p...

Re: Statistical Physics with R: Ising Model with Monte Carlo

#64

Earlier quoted context omitted.

I love and use R, but it never became the dominant ML in part because it has three (or more) different object systems and many libraries sort of use their own style. This makes it seem a bit disjointed, in a way that other languages don’t. The R community should have anointed one object system and made tidyverse a core part of R. All that said, R is fantastic and the depth of libraries is extensive. Libs are often wr…

> The R community should have anointed one object system > and made tidyverse a core part of R. Not a tidyverse fan. It doesn't scale well. Learn data.table, which has a much more R-like interface and is fast fast fast even for large data sizes. More powerful and more expressive than pandas, and again, faster See https://cran.r-project.org/web/packages/data.table/vignettes...

I think these days it might be wiser to use r-polars, in the very least because it has more available documentation around it.

Re: Statistical Physics with R: Ising Model with Monte Carlo

#65
post #3

R ecosystem provides amazing reproducible research ecosystem, even for statistical physics.

I wonder how close R was to also take over the scientific computing/machine learning space, instead of Python's numpy/scipy ecosystem.

I think that early on, people started using Python because they liked the language, before they used it for numerical computation. Many people were satisfied with an installation of Matlab, C, or whatever, on their desks. But they started using Python as a scripting language, before asking: Wouldn't it be nice if we could use Python for everything?

For instance in my own case, my first use of Python was outside of mainstream scientific computing. I needed something to install on lab computers, for data acquisition and automation. And it needed to be free because my employer was under a spending freeze after the 2008 financial meltdown. Oh, and I also wanted something for hobby projects, that would be equally at home on Windows or Linux.

So I think the quality of the language came first.

Re: Statistical Physics with R: Ising Model with Monte Carlo

#66
post #57

Earlier quoted context omitted.

I love and use R, but it never became the dominant ML in part because it has three (or more) different object systems and many libraries sort of use their own style. This makes it seem a bit disjointed, in a way that other languages don’t. The R community should have anointed one object system and made tidyverse a core part of R. All that said, R is fantastic and the depth of libraries is extensive. Libs are often wr…

I have a feeling that most data scientists using R have no need to touch any of the object systems, hard to believe that would be a deal breaker.

> most data scientists

It's hard to generalise for all data scientists everywhere, but that is not my experience.

Data transformation (80% of the job) is very functional and so objects systems don't matter much.

But when you are training neural nets in Python you are probably using a framework of some type. Torch in R looks very object orientation'y .

The issue is not that object orientation is fundamentally needed for data science, but when you install a random object orientated R library you get a random R object system or pseudo-object system that needs to be reasoned about.

It is a pity R didn't just ditch object systems or adopt a limited simple system like Lua's table approach.

Re: Statistical Physics with R: Ising Model with Monte Carlo

#67

Earlier quoted context omitted.

I love and use R, but it never became the dominant ML in part because it has three (or more) different object systems and many libraries sort of use their own style. This makes it seem a bit disjointed, in a way that other languages don’t. The R community should have anointed one object system and made tidyverse a core part of R. All that said, R is fantastic and the depth of libraries is extensive. Libs are often wr…

Agree 100% on tidyverse becoming part of the standard library. Some of the language's greatest libraries (like Hyndman's forecasting stuff) basically assume you're using tidyverse already

Screw that. I do everything that tidyverse does with the standard library already. No clue why the wheel had to be reinvented just to make a plot.

Re: Statistical Physics with R: Ising Model with Monte Carlo

#69
post #10

Earlier quoted context omitted.

It was never close. Its synthax is unintuitive and painful to learn as a science undergrad. If it hadn't been python it would have been another language.

This is obviously a personal thing but tidyverse syntax is great and lends itself very well to clear and concise data operations.

I found base R even easier than tidyverse. Geom?? Puke. Just call the plot function you want from the standard library. Everything is just function(arg1=x, arg2=y). Easy.

Re: Statistical Physics with R: Ising Model with Monte Carlo

#70
post #12
post #7

Earlier quoted context omitted.

R is really not for production deployment. It lacks a lot of what made python popular, and its target users were radically different.

R was developed for and by statisticians, for better and worse. I used R a little bit 15-20 years ago, what I remember was that quite a few libraries and function interfaces seemed to be designed to be convenient for interactive use, but if you tried to use them in an automated script, e.g. some analysis you wanted to scale up and repeat 10,000 times while bootstrap sampling or hyperparameter sweeping or what have yo…

I think what people miss about R is that if you go on with an object oriented for loop way of writing code like a lot of python devs tend to do, you are going to have a bad time. You write functional code and make use of various apply functions instead of loops, it’s going to be very performant. A lot of it is wrapping C.
Post reply on HN