[Biopython-dev] [Bug 2697] MaxEntropy calculate function assumes integer values for class and convergence criteria is hard coded
bugzilla-daemon at portal.open-bio.org
bugzilla-daemon at portal.open-bio.org
Mon Feb 16 19:06:55 UTC 2009
http://bugzilla.open-bio.org/show_bug.cgi?id=2697
------- Comment #10 from bsouthey at gmail.com 2009-02-16 14:06 EST -------
(In reply to comment #9)
> Created an attachment (id=1212)
--> (http://bugzilla.open-bio.org/attachment.cgi?id=1212&action=view) [details]
> Patch to Bio/MaxEntropy.py to make the convergence parameters optional
> arguments
>
> This time its the whole patch - sorry for the extra emails this has triggered.
> I had stopped to check in a couple of docstring changes and fixed a few tabs in
> MaxEntropy.py first, which confused things.
>
> Note this is a bit different to what I was thinking in comment #5,
> > ... something like this:
> >
> > def train(training_set, results, feature_fns, update_fn=None,
> > max_iis_iterations = MAX_IIS_ITERATIONS,
> > iis_convere = IIS_CONVERGE,
> > max_newton_iterations = MAX_NEWTON_ITERATIONS
> > newton_coverage = NEWTON_CONVERGE):
>
> The above code won't pick up changes to the module level variables like
> MAX_IIS_ITERATIONS because the defaults are only evaluated once when the
> function is created.
My patch removed these hard coded default values and placed them in the
function.
>The patch deals with this as follows:
>
> def train(training_set, results, feature_fns, update_fn=None,
> max_iis_iterations=None, iis_converge=None,
> max_newton_iterations=None, newton_converge=None):
> if max_iis_iterations is None :
> max_iis_iterations = MAX_IIS_ITERATIONS
> if iis_converge is None :
> iis_converge = IIS_CONVERGE
> if max_newton_iterations is None :
> max_newton_iterations = MAX_NEWTON_ITERATIONS
> if newton_converge is None :
> newton_converge = NEWTON_CONVERGE
>
> This works :)
>
I hate the use of the local variable being the lowercase version of another
variable. Obviously for the original variables we are stuck with uppercase for
backwards compatibility. So we need to change the names of the lowercase
variables.
Bruce
--
Configure bugmail: http://bugzilla.open-bio.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
More information about the Biopython-dev
mailing list