Changeset 82 for tests/test_mogi.py


Ignore:
Timestamp:
01/26/09 16:12:08 (7 years ago)
Author:
mmckerns
Message:

scipy.optimize.fmin fit to mystic.Solve interface;
mystic handlers, etc added to fmin solver;
VerboseSow? edited to handle simplex-type cloud of results per iteration

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/test_mogi.py

    r81 r82  
    110110if __name__ == '__main__': 
    111111 
    112     from mystic.nelder_mead import fmin 
     112    from mystic.scipy_optimize_fmin import NelderMeadSimplexSolver as fmin 
     113    from mystic.nmtools import IterationRelativeError as IRE 
    113114    from scipy.optimize import leastsq, fmin_cg 
    114115    # 
     
    125126    # 
    126127    simplex, esow = Sow(), Sow() 
    127     sol = fmin(cost_function, point,  EvaluationMonitor = esow, retall = True, StepMonitor = simplex) 
    128     print "simplex solution: ", sol[1][-1] 
     128    solver = fmin(len(point)) 
     129    solver.SetInitialPoints(point) 
     130    killme = IRE(1e-4,1e-4) 
     131    solver.Solve(cost_function, killme, EvaluationMonitor = esow, StepMonitor = simplex) 
     132    sol = solver.Solution() 
     133 
     134    print "simplex solution: ", sol 
    129135    # 
    130136    solcg = fmin_cg(cost_function, point) 
     
    137143    plot_noisy_data() 
    138144    plot_sol(desol,'r-') 
    139     plot_sol(sol[1][-1],'k--') 
     145    plot_sol(sol,'k--') 
    140146    plot_sol(solcg,'b-.') 
    141147    pylab.legend(('Noisy data', 'Differential Evolution', 'Nelder Mead', 'Polak Ribiere'))  
Note: See TracChangeset for help on using the changeset viewer.