Skip to content

Commit

Permalink
Fix black code style errors
Browse files Browse the repository at this point in the history
  • Loading branch information
thouska committed Sep 8, 2022
1 parent 67d502a commit c297906
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions tutorials/getting_started.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,31 @@
"""
# Getting started

# To start your experience with SPOT you need to have SPOT installed. Please see the [Installation chapter](index.md) for further details.
# To use SPOT we have to import it and use one of the pre-build examples:
import spotpy # Load the SPOT package into your working storage
from spotpy.examples.spot_setup_rosenbrock import (
spot_setup, # Import the two dimensional Rosenbrock example
)
# To start your experience with SPOTPY you need to have SPOTPY installed.
# Please see the [Installation chapter](index.md) for further details.
# To use SPOTPY we have to import it and use one of the pre-build examples:
import spotpy # Load the SPOTPY package into your working storage
from spotpy.examples.spot_setup_rosenbrock import spot_setup

# The example comes along with parameter boundaries, the Rosenbrock function,
# the optimal value of the function and RMSE as a likelihood.
# So we can directly start to analyse the Rosenbrock function with one of the
# algorithms. We start with a simple Monte Carlo sampling

# The example comes along with parameter boundaries, the Rosenbrock function, the optimal value of the function and RMSE as a likelihood.
# So we can directly start to analyse the Rosenbrock function with one of the algorithms. We start with a simple Monte Carlo sampling:
if __name__ == "__main__":
# Give Monte Carlo algorithm the example setup and saves results in a RosenMC.csv file
# spot_setup.slow = True
sampler = spotpy.algorithms.mc(spot_setup(), dbname="RosenMC", dbformat="ram")
# Give Monte Carlo algorithm the example setup and saves results in a
# RosenMC.csv file
sampler = spotpy.algorithms.mc(spot_setup(), dbname="RosenMC",
dbformat="ram")

# Now we can sample with the implemented Monte Carlo algortihm:
sampler.sample(50000) # Sample 50.000 parameter combinations
results = sampler.getdata()
# Now we want to have a look at the results. First we want to know, what the algorithm has done during the 10.000 iterations:
# Now we want to have a look at the results. First we want to know,
# what the algorithm has done during the 50.000 iterations:
spotpy.analyser.plot_parameterInteraction(results)
# Now we collect the 10% runs with the lowest objective function
posterior = spotpy.analyser.get_posterior(results, maximize=False)
spotpy.analyser.plot_parameterInteraction(posterior)
# Print the run with the lowest objective function
print(spotpy.analyser.get_best_parameterset(results))

print(spotpy.analyser.get_best_parameterset(results, maximize=False))

0 comments on commit c297906

Please sign in to comment.