Godtone
Joined 17 December 2020
m →My Python 3 code: generalize |
m comment correction and remove potentially confusing aliases (at least pending a rework, cuz arguably the complexity weighting should happen before the error squaring step) |
||
| Line 1,307: | Line 1,307: | ||
def et_badness(ivs,v,badness=lambda rel_err,x,et2: rel_err**2 * et2**2,weighting=lambda x: iv_complexity(x),combine='avg',et2=0): | def et_badness(ivs,v,badness=lambda rel_err,x,et2: rel_err**2 * et2**2,weighting=lambda x: iv_complexity(x),combine='avg',et2=0): | ||
# if the weighting is unspecified, use the default of: | # if the weighting is unspecified, use the default of: | ||
# weighting an interval x proportional to its odd-limit complexity iv_complexity(x); | # weighting an interval x's (by default squared) error contribution proportional to its odd-limit complexity (iv_complexity(x)); | ||
# this is a compromise between theoretic sensitivity (approx. equal to the square of the odd-limit complexity) | # this is a compromise between theoretic sensitivity (approx. equal to the square of the odd-limit complexity) | ||
# and not underweighting simpler intervals and accounting for that more complex intervals will tend to be used | # and not underweighting simpler intervals and accounting for that more complex intervals will tend to be used | ||
# in a harmonic/chordal context which justifies their otherwise-higher effective felt error through templating | # in a harmonic/chordal context which justifies their otherwise-higher effective felt error through templating | ||
if weighting==1 or weighting in ['unweighted','trivial','basic | if weighting==1 or weighting in ['unweighted','trivial','basic']: | ||
weighting = lambda x: 1 | weighting = lambda x: 1 | ||
elif weighting== | elif weighting=='sensitive': | ||
weighting = lambda x: | weighting = lambda x: iv_complexity(x)**2 | ||
global ivs_cache | global ivs_cache | ||
global ivs_int_cache | global ivs_int_cache | ||