1
$\begingroup$

I came across this interesting r/statistics post here:

As of the time of writing (Feb 2023) the post is 5 years old, but it is disturbing and makes me thing twice about blindly using sklearn. The top voted comment points to an interesting email thread which led to the deprecation of a sklearn bootstrap method which as it turns out was not in fact a proper bootstrap. The devs removed the method because they were afraid people would use it without checking the code (which you should not have to do IMO) and assuming they were getting a bootstrap. As sklearn is community built as opposed to R which is often built by academic statisticians who will cite articles describing how to implement the code properly R may not be faster but it is more trustworthy. Personally I place a lot of importance on rigor of a model and I don't think simply rushing to RFs and neural nets should be done without trying more interpretable rigorous methods first. This post is from several years ago and I note that python now has the statsmodels module which has really nice documentation, but in playing with it I found there were cases where R had an implementation of something that python simply lacked. It's hard to do power analysis for instance in python, you have to scratch build code.

$\endgroup$

1 Answer 1

1
$\begingroup$

Is it still true that sklearn cannot be trusted for statistics

Sklearn has insisted it is a machine learning library and not a statistics library. There have been a few cases where devs have plainly said so (and even pondered why users would want an unpenalized version of logistic regression).

To measure sklearn against R for statistics is to judge a fish by its ability to climb a tree.

s sklearn is community built as opposed to R which is often built by academic statisticians who will cite articles describing how to implement the code properly

LOL if anything, this is an argument against R. Many (not all) academics are very poor software engineers with poor practices. While the example of the bootstrap in sklearn is notable, they have good software engineering practices from where I stand. I'd trust a project with 100 developers and good unit tests more than I trust one person with no software engineering best practices to speak of.

$\endgroup$
10
  • $\begingroup$ I mean the documentation in R is generally much better than in sklearn. And having worked with lots of CS majors they don't really understand stats and just blithely assume they can copy paste data science scripts or don't benchmark non-parametric methods against more interpretable methods which lend themselves better to making inferences. $\endgroup$ Feb 6 at 23:05
  • $\begingroup$ @AngusCampbell That is different than failing to ensure your code does what you think it does. Many academics are guilty of that. $\endgroup$ Feb 6 at 23:06
  • $\begingroup$ Fair, but can you point to an instance in R similar to the deprecation issue mentioned? $\endgroup$ Feb 6 at 23:06
  • $\begingroup$ scikit-learn-general.narkive.com/CcCsycWg/… $\endgroup$ Feb 6 at 23:07
  • $\begingroup$ @AngusCampbell I don't have one off the top of my head, but a single deprecation does not a bad library make. $\endgroup$ Feb 6 at 23:08

Not the answer you're looking for? Browse other questions tagged or ask your own question.