-
Notifications
You must be signed in to change notification settings - Fork 1
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
code hangs? #8
Comments
I've looked into this, and I've traced the error into the To move forward, one option is to open an issue in |
Thanks so much, @svteichman ! Great work tracing this back to its core. @zbartolek -- this is the only example of this phenomenon that you've seen so far, correct? How many examples have you looked at? If it looks to be very common than we might have to take it further. I really don't want to have to (eg) write our own backup in @svteichman would you mind opening an issue in |
Thanks so much for looking into this @svteichman and @adw96 ! So far this is the only example I saw of this, I ran ~2000 tests for now. I will try to run on a larger dataset tomorrow to see if this is prevalent. For now, do you have a suggestion on how to terminate the run or skip if a hang like this happens again? Right now I'm running this code in a loop over many examples, and it would be nice if I could continue to the next example automatically if there is a hang. Thanks so much!! |
@zbartolek That's a great question. I tried to use the function The best that I can think of is running the loop that you want, writing the results to a file frequently (every iteration, every hundred iterations, whatever makes sense to you), and then if/when it gets stuck, removing that data example from the set that you're running and re-starting where it is since you've last saved. |
@svteichman Yes, I also tried the withTimeout function without success. Sounds good, Il will try to organize the code for now so that it saves frequently... will let you know if I run into any issues. Thanks a lot for your help with this! |
I've been trying to figure out why this particular example failed to converge, and I think it could be because of perfect separation or quasi-perfect separation between the count variable and the sample name variable, since now we group samples to account for replicates. As far as I understand, this problem is not uncommon if you have a categorical variable (in our case sample name) and a small sample size (also true for our case). @svteichman and @adw96 do you think this reasoning is correct? To try to solve this for now without having to re-start a bunch of failed R runs, I thought it might be possible to test for perfect or quasi perfect separation prior to running the model, and for now remove those examples. Do you have any suggestions on how to test for this? I was also reading about ways to deal with this more systematically, like using a penalized likelihood estimation. I don't have a good idea of how easy it would be to implement something like that or if it is even appropriate for our case. Thanks a lot! |
@zbartolek I think you're probably right, separation could cause infinite parameter estimates and therefore code that hangs forever. I'll check on this on your dataset when I get a chance later today, but there is an R package The two common ways that I know of to deal with separation are (1) identify the separation, say that what you're testing is perfectly separated and therefore an interesting example that you cannot estimate parameters for, and move on, or (2, as you suggested!) use a penalty so that parameter estimates are always finite. Adding this kind of penalty would be a larger modification for this method, so I'll leave it up to @adw96 to decide if she thinks that is a good idea. |
The more that I think about this, the more I think it's slightly more complicated in the GEE case compared to the GLM case (and the R package that I sent is for categorical responses and binomial response GLMS). I'll spend some more time thinking this over and doing some experimenting and get back to you @zbartolek! |
Thanks a lot @svteichman I'm having some issues installing |
@zbartolek do you know if there are any other examples in your dataset in which all of the response values for a given cluster are 0 (as we see in this example for several of the clusters)? |
I suspect that it is in fact an issue with separation by the clusters, because I was able to run a verbose version of the code, and the estimated |
@svteichman Here are a few other examples: These examples work with the model and converge (examples1-4): These examples are all the ones I have been able to find so far that don't converge (examples5-7): I played around with the Thanks!! |
This is really helpful! Interestingly, all of these examples have some cases for which there are whole clusters with response values of 0 for each observation, so that on it's own isn't what is causing the problem, since examples 1-4 run fine. Nothing is really jumping out to me about how the data in examples 1-4 are different than those in examples 5-7, but I'll do some more digging into it and see if I can find anything. |
Hi @zbartolek, I wanted to check back in with you. I haven't been able to figure out any characteristics of these data examples that separate examples 1-4 from 5-7, so I'm not sure what is causing this issue. I'm drafting an issue to open in |
Hi @svteichman, thanks for checking in! I'm currently trying to figure out how prevalent the problem is, so running the dataset kind of like you suggested, separating it out and then removing problematic cases. Il let you know once I figure out how prevalent the problem is (we have a huge dataset so it's taking me some time). Thanks for opening the issue on geepack, I'm also not sure what more to do about fixing it right now. Thanks! |
@zbartolek I was able to add an error in to
Hopefully this will make your workflow a little bit easier! You can wrap each call to We'll update you once we have a more permanent solution (or figure out why these specific examples are having this problem). |
Hi @svteichman Thanks a lot! I will pull your version, an error message is much easier to deal with than a hang :) |
Hi @svteichman , I'm trying to run your version of the code, and it's working a lot better, I'm seeing a lot of examples that otherwise would have resulted in a code hang that are now getting skipped. I did still run into a code hang with this example (example8.csv), do you know why that might be happening? |
I imagine it's because what I'm doing is running another similar package, seeing if it fails with an error, and if so stopping |
Ah, yes, that makes sense. So far on the data that I have tried to run, I find the no convergence issue about 1 in every 100 fits, which is quite a lot I think. Your workaround solved it for most cases, but not all, so Il try to do a more manual selection of those now. Thanks! |
This is good to know. Thanks!
…On Fri, Mar 29, 2024 at 3:09 PM zbartolek ***@***.***> wrote:
Ah, yes, that makes sense. So far on the data that I have tried to run, I
find the no convergence issue about 1 in every 100 fits, which is quite a
lot I think. Your workaround solved it for most cases, but not all, so Il
try to do a more manual selection of those now. Thanks!
—
Reply to this email directly, view it on GitHub
<https://urldefense.com/v3/__https://github.com/statdivlab/enviromtx/issues/8*issuecomment-2027781962__;Iw!!K-Hz7m0Vt54!iuex6XXbrKy0KEeHztEwKMk__WbgrMCg6nPEp5Tfh2tGXyzPEeh3NYhFVhEqFdEuIdUzLN4ypfcaTDPAlRpjgA$>,
or unsubscribe
<https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AEDVQ7K4JZNVNHHLDLPKUOTY2XRCPAVCNFSM6AAAAABEY3IE5KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRXG44DCOJWGI__;!!K-Hz7m0Vt54!iuex6XXbrKy0KEeHztEwKMk__WbgrMCg6nPEp5Tfh2tGXyzPEeh3NYhFVhEqFdEuIdUzLN4ypfcaTDOs6Lm-ig$>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@zbartolek, we've updated |
Huge thanks, @svteichman !!!!! I really appreciate this. @zbartolek Let us know if the code still hangs for you for any combinations, and please share those cases with us so we can work on them for you! |
Wow, that's quite amazing @svteichman and @adw96, thanks a lot for your work on this! I will test this out tonight and let you know tomorrow if I still see any hangs! |
Seems to be working well for now, thanks!! I get an error message for those that can't converge! Started running on a larger portion of the data, thanks so much @svteichman for your help with this! |
Hi @svteichman ! Would you please be able to help @zbartolek with the following issue:
This code runs, but never terminates -- not sure why
example5.csv
Thanks so much for any insights you have!
The text was updated successfully, but these errors were encountered: