source: releases/mystic-0.1a1-patch2.diff @ 132

Revision 132, 7.4 KB checked in by mmckerns, 7 years ago (diff)

now StepMonitor? logs best not simplex (ticket #29); built new patch

  • mystic-0.1a1/mystic/scipy_optimize.py

     
    230230        iterations = 1 
    231231 
    232232        while (fcalls[0] < self._maxfun and iterations < self._maxiter): 
    233             StepMonitor(sim, fsim) # get all values; "best" is sim[0] 
     233            StepMonitor(sim[0], fsim[0]) # sim = all values; "best" is sim[0] 
    234234            if self._EARLYEXIT or termination(self): 
    235235                break 
    236236 
     
    400400    iterations = len(stepmon.x) 
    401401    allvecs = [] 
    402402    for i in range(iterations): 
    403        #allvecs.append(list(stepmon.x[i][0])) 
    404         allvecs.append(stepmon.x[i][0]) 
     403       #allvecs.append(list(stepmon.x[i])) 
     404        allvecs.append(stepmon.x[i]) 
    405405 
    406406    if fcalls >= solver._maxfun: 
    407407        warnflag = 1 
  • mystic-0.1a1/examples/example10.py

     
    3131# draw the plot 
    3232def plot_frame(label=None): 
    3333    pylab.close() 
    34     pylab.suptitle("8th-order Chebyshev coefficient convergence") 
     34    pylab.title("8th-order Chebyshev coefficient convergence") 
    3535    pylab.xlabel("Differential Evolution %s" % label) 
    3636    pylab.ylabel("Chi-Squared") 
    3737    return 
  • mystic-0.1a1/examples/example02.py

     
    4242    pylab.plot([solution[0]],[rosen(solution)],'bo') 
    4343 
    4444    # draw the plot 
    45     pylab.suptitle("minimium of Rosenbrock's function") 
     45    pylab.title("minimium of Rosenbrock's function") 
    4646    pylab.xlabel("x, y, z") 
    4747    pylab.ylabel("f(i) = Rosenbrock's function") 
    4848    pylab.legend(["f(x,1,1)","f(1,y,1)","f(1,1,z)"]) 
  • mystic-0.1a1/examples/example12.py

     
    5555# draw the plot 
    5656def plot_frame(label=None): 
    5757    pylab.close() 
    58     pylab.suptitle("fitting noisy 5th-order polynomial coefficients") 
     58    pylab.title("fitting noisy 5th-order polynomial coefficients") 
    5959    pylab.xlabel("x") 
    6060    pylab.ylabel("f(x)") 
    6161    return 
  • mystic-0.1a1/examples/example04.py

     
    2525 
    2626# draw the plot 
    2727def plot_frame(): 
    28     pylab.suptitle("Rosenbrock parameter convergence") 
     28    pylab.title("Rosenbrock parameter convergence") 
    2929    pylab.xlabel("Nelder-Mead solver iterations") 
    3030    pylab.ylabel("parameter value") 
    3131    return 
  • mystic-0.1a1/examples/example06.py

     
    2424 
    2525# draw the plot 
    2626def plot_exact(): 
    27     pylab.suptitle("fitting 8th-order Chebyshev polynomial coefficients") 
     27    pylab.title("fitting 8th-order Chebyshev polynomial coefficients") 
    2828    pylab.xlabel("x") 
    2929    pylab.ylabel("f(x)") 
    3030    import numpy 
  • mystic-0.1a1/examples/example08.py

     
    3030 
    3131# draw the plot 
    3232def plot_exact(): 
    33     pylab.suptitle("fitting 8th-order Chebyshev polynomial coefficients") 
     33    pylab.title("fitting 8th-order Chebyshev polynomial coefficients") 
    3434    pylab.xlabel("x") 
    3535    pylab.ylabel("f(x)") 
    3636    import numpy 
  • mystic-0.1a1/examples/example11.py

     
    3131# draw the plot 
    3232def plot_frame(label=None): 
    3333    pylab.close() 
    34     pylab.suptitle("8th-order Chebyshev coefficient convergence") 
     34    pylab.title("8th-order Chebyshev coefficient convergence") 
    3535    pylab.xlabel("Nelder-Mead Simplex Solver %s" % label) 
    3636    pylab.ylabel("Chi-Squared") 
    3737    return 
     
    3939# plot the polynomial trajectories 
    4040def plot_params(monitor): 
    4141    x = range(len(monitor.y)) 
    42     import numpy 
    43     # NOTE: workaround poor design, where simplex is logged by StepMonitor 
    44     if isinstance(monitor.y[0],numpy.ndarray): 
    45         y = [i[0] for i in monitor.y] 
    46     else: 
    47         y = monitor.y 
     42    y = monitor.y 
    4843    pylab.plot(x,y,'b-') 
    4944    pylab.axis([1,0.5*x[-1],0,y[1]],'k-') 
    5045    return 
    5146 
    5247# draw the plot 
    5348def plot_exact(): 
    54     pylab.suptitle("fitting 8th-order Chebyshev polynomial coefficients") 
     49    pylab.title("fitting 8th-order Chebyshev polynomial coefficients") 
    5550    pylab.xlabel("x") 
    5651    pylab.ylabel("f(x)") 
    5752    import numpy 
  • mystic-0.1a1/examples/example03.py

     
    3636    pylab.plot([i[2] for i in allvecs]) 
    3737 
    3838    # draw the plot 
    39     pylab.suptitle("Rosenbrock parameter convergence") 
     39    pylab.title("Rosenbrock parameter convergence") 
    4040    pylab.xlabel("Nelder-Mead solver iterations") 
    4141    pylab.ylabel("parameter value") 
    4242    pylab.legend(["x", "y", "z"]) 
  • mystic-0.1a1/examples/example07.py

     
    2525 
    2626# draw the plot 
    2727def plot_exact(): 
    28     pylab.suptitle("fitting 8th-order Chebyshev polynomial coefficients") 
     28    pylab.title("fitting 8th-order Chebyshev polynomial coefficients") 
    2929    pylab.xlabel("x") 
    3030    pylab.ylabel("f(x)") 
    3131    import numpy 
  • mystic-0.1a1/examples/example09.py

     
    3232 
    3333# draw the plot 
    3434def plot_exact(): 
    35     pylab.suptitle("fitting 8th-order Chebyshev polynomial coefficients") 
     35    pylab.title("fitting 8th-order Chebyshev polynomial coefficients") 
    3636    pylab.xlabel("x") 
    3737    pylab.ylabel("f(x)") 
    3838    import numpy 
  • mystic-0.1a1/examples/README

     
    11== Notes on mystic examples == 
     2NOTE: for all examples that use matplotlib, please use the TKAgg backend. 
     3Thus, run the examples like this:  "python example04.py -dTKAgg" 
     4(see ticket #36 for more details). 
    25 
    36Dependencies: 
    4  - All examples with prefix "example" should run without new dependencies, and are intended as a tutorial. (i.e. TRY THESE FIRST) 
     7 - All examples with prefix "example" should run without new dependencies, and are intended as a tutorial (i.e. TRY THESE FIRST). 
    58 - All examples with prefix "test_" should run without new dependencies. 
    69 - All examples with prefix "gplot_" requres gnuplot-py to be installed. 
    710 
Note: See TracBrowser for help on using the repository browser.