Latest Version: 0.9.6.1
  Dashboard > Pylons Cookbook > ... > Pylons Curve and Surface Fitting Tutorial > Display fitting results
  Pylons Cookbook Log In | Sign Up   View a printable version of the current page.  
  Display fitting results
Added by James R. Phillips, last edited by Mike Orr on Jan 06, 2008  (view change)
Labels: 
(None)

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

Site running on a free Atlassian Confluence Open Source Project License granted to Pylons. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.3.3 Build:#645 Feb 13, 2007) - Bug/feature request - Contact Administrators
Top