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

BUG graphics influence plot, switched criterion #3158

Merged
merged 6 commits into from
Aug 15, 2016

Conversation

josef-pkt
Copy link
Member

@josef-pkt josef-pkt commented Aug 14, 2016

closes #3103

I added a unit test to compare the sizes used in the plot, but it uses a matplotlib figure private attribute _sizes. This is most likely not robust, and might need to be try except AttributeError protected

I used matplotlib '1.5.1', and tests pass on my computer (only for the test method, I still get segfaults running the test class)

Detail (as explanation to test code): the plotted sizes are a affine transformation of the influence criterion, so I check that the residuals of the linear regression are close to zero.

@josef-pkt
Copy link
Member Author

the test doesn't seem to work with any of the matplotlib used on travis, i.e. <1.5

possible problem with try...except catching is that the unit test might never run at all.
(We need more robust unit tests for content of plots)

@josef-pkt
Copy link
Member Author

maintenance, some test methods create several plots but don't close them
If I close all of them immediately, then I don't get a segfault anymore when running the unit tests.

https://travis-ci.org/statsmodels/statsmodels/jobs/152251848

statsmodels.graphics.tests.test_regressionplots.TestPlotPandas.test_plot_oth ... /home/travis/miniconda2/envs/statsmodels-test/lib/python2.7/site-packages/matplotlib/pyplot.py:412: RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (`matplotlib.pyplot.figure`) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam `figure.max_num_figures`).
  max_open_warning, RuntimeWarning)
ok

I still get tkinter warnings in TestPlot.test_plot_oth unless I comment out the add_lowess loop. I still don't see where this comes from.

statsmodels.graphics.tests.test_regressionplots.TestPlot.test_plot_oth ... can't
 invoke "event" command: application has been destroyed
    while executing
"event generate $w <<ThemeChanged>>"
    (procedure "ttk::ThemeChanged" line 6)
    invoked from within
"ttk::ThemeChanged"
can't invoke "event" command: application has been destroyed
    while executing
"event generate $w <<ThemeChanged>>"
    (procedure "ttk::ThemeChanged" line 6)
    invoked from within
"ttk::ThemeChanged"
can't invoke "event" command: application has been destroyed
    while executing
"event generate $w <<ThemeChanged>>"
    (procedure "ttk::ThemeChanged" line 6)
    invoked from within
"ttk::ThemeChanged"
ok

@coveralls
Copy link

coveralls commented Aug 15, 2016

Coverage Status

Coverage increased (+9.0e-05%) to 89.184% when pulling 2f54d07 on josef-pkt:bug_influence_plot_3103 into 92da1cd on statsmodels:master.

@josef-pkt
Copy link
Member Author

josef-pkt commented Aug 15, 2016

test_power is the last one, the entire test suite runs now for me also.
quite a bit faster than Travis 516.624 / 60 = 8.6104 minutes
(single core nosetests, but MKL uses multicore, max cpu usage around 50% with 4 core/8 logical processors when running the tests for statsmodels.regression)

Ran 4890 tests in 516.624s
FAILED (SKIP=35, errors=2)

(second error is in an extra file, that was left over from a different branch)

@josef-pkt
Copy link
Member Author

some cosmetic changes would be possible, but in it goes

@josef-pkt josef-pkt merged commit a111886 into statsmodels:master Aug 15, 2016
@josef-pkt josef-pkt mentioned this pull request Aug 16, 2016
28 tasks
@josef-pkt josef-pkt deleted the bug_influence_plot_3103 branch August 17, 2016 15:17
josef-pkt added a commit to josef-pkt/statsmodels that referenced this pull request Aug 19, 2016
…_3103

BUG graphics influence plot, switched criterion
@TomAugspurger TomAugspurger mentioned this pull request Feb 2, 2017
2 tasks
@josef-pkt josef-pkt added the type-bug-wrong serious bugs that silently return incorrect numbers label Feb 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp-graphics comp-regression type-bug type-bug-wrong serious bugs that silently return incorrect numbers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Logic swapped for cooks distance/dffits in influence_plot?
2 participants