Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only compute matrix_rank(exog) once in DiscreteModel.initialize #4805

Merged
merged 1 commit into from Jul 20, 2018

Conversation

njsmith
Copy link
Contributor

@njsmith njsmith commented Jul 20, 2018

I was confused about why a script was taking >20% of total running
time inside DiscreteModel.initialize. It turns out that computing the
rank of exog can be pretty slow! It does seem vary a lot depending on
BLAS and threading settings, e.g. I get wildly different results for
OpenBLAS vs. MKL and OMP_NUM_THREADS=1 versus not. So part of the
issue is probably hitting pathological edge cases in BLAS libraries.

But there's definitely no reason to compute the rank twice in the
same function.

I was confused about why a script was taking >20% of total running
time inside DiscreteModel.initialize. It turns out that computing the
rank of exog can be pretty slow! It does seem vary a lot depending on
BLAS and threading settings, e.g. I get wildly different results for
OpenBLAS vs. MKL and OMP_NUM_THREADS=1 versus not. So part of the
issue is probably hitting pathological edge cases in BLAS libraries.

But there's definitely no reason to compute the rank *twice* in the
same function.
@coveralls
Copy link

coveralls commented Jul 20, 2018

Coverage Status

Coverage increased (+0.0002%) to 83.666% when pulling c298e3e on njsmith:matrix-rank-once-is-enough into 4969cd9 on statsmodels:master.

@codecov-io
Copy link

Codecov Report

Merging #4805 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4805      +/-   ##
==========================================
+ Coverage   81.12%   81.12%   +<.01%     
==========================================
  Files         581      581              
  Lines       89847    89848       +1     
  Branches    10035    10035              
==========================================
+ Hits        72887    72888       +1     
  Misses      14681    14681              
  Partials     2279     2279
Impacted Files Coverage Δ
statsmodels/discrete/discrete_model.py 87.94% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4969cd9...c298e3e. Read the comment docs.

@josef-pkt
Copy link
Member

@njsmith Thanks,
obvious fix, merging

@josef-pkt josef-pkt merged commit f94f26f into statsmodels:master Jul 20, 2018
@josef-pkt josef-pkt added this to the 0.10 milestone Sep 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants