4 ms·
A problem with Python is the lack of a "best practices" style for scientific computing. I find it amazing that Linear Regression in scikit-learn doesn't retur
by thanatropism 8y ago
A problem with Python is the lack of a "best practices" style for scientific computing.
I find it amazing that Linear Regression in scikit-learn doesn't return standard errors/t-scores for the coefficients. (These can be useful for model selection, for example). I know about statsmodels and pysal, but the workflow with these is already slightly different.
- apohn 8y ago>I find it amazing that Linear Regression in scikit-learn doesn't return standard errors/t-scores for the coefficients. It's less surprising when you see how some people work with these types of models in Python. They minimize the prediction errors, and if another method has lower error than Linear Regression they use that. There's very limited thinking around diagnosing why a model is not working or modeling at all. As nerdponx pointed out, this is completely opposite to how social scientists or statisticians do modeling work for research. The goal is to support or provide evidence against a hypothesis that has a theoretical basis. You cannot do that by just focusing on minimizing prediction error. Linear Regression in R vs Python is great example of how simple functionality like print(lm) and plot(lm) exposes the different ways of thinking about how to approach a problem. R's lm() provides strong diagnostic functionality out of the box with a few commands, which support people who are focused on diagnosing a model and making adjustments to how the model is defined, not just doing basic transforms (e.g. log) and adjusting hyperparamters to minimize prediction error.
- nerdponx 8y agoI find it amazing that Linear Regression in scikit-learn doesn't return standard errors/t-scores for the coefficients Case in point! You don't typically need those for machine learning, so why bother with them in a machine learning toolkit/library?
- j7ake 8y agoYou don't need them if you don't need to diagnose your analysis. But the hard part is of course thinking about why your model doesn't work, which is the strength of R.
- ehudla 8y agoI agree. Even if someone wants to swim against the current and use Python instead of R in these context, it is very hard to do and get publication quality results unless you have plenty of time and really know what you are doing. Since scientists are busy people, it makes sense to just follow the crowd and use R, which is a shame.
- sin7 8y agoWhy is it a shame to use R? R is not inferior to Python. Perhaps for general programming, but for stats and visualization, R is the gold standard.