In this analysis I compare the runtimes of different methods to fit an ordinary least squares regression model. I fit a multivariate normal random sample using Scikit-Learn’s Linear Model module, statsmodels’ sm module, and with simple matrix multiplication. The result was three clear runtime distributions with simple matrix multiplication having the fastest mean runtime, followed by the Scikit-Learn then statsmodels methods. The results suggest that the most computationally efficient method for fitting ordinary least squares regression models with 0 intercept is using Numpy’s vectorized matrix multiplication. However, in practice, the average runtimes differ by hundredths of seconds so the relevant efficiency gains may be negligible.
-
Notifications
You must be signed in to change notification settings - Fork 0
raytighe/linear_regression_speeds
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
A comparison of runtimes to fit OLS regression models using different Python libraries (Scikit-learn, statsmodels, Numpy matrix multiplication)
Topics
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published