Skip to content

Commit

Permalink
Update docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
segsell committed Apr 28, 2023
1 parent 78152a0 commit 0eb9f69
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
34 changes: 17 additions & 17 deletions src/estimagic/benchmarking/benchmark_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
def convergence_report(
problems, results, *, stopping_criterion="y", x_precision=1e-4, y_precision=1e-4
):
"""Create a DataFrame with all information needed for the convergence report.
"""Create a DataFrame with convergence information for a set of problems.
Args:
problems (dict): estimagic benchmarking problems dictionary. Keys are the
Expand All @@ -29,8 +29,8 @@ def convergence_report(
convergence is fulfilled. Default is 1e-4.
Returns:
pandas.DataFrame: columns are the optimizers and the dimensionality of the
benchmark problems, index are the problems. For the optimizers columns,
pandas.DataFrame: columns are the algorithms and the dimensionality of the
benchmark problems, indexes are the problems. For the algorithms columns,
the values are strings that are either "success" "failed", or "error".
For the dimensionality column, the values denote the number of dimensions
of the problem.
Expand Down Expand Up @@ -66,7 +66,7 @@ def rank_report(
x_precision=1e-4,
y_precision=1e-4,
):
"""Create a DataFrame with the ranks of the optimizers for a set of problems.
"""Create a DataFrame with rank information for a set of problems.
Args:
problems (dict): estimagic benchmarking problems dictionary. Keys are the
Expand Down Expand Up @@ -96,11 +96,11 @@ def rank_report(
convergence is fulfilled. Default is 1e-4.
Returns:
pandas.DataFrame: columns are the optimizers, index are the problems.
The values are the ranks of the optimizers for each problem,
0 means optimizers was the fastest, 1 means it was the second fastest
and so on. If an optimizer did not converge on a problem, the value is
"failed". If an optimizer did encounter an error during optimization,
pandas.DataFrame: columns are the algorithms, indexes are the problems.
The values are the ranks of the algorithms for each problem,
0 means algorithms was the fastest, 1 means it was the second fastest
and so on. If an algorithm did not converge on a problem, the value is
"failed". If an algorithm did encounter an error during optimization,
the value is "error".
"""
Expand Down Expand Up @@ -142,7 +142,7 @@ def rank_report(


def traceback_report(results):
"""Create a DataFrame with the traceback for all problems that have not been solved.
"""Create a DataFrame with tracebacks for all problems that have not been solved.
Args:
results (dict): estimagic benchmarking results dictionary. Keys are
Expand All @@ -151,20 +151,20 @@ def traceback_report(results):
and 'time_history'.
Returns:
pandas.DataFrame: columns are the optimizers, index are the problems.
The values are the traceback of the optimizers for each problem
the optimizers stopped with an error.
pandas.DataFrame: columns are the algorithms, indexes are the problems.
The values are the traceback of the algorithms for each problem
the algorithms stopped with an error.
"""
scenarios = list({algo[1] for algo in results.keys()})
algorithms = list({algo[1] for algo in results.keys()})

tracebacks = {}
for scenario in scenarios:
tracebacks[scenario] = {}
for algo in algorithms:
tracebacks[algo] = {}

for key, value in results.items():
if isinstance(value["solution"], str):
if key[1] in scenarios:
if key[1] in algorithms:
tracebacks[key[1]][key[0]] = value["solution"]

traceback_report = pd.DataFrame.from_dict(tracebacks, orient="columns")
Expand Down
6 changes: 3 additions & 3 deletions src/estimagic/visualization/profile_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,12 @@ def _create_solution_times(df, runtime_measure, converged_info):
df (pandas.DataFrame): contains 'problem', 'algorithm' and *runtime_measure*
as columns.
runtime_measure (str): 'walltime', 'n_batches' or 'n_evaluations'.
converged_info (pandas.DataFrame): columns are the algorithms, index are the
converged_info (pandas.DataFrame): columns are the algorithms, indexes are the
problems. The values are boolean and True when the algorithm arrived at
the solution with the desired precision.
Returns:
solution_times (pandas.DataFrame): columns are algorithms, index are problems.
solution_times (pandas.DataFrame): columns are algorithms, indexes are problems.
The values are either the number of evaluations or the walltime each
algorithm needed to achieve the desired precision. If the desired precision
was not achieved the value is set to np.inf (for n_evaluations) or 7000 days
Expand Down Expand Up @@ -180,7 +180,7 @@ def _find_switch_points(solution_times):
Args:
solution_times (pandas.DataFrame): columns are the names of the algorithms,
the index are the problems. Values are performance measures.
the indexes are the problems. Values are performance measures.
They can be either float, when normalize_runtime was True or int when the
runtime_measure are not normalized function evaluations or datetime when
the not normalized walltime is used.
Expand Down

0 comments on commit 0eb9f69

Please sign in to comment.