Extracting, formatting, and analyzing optimization results.
After an optimization run, spotoptim provides utilities for printing the best solution, building summary tables, and computing variable importance and sensitivity. All functions accept a SpotOptim instance and work on the data stored during optimize().
Printing the Best Solution
print_best displays the best parameter vector, objective value, and total evaluation count in a human-readable format. Factor variables are mapped back to their original string labels.
Best Solution Found:
--------------------------------------------------
x0: -0.0002
x1: 0.0007
Objective Value: 0.0000
Total Evaluations: 25
Pass transformations (a list of callables, one per dimension) to display parameters on a different scale — for example, 10**x for log-transformed learning rates.
Results Table
get_results_table returns a formatted table string with one row per variable showing its name, type, bounds, default value, and tuned (best) value. Set show_importance=True to append importance scores and star ratings.
The tablefmt argument accepts any format supported by the tabulate library (e.g. "github", "pipe", "grid", "latex").
Design Table
get_design_table summarises the search space before optimization results are known: variable names, types, bounds, default (midpoint) values, and transformations.
get_importance computes a correlation-based importance score for each variable. Scores are normalised to a 0–100 scale: a variable that correlates strongly with the objective receives a high score, while a variable with no correlation scores near zero.