Skip to content

Cleanup and flake8 fixes for discrete_model - #3792

Closed
jbrockmendel wants to merge 4 commits into
statsmodels:masterfrom
jbrockmendel:discrete_cleanup
Closed

jbrockmendel wants to merge 4 commits into
statsmodels:masterfrom
jbrockmendel:discrete_cleanup

Conversation

@jbrockmendel

Copy link
Copy Markdown
Contributor

Weibull model had been commented-out in its entirety since at least Oct 2012. Deleted it.

Removed duplicate and unused imports. Arranged imports by source

Fixed docstring indentation and some comments in __main__ that were not indented. This is useful because it allows for code-folding in some IDEs.

Changed MultinomialResults._get_endog_name to avoid built-in name all in favor of use_all.
Used pandas.util.decorators.deprecate_kwarg to keep this backward-compatible. As a private
method, this should not matter much.

MultinomialResults._maybe_convert_ynames_int never uses self, so does not need to be a method. Moved it out to be a private module-level function.

Added shebang.

Left untouched a large number of pep8 complaints of the form:
statsmodels/discrete/discrete_model.py:3096:25: E231 missing whitespace after ','

This PR is very nearly substance-free. Before long I'll be putting together a substantial MNLogit PR, separating this out to keep the scopes narrow.

Weibull model had been commented-out in its entirety since at least Oct 2012.  Deleted it.

Removed duplicate and unused imports.  Arranged imports by source

Fix docstring indentation and some comments in __main__ that were not indented
This is useful because it allows for code-folding in many IDEs.

Changed MultinomialResults._get_endog_name to avoid built-in name 'all' in favor of 'use_all'.
Use pandas.util.decorators.deprecate_kwarg to keep this backward-compatible.  As a private
method, this should not matter much.

MultinomialResults._maybe_convert_ynames_int never uses , so does not need to be a method.  Moved
it out to be a private module-level function.

Add shebang
@josef-pkt

Copy link
Copy Markdown
Member

this could potentially have a lot of merge conflicts after #3727 is merged

@coveralls

coveralls commented Jun 27, 2017 •

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.003%) to 90.54% when pulling 15d761c on jbrockmendel:discrete_cleanup into 1c7f487 on statsmodels:master.

@jbrockmendel

Copy link
Copy Markdown
Contributor Author

The differences look pretty minor to me, largely because #3727 adds more code than it edits.

The biggest difference is the __main__ block getting deleted there but not here. I prefer the straight-out-delete option, so am happy to make that edit.

There may be a whitespace merge conflict in the imports, but nothing non-trivial.

The only genuine conflict I see is that this PR replaces lm.RegressionResultsWrapper with importing RegressionResultsWrapper directly. I'd be willing to revert this change in the name of expediency.

@jbrockmendel

Copy link
Copy Markdown
Contributor Author

Rebased and de-conflicted following merge of #3795

@@ -324,7 +340,7 @@ def fit_regularized(self, start_params=None, method='l1',
try:
kwargs['alpha'] = alpha
except TypeError:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would trigger a TypeError here?

# lm.RegressionResultsWrapper._wrap_methods,
#_wrap_methods = wrap.union_dicts(
# RegressionResultsWrapper._wrap_methods,
# _methods)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just delete these commented-out _methods and _wrap_methods entirely?

@coveralls

coveralls commented Jul 9, 2017 •

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.002%) to 90.862% when pulling 2ae4440 on jbrockmendel:discrete_cleanup into 359f08b on statsmodels:master.

@josef-pkt

Copy link
Copy Markdown
Member

I have one last PR for discrete, for now, to merge #3928 then I think this should go in.
I also started line length fixes in test_discrete, but there are too many and they would have messed up the #3928 PR changeset by adding too much noise.

@josef-pkt

josef-pkt commented Sep 25, 2017 •

Copy link
Copy Markdown
Member

I think the Weibull example could be copied to an issue. Deletion is fine, I doubt it will come back to the same module or in closely related form.
I'm not familiar with it, but it might provide some ideas for enhancements.
E.g. the open hurdle count PR uses a right censored at 1, binary Poisson which sounds a bit similar, at least superficially.

@josef-pkt

Copy link
Copy Markdown
Member

This pull request introduces 1 alert and fixes 15 - view on lgtm.com

new alerts:

  • 1 for Module-level cyclic import

fixed alerts:

  • 15 for Module-level cyclic import

Comment posted by lgtm.com

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.002%) to 81.546% when pulling 35faed8 on jbrockmendel:discrete_cleanup into 687d807 on statsmodels:master.

1 similar comment
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.002%) to 81.546% when pulling 35faed8 on jbrockmendel:discrete_cleanup into 687d807 on statsmodels:master.

@codecov-io

codecov-io commented Sep 25, 2017 •

Copy link
Copy Markdown

Codecov Report

Merging #3792 into master will increase coverage by 0.2%.
The diff coverage is 95.91%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #3792     +/-   ##
=========================================
+ Coverage   79.06%   79.27%   +0.2%     
=========================================
  Files         542      543      +1     
  Lines       80940    81954   +1014     
  Branches     9199     9415    +216     
=========================================
+ Hits        63997    64968    +971     
- Misses      14853    14888     +35     
- Partials     2090     2098      +8
Impacted Files Coverage Δ
statsmodels/discrete/discrete_model.py 88.05% <95.91%> (+0.19%) ⬆️
statsmodels/tsa/statespace/tests/test_models.py 76.88% <0%> (-14.61%) ⬇️
...models/tsa/statespace/tests/test_dynamic_factor.py 96.55% <0%> (-1.41%) ⬇️
statsmodels/tools/tests/test_numdiff.py 98.39% <0%> (-0.53%) ⬇️
statsmodels/base/model.py 82.64% <0%> (-0.15%) ⬇️
statsmodels/tsa/tests/test_seasonal.py 100% <0%> (ø) ⬆️
statsmodels/sandbox/distributions/gof_new.py 0% <0%> (ø) ⬆️
statsmodels/sandbox/stats/multicomp.py 33.63% <0%> (ø) ⬆️
statsmodels/sandbox/distributions/mv_normal.py 38.97% <0%> (ø) ⬆️
statsmodels/sandbox/tsa/garch.py 0% <0%> (ø) ⬆️
... and 17 more

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 ad70c62...db270b3. Read the comment docs.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.03%) to 81.624% when pulling db270b3 on jbrockmendel:discrete_cleanup into ad70c62 on statsmodels:master.

@josef-pkt

Copy link
Copy Markdown
Member

This pull request introduces 1 alert and fixes 15 - view on lgtm.com

new alerts:

  • 1 for Module-level cyclic import

fixed alerts:

  • 15 for Module-level cyclic import

Comment posted by lgtm.com

@jbrockmendel jbrockmendel mentioned this pull request Oct 7, 2017
@jbrockmendel

Copy link
Copy Markdown
Contributor Author

cleaning up code smells not a priority. closing.

@coveralls

coveralls commented Oct 22, 2017 •

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.1%) to 81.779% when pulling db270b3 on jbrockmendel:discrete_cleanup into ad70c62 on statsmodels:master.

@jbrockmendel

Copy link
Copy Markdown
Contributor Author

Fixes 15 alerts... don't know what that means, but it sure sounds like a good thing.

@jbrockmendel
jbrockmendel deleted the discrete_cleanup branch September 21, 2018 03:41
@bashtage bashtage added the rejected Used for PRs with changes that are not acceptable label Jul 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rejected Used for PRs with changes that are not acceptable

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants