question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

LogisticRegression spends a lot of time in exp and log1p

See original GitHub issue

Something 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:open
  • Created 6 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
stsievertcommented, Mar 7, 2018

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 and dot (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:

screen shot 2018-03-07 at 11 21 56 am
0reactions
ogriselcommented, Mar 9, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found