LogisticRegression spends a lot of time in exp and log1p
See original GitHub issueSomething like 200s in comparison to the 13s spent in .dot
/ matvec. This is from looking at the profiler after running through the dask-glm example notebook.
Is it normal to spend so much time in scalar functions? Are there approximations that make sense to do?
This is low priority from my perspective (there is plenty more to do) but I thought I’d record it.
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Logistic Regression. Introduction | by Dasaprakash K | Medium
In Logistic Regression, we will apply the linear approximation as we did ... they usually spend most of their time developing a basic...
Read more >'Logit' of Logistic Regression; Understanding the Fundamentals
At the very beginning of my journey to learn fundamentals of machine learning, I remember spending a lot of time in clearly understanding ......
Read more >python divide by zero encountered in log - logistic regression
I'm trying to implement a multiclass logistic regression classifier that distinguishes between k different classes. This ...
Read more >Practical Guide to Logistic Regression
I have spent many years teaching logistic regression, using logistic- ... If we repeat the modeling analysis a very large number of times,...
Read more >Accurately Computing log(1 - exp(.)) – Assessed by Rmpfr
1. Introduction: Not log() nor exp(), but log1p() and expm1(). In applied mathematics, it has been known for a very long time that...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I don’t think I’d expect this imbalance, but it definitely depends on the number of times each function is called in one training iteration. It looks like we should expect an equal number of calls to
exp
,log
anddot
(at least after a brief look at the source).The motivation for SGD is when the number of examples is much larger than the features for each example. That would be one way to reduce the time for exp/log/dot, but I don’t think it’s directly related to this issue (though it seems relevant). I can look into this.
I’ve done some brief timing with datasets of the same size as the taxicab:
Interpreting the parameters of a severely underfitting model is probably misleading 😉
Also interpreting polynomial features is fine (if the degree is 2 or 3). You can threshold the small weights of a first linear model trained on the full polynomial feature expansion to keep the top 100 or so and refit only on those and interpret them.