Our users will want to know more about their curve fit than just the equation coefficients. Here we will show them what data they gave the curve fitter as input, what their fitted equation yields as output, and the difference - or error - between those two things. For example if the input data said X = 1.0 should give an output of Y = 5.0, but the fitted equation yields 4.0, then the error is (output - data) = 4.0 - 5.0 = -1.0.
We will use Mako to iterate over both the the data and the calculated errors so this can be displayed, using a table. Add this to the bottom of results.mako, just before the final </PRE> tag:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 | <table border=1>
<TR>
<TD align=center>X</TD>
<TD align=center>Y</TD>
<TD align=center>Equation Output</TD>
<TD align=center>Absolute Error</TD>
<TD align=center>Relative Error</TD>
<TD align=center>Percent Error</TD>
</TR>
% for i in range(len(c.equation.DependentDataArray)):
<TR>
<TD>${c.equation.IndependentDataArray[0][i]}</TD>
<TD>${c.equation.DependentDataArray[i]}</TD>
<TD>${c.equation.PredictedArray[i]}</TD>
<TD>${c.equation.AbsoluteErrorArray[i]}</TD>
<TD>${c.equation.RelativeErrorArray[i]}</TD>
<TD>${c.equation.PercentErrorArray[i]}</TD>
</TR>
% endfor
</table>
|
and now try http://127.0.0.1:5000/
. This time the results should have a table showing the predicted values and errors from the fit.
Now let's see how we programmers and software engineers can have this web site do more work for us.
Next: --> Adding source code output