Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use generations instead of evaluations in optimisation plot #44

Merged
merged 2 commits into from
Sep 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions bluepyemodel/emodel_pipeline/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def optimisation(
make_dir(figures_dir)
run, _ = read_checkpoint(checkpoint_path)

nevals = numpy.cumsum(run["logbook"].select("nevals"))
ngen = run["logbook"].select("gen")
is_finished_msg = ""
if "CMA" in optimiser:
is_finished_msg = f"is finished: {not run['CMA_es'].active}"
Expand All @@ -163,7 +163,6 @@ def optimisation(
(
f"min score = {min(run['logbook'].select('min')):.3f}",
f"# of generations = {run['generation']}",
f"# of evaluations = {nevals[-1]}",
f"evolution algorithm: {optimiser}",
is_finished_msg,
)
Expand All @@ -174,12 +173,12 @@ def optimisation(
title = get_title(emodel, iteration, seed)
axs[0, 0].set_title(title)

axs[0, 0].plot(nevals, run["logbook"].select("min"), label="Minimum", ls="--", c="gray")
axs[0, 0].plot(ngen, run["logbook"].select("min"), label="Minimum", c="red")

axs[0, 0].plot(nevals, run["logbook"].select("avg"), label="Average", c="gray")
axs[0, 0].plot(ngen, run["logbook"].select("avg"), label="Average", c="black")

axs[0, 0].set_yscale("log")
axs[0, 0].set_xlabel("Number of evaluations")
axs[0, 0].set_xlabel("Number of generations")
axs[0, 0].set_ylabel("Fitness")
axs[0, 0].legend(title=legend_text, loc="upper right", frameon=False)

Expand Down