ag-csw / LDStreamHMMLearn

1 stars 0 forks source link

Redesign recursions #21

Open greenTara opened 7 years ago

greenTara commented 7 years ago

There are some methods which call themselves when an error occurs. The idea was that certain undesirable cases from random sampling would be avoided by resampling until a condition was passed. However, this design is difficult for development because exceptions caused by bugs keep recurring on repeated trials, leading to stack overflow.

greenTara commented 7 years ago

A better design for this situation, in general, is to use a while loop that repeats until the condition is passed (success) or some threshold number of loops has been exceeded (failure, throw exception). Depending on the circumstances, we could then handle the exception or have a hard failure. For debugging, this value could be smaller. Once debugging is finished, the threshold would be increased to a larger value.

greenTara commented 7 years ago

The first task for this issue is to identify the places where this design is used, and insert a FIXME comment. The second task is to prioritize these for redesign.

alexlafleur commented 7 years ago

qhmm_family is the only script left that does a recursion

greenTara commented 7 years ago

Have the unit tests for the modified class been checked?

greenTara commented 7 years ago

It is reasonable to postpone the modification of qhmm_family until we need it. Let's leave this issue open however.

alexlafleur commented 7 years ago

Yes, the unit tests have been checked.