Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save stephanmg/804db4549743529ae3862331c0292e4d to your computer and use it in GitHub Desktop.
Save stephanmg/804db4549743529ae3862331c0292e4d to your computer and use it in GitHub Desktop.
import numpy as np
import pandas as pd
from pypesto.store import read_from_hdf5
import os
import matplotlib.pyplot as plt
from matplotlib import cm
from more_itertools import unique_everseen
from pathlib import Path
import argparse
from pypesto.visualize import optimizer_convergence
import pypesto
import pypesto.visualize as visualize
from helper_extract_data import *
from pypesto.store import (
ProblemHDF5Writer, ProblemHDF5Reader, OptimizationResultHDF5Writer,
OptimizationResultHDF5Reader, ProfileResultHDF5Writer,
ProfileResultHDF5Reader, SamplingResultHDF5Reader,
SamplingResultHDF5Writer, read_result, write_result,
load_objective_config, optimization_result_from_history)
from pypesto.objective.constants import (X, FVAL, GRAD,
HESS, RES, SRES,
CHI2, SCHI2, ID, X0,
FVAL0, N_RES, N_FVAL,
N_GRAD, N_HESS, N_SRES)
fn = "test.h5"
optimizer_name = "fides"
pypesto_result = optimization_result_from_history(fn)
#hdf5_reader = OptimizationResultHDF5Reader(fn)
#pypesto_result = hdf5_reader.read()
visualize.parameters(
pypesto_result.optimize_result,
legends=optimizer_name,
size=(15, 10),
start_indices=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
balance_alpha=False,
);
plt.savefig("blubb_params.png")
@stephanmg
Copy link
Author

Fails with:

Traceback (most recent call last):
File "params.py", line 36, in
visualize.parameters(
File "/home/sgrein/.local/lib/python3.8/site-packages/pypesto/visualize/parameters.py", line 79, in parameters
parameter_indices = results[0].problem.x_free_indices
AttributeError: 'OptimizeResult' object has no attribute 'problem'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment