Example #1
0
fig = plt.figure(figsize=(10, 10))
ax = fig.gca(projection="3d")
#
# Plot Rosenbrock surface
X = arange(-30, 30, 0.05)
Y = arange(-30, 30, 0.05)
X, Y = meshgrid(X, Y)

# from spot_setup_rosenbrock import spot_setup
# from spot_setup_griewank import spot_setup
from spotpy.examples.spot_setup_ackley import spot_setup

Z = np.zeros(X.shape)
for i in xrange(X.shape[0]):
    for j in xrange(X.shape[1]):
        sim = spot_setup().simulation([X[i, j], Y[i, j]])
        like = spotpy.objectivefunctions.rmse(sim, [0])
        Z[i, j] = like


surf_Rosen = ax.plot_surface(X, Y, Z, rstride=5, linewidth=0, cmap=cm.rainbow)
ax.set_xlabel("x")
ax.set_ylabel("y")
ax.set_zlabel("RMSE")
plt.tight_layout()
plt.savefig("Griewank3d.tif", dpi=300)


# surf_Rosen = ax.plot_surface(X_Rosen, Y_Rosen, Z_Rosen, rstride=1, cstride=1,
#   cmap=cm.coolwarm, linewidth=0, antialiased=False, alpha = 0.3)
Example #2
0
:author: Tobias Houska

This class holds the example code from the ackley tutorial web-documention.
'''
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import spotpy
from spotpy.examples.spot_setup_ackley import spot_setup


#Create samplers for every algorithm:
results=[]
spot_setup=spot_setup()
rep=5000

sampler=spotpy.algorithms.mc(spot_setup,    dbname='ackleyMC',    dbformat='csv')
sampler.sample(rep)
results.append(sampler.getdata())
#
sampler=spotpy.algorithms.lhs(spot_setup,   dbname='ackleyLHS',   dbformat='csv')
sampler.sample(rep)
results.append(sampler.getdata())

sampler=spotpy.algorithms.mle(spot_setup,   dbname='ackleyMLE',   dbformat='csv')
sampler.sample(rep)
results.append(sampler.getdata())

sampler=spotpy.algorithms.mcmc(spot_setup,  dbname='ackleyMCMC',  dbformat='csv')
fig = plt.figure(figsize=(10, 10))
ax = fig.gca(projection='3d')
#
# Plot Rosenbrock surface
X = arange(-30, 30, 0.05)
Y = arange(-30, 30, 0.05)
X, Y = meshgrid(X, Y)

#from spot_setup_rosenbrock import spot_setup
#from spot_setup_griewank import spot_setup
from spotpy.examples.spot_setup_ackley import spot_setup

Z = np.zeros(X.shape)
for i in range(X.shape[0]):
    for j in range(X.shape[1]):
        sim = spot_setup().simulation([X[i, j], Y[i, j]])
        like = spotpy.objectivefunctions.rmse(sim, [0])
        Z[i, j] = like

surf_Rosen = ax.plot_surface(X, Y, Z, rstride=5, linewidth=0, cmap=cm.rainbow)
ax.set_xlabel('x')
ax.set_ylabel('y')
ax.set_zlabel('RMSE')
plt.tight_layout()
plt.savefig('Griewank3d.tif', dpi=300)

#surf_Rosen = ax.plot_surface(X_Rosen, Y_Rosen, Z_Rosen, rstride=1, cstride=1,
#   cmap=cm.coolwarm, linewidth=0, antialiased=False, alpha = 0.3)

# Adjust axes
#ax.set_zlim(0, 600)
Example #4
0
This file is part of Statistical Parameter Estimation Tool (SPOTPY).

:author: Tobias Houska

This class holds the example code from the ackley tutorial web-documention.
'''
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import spotpy
from spotpy.examples.spot_setup_ackley import spot_setup

#Create samplers for every algorithm:
results = []
spot_setup = spot_setup()
rep = 5000

sampler = spotpy.algorithms.mc(spot_setup, dbname='ackleyMC', dbformat='csv')
sampler.sample(rep)
results.append(sampler.getdata())
#
sampler = spotpy.algorithms.lhs(spot_setup, dbname='ackleyLHS', dbformat='csv')
sampler.sample(rep)
results.append(sampler.getdata())

sampler = spotpy.algorithms.mle(spot_setup, dbname='ackleyMLE', dbformat='csv')
sampler.sample(rep)
results.append(sampler.getdata())

sampler = spotpy.algorithms.mcmc(spot_setup,