Skip to content

DOC: add to rst docs, fix docstrings - #8559

Merged
josef-pkt merged 5 commits into
statsmodels:mainfrom
josef-pkt:misc
Dec 6, 2022
Merged

josef-pkt merged 5 commits into
statsmodels:mainfrom
josef-pkt:misc

Conversation

@josef-pkt

Copy link
Copy Markdown
Member

various small fixes from roadmap 0.14 list

adds MQuantileNorm and ECDFDiscrete to rst docs

@josef-pkt josef-pkt added this to the 0.14 milestone Dec 5, 2022
@josef-pkt

Copy link
Copy Markdown
Member Author

two unrelated failures in statsmodels/tsa/statespace/tests/test_weights.py in WindowsTest python311_win_latest

I might look for a few more small cleanups for this PR

@josef-pkt

josef-pkt commented Dec 5, 2022 •

Copy link
Copy Markdown
Member Author

looking at some test noise warnings
some are expected warnings and can be silenced
(others like convergence warnings and runtime warnings need investigation)

statsmodels/stats/tests/test_influence.py: 26 warnings
  /home/vsts/work/1/s/statsmodels/genmod/generalized_linear_model.py:896: DeprecationWarning: linear keyword is deprecated, use which="linear"
    warnings.warn(msg, DeprecationWarning)

statsmodels/genmod/families/tests/test_family.py::test_invalid_family_link[NegativeBinomial-links5]
statsmodels/genmod/families/tests/test_family.py::test_family_link[NegativeBinomial-links5]
statsmodels/sandbox/tests/test_gam.py::TestGAMNegativeBinomial::test_predict
  /home/vsts/work/1/s/statsmodels/genmod/families/family.py:1316: UserWarning: Negative binomial dispersion parameter alpha not set. Using default value alpha=1.0.
    warnings.warn("Negative binomial dispersion parameter alpha not "


statsmodels/regression/tests/test_regression.py::TestOLS::test_summary_slim
  /opt/hostedtoolcache/Python/3.10.8/x64/lib/python3.10/site-packages/scipy/stats/_stats_py.py:1772: UserWarning: kurtosistest only valid for n>=20 ... continuing anyway, n=16
    warnings.warn("kurtosistest only valid for n>=20 ... continuing "


statsmodels/stats/tests/test_descriptivestats.py::test_description_basic
statsmodels/stats/tests/test_descriptivestats.py::test_empty_columns
statsmodels/stats/tests/test_descriptivestats.py::test_empty_columns
  /opt/hostedtoolcache/Python/3.10.8/x64/lib/python3.10/site-packages/numpy/core/fromnumeric.py:3432: RuntimeWarning: Mean of empty slice.
    return _methods._mean(a, axis=axis, dtype=dtype,

@josef-pkt

Copy link
Copy Markdown
Member Author
statsmodels/stats/tests/test_influence.py: 26 warnings
  /home/vsts/work/1/s/statsmodels/genmod/generalized_linear_model.py:896: DeprecationWarning: linear keyword is deprecated, use which="linear"
    warnings.warn(msg, DeprecationWarning)

tracing this warning:
GLMInfluence uses the old get_prediction based on linear keyword. This causes some of those DeprecationWarning.
refactoring might be a bit tricky because I want to maintain backwards compat during deprecation of linear
merged PR for GLM predict "which" is #8505

I silence them in MLEInfluence class _get_prediction

@lgtm-com

lgtm-com Bot commented Dec 6, 2022

Copy link
Copy Markdown

This pull request fixes 1 alert when merging e374e78 into 9e47d91 - view on LGTM.com

fixed alerts:

  • 1 for Comparison using is when operands support `__eq__`

Heads-up: LGTM.com's PR analysis will be disabled on the 5th of December, and LGTM.com will be shut down ⏻ completely on the 16th of December 2022. It looks like GitHub code scanning with CodeQL is already set up for this repo, so no further action is needed 🚀. For more information, please check out our post on the GitHub blog.

@josef-pkt

Copy link
Copy Markdown
Member Author

needed a rebase, merge conflict with tweedie PR

I'm giving up here, benefit is small relative to time used

@lgtm-com

lgtm-com Bot commented Dec 6, 2022

Copy link
Copy Markdown

This pull request fixes 1 alert when merging 156a389 into 9e47d91 - view on LGTM.com

fixed alerts:

  • 1 for Comparison using is when operands support `__eq__`

Heads-up: LGTM.com's PR analysis will be disabled on the 5th of December, and LGTM.com will be shut down ⏻ completely on the 16th of December 2022. It looks like GitHub code scanning with CodeQL is already set up for this repo, so no further action is needed 🚀. For more information, please check out our post on the GitHub blog.

@josef-pkt

josef-pkt commented Dec 6, 2022 •

Copy link
Copy Markdown
Member Author

strange unit test fail on the is -> == change for negbin family
Do we really need is?

   def __init__(self, link=None, alpha=1.):
        self.alpha = 1. * alpha  # make it at least float
        if alpha == self.__init__.__defaults__[1]:
>           warnings.warn("Negative binomial dispersion parameter alpha not "
                          f"set. Using default value alpha={alpha}.")
E           UserWarning: Negative binomial dispersion parameter alpha not set. Using default value alpha=1.0.

..\eclipse-workspace\statsmodels_gh\statsmodels\statsmodels\genmod\families\family.py:1316: UserWarning

note small integers in python are singletons, all have the same id, e.g. https://stackoverflow.com/questions/306313/is-operator-behaves-unexpectedly-with-integers
however, float are not singleton and id(1.) changes on repeated calls.
So it looks like we can use is, id check, to see whether the user changed the default even if it's the same number 1..

I will do an interactive rebase to edit out the change from the "CodeQL" commit

def __init__(self, link=None, alpha=1.):
self.alpha = 1. * alpha # make it at least float
if alpha is self.__init__.__defaults__[1]:
if alpha is self.__init__.__defaults__[1]: # `is` is intentional

Check warning

Code scanning / CodeQL

Comparison using is when operands support `__eq__`

Values compared using 'is' when equivalence is not the same as identity. Use '==' instead.
@josef-pkt

Copy link
Copy Markdown
Member Author

all green
I dismissed the codeql alert for negbin is this time with false positive

@josef-pkt
josef-pkt merged commit e544656 into statsmodels:main Dec 6, 2022
@josef-pkt josef-pkt mentioned this pull request Dec 8, 2022
16 of 20 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants