Error measures for DR chords: Difference between revisions
Created page with "{{expert}} This article will describe several '''least-squares error measures for delta-rational chords'''. They have the advantage of not fixing a particular interval in the chord when constructing the chord of best fit. However, like any other numerical measure of concordance or error, you should take them with a grain of salt. == Conventions and introduction == The idea motivating least-squares error measures on a chord as an approximation to a given delta signat..." |
No edit summary |
||
| Line 109: | Line 109: | ||
=== Grid method (FDR case) === | === Grid method (FDR case) === | ||
< | <syntaxhighlight lang="python"> | ||
class GridSolution: | class GridSolution: | ||
def __init__(self, x, fx): | def __init__(self, x, fx): | ||
| Line 149: | Line 149: | ||
return GridSolution(best_x, best_error) | return GridSolution(best_x, best_error) | ||
< | <syntaxhighlight> | ||
=== BFGS-B (one related delta set, arbitrary free deltas) === | === BFGS-B (one related delta set, arbitrary free deltas) === | ||
| Line 164: | Line 164: | ||
In the Python implementation below, <code>x</code> represents the vector <math>(x_1, x_2, ..., x_n),</math> <code>x0</code> is the initial guess for the solution, and <code>f</code> is the error function. | In the Python implementation below, <code>x</code> represents the vector <math>(x_1, x_2, ..., x_n),</math> <code>x0</code> is the initial guess for the solution, and <code>f</code> is the error function. | ||
< | <syntaxhighlight lang="python"> | ||
import numpy as np | import numpy as np | ||
import math | import math | ||
| Line 298: | Line 298: | ||
result.fx = f(result.x) | result.fx = f(result.x) | ||
return result | return result | ||
< | <syntaxhighlight> | ||
=== L-BFGS-B (one related delta set, arbitrary free deltas) === | === L-BFGS-B (one related delta set, arbitrary free deltas) === | ||
L-BFGS-B is an approximation to BFGS-B limiting memory usage, particularly suited for high-dimensional problems but nevertheless agreeing very well with BFGS-B for typical DR test cases. Python code for the L-BFGS method is provided below. | L-BFGS-B is an approximation to BFGS-B limiting memory usage, particularly suited for high-dimensional problems but nevertheless agreeing very well with BFGS-B for typical DR test cases. Python code for the L-BFGS method is provided below. | ||
< | <syntaxhighlight lang="python"> | ||
import numpy as np | import numpy as np | ||
import math | import math | ||
| Line 410: | Line 410: | ||
return LBFGSSolution(x, fx, max_iterations, False) | return LBFGSSolution(x, fx, max_iterations, False) | ||
< | <syntaxhighlight> | ||
== External links == | == External links == | ||
* [https://inthar-raven.github.io/delta/ Inthar's DR chord explorer (includes least-squares error calculation in both domains and multiple error models)] | * [https://inthar-raven.github.io/delta/ Inthar's DR chord explorer (includes least-squares error calculation in both domains and multiple error models)] | ||
[[Category:Math]] | [[Category:Math]] | ||