Skip to content

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

Merged
josef-pkt merged 1 commit into
statsmodels:masterfrom
njsmith:matrix-rank-once-is-enough
Jul 20, 2018
Merged

josef-pkt merged 1 commit into
statsmodels:masterfrom
njsmith:matrix-rank-once-is-enough

Conversation

@njsmith

@njsmith njsmith commented Jul 20, 2018

Copy link
Copy Markdown
Contributor

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

coveralls commented Jul 20, 2018 •

Copy link
Copy Markdown

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
Copy Markdown

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
Copy Markdown
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.

4 participants