Changeset 86


Ignore:
Timestamp:
01/29/09 17:41:38 (7 years ago)
Author:
mmckerns
Message:

added TODO list; made getCost example cleaner

Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • python/example_getCost.py

    r79 r86  
    2828    fwd = ForwardPolyFactory(params) 
    2929    x = (array([range(101)])-50.)[0] 
    30     return fwd(x) 
     30    return x,fwd(x) 
    3131 
    3232 
     
    4949 
    5050def plot_sol(params,linestyle='b-'): 
    51     x = (array([range(101)])-50.)[0] 
    5251    d = data(params) 
    53     pylab.plot(x,d,'%s'%linestyle,linewidth=2.0) 
     52    pylab.plot(d[0],d[1],'%s'%linestyle,linewidth=2.0) 
    5453    pylab.axis(plotview) 
    5554    return 
    5655 
     56from numpy import sum as numpysum 
     57def cost_function(params): 
     58    x = data(params)[1] - datapts 
     59    return numpysum(real((conjugate(x)*x))) 
     60 
    5761 
    5862if __name__ == '__main__': 
    59     x = (array([range(101)])-50.)[0] 
    6063    plotview = [-60,60, 0,2500] 
    6164    target = [1., 2., 1.] 
    62     datapts = data(target) 
     65    x,datapts = data(target) 
    6366 
     67   #myCost = cost_function 
    6468    F = CostFactory() 
    6569    F.addModel(ForwardPolyFactory,'poly',3) 
Note: See TracChangeset for help on using the changeset viewer.