fitbenchmarking.utils.options module

This file will handle all interaction with the options configuration file.

class fitbenchmarking.utils.options.Options(file_name=None, results_directory: str = '')

Bases: object

An options class to store and handle all options for fitbenchmarking

DEFAULTS = {'FITTING': {'algorithm_type': ['all'], 'cost_func_type': ['weighted_nlls'], 'hes_method': ['default'], 'jac_method': ['scipy'], 'max_runtime': 600, 'num_runs': 5, 'software': ['scipy', 'scipy_ls']}, 'HESSIAN': {'analytic': ['default'], 'default': ['default'], 'numdifftools': ['central'], 'scipy': ['2-point']}, 'JACOBIAN': {'analytic': ['default'], 'default': ['default'], 'numdifftools': ['central'], 'scipy': ['2-point']}, 'LOGGING': {'append': False, 'external_output': 'log_only', 'file_name': 'fitbenchmarking.log', 'level': 'INFO'}, 'MINIMIZERS': {'bumps': ['amoeba', 'lm-bumps', 'newton', 'scipy-leastsq'], 'dfo': ['dfogn', 'dfols'], 'gofit': ['multistart'], 'gradient_free': ['HillClimbingOptimizer', 'RepulsingHillClimbingOptimizer', 'SimulatedAnnealingOptimizer', 'RandomSearchOptimizer', 'RandomRestartHillClimbingOptimizer', 'RandomAnnealingOptimizer', 'ParallelTemperingOptimizer', 'ParticleSwarmOptimizer', 'EvolutionStrategyOptimizer'], 'gsl': ['lmsder', 'lmder', 'nmsimplex', 'nmsimplex2', 'conjugate_pr', 'conjugate_fr', 'vector_bfgs', 'vector_bfgs2', 'steepest_descent'], 'horace': ['lm-lsqr'], 'levmar': ['levmar'], 'mantid': ['BFGS', 'Conjugate gradient (Fletcher-Reeves imp.)', 'Conjugate gradient (Polak-Ribiere imp.)', 'Damped GaussNewton', 'Levenberg-Marquardt', 'Levenberg-MarquardtMD', 'Simplex', 'SteepestDescent', 'Trust Region'], 'matlab': ['Nelder-Mead Simplex'], 'matlab_curve': ['Levenberg-Marquardt', 'Trust-Region'], 'matlab_opt': ['levenberg-marquardt', 'trust-region-reflective'], 'matlab_stats': ['Levenberg-Marquardt'], 'minuit': ['minuit'], 'ralfit': ['gn', 'gn_reg', 'hybrid', 'hybrid_reg'], 'scipy': ['Nelder-Mead', 'Powell', 'CG', 'BFGS', 'Newton-CG', 'L-BFGS-B', 'TNC', 'SLSQP'], 'scipy_go': ['differential_evolution', 'dual_annealing'], 'scipy_ls': ['lm-scipy', 'trf', 'dogbox']}, 'OUTPUT': {'results_dir': 'fitbenchmarking_results'}, 'PLOTTING': {'cmap_range': [0.2, 0.8], 'colour_map': 'magma_r', 'colour_ulim': 100, 'comparison_mode': 'both', 'make_plots': True, 'table_type': ['acc', 'runtime', 'compare', 'local_min']}}
DEFAULT_FITTING = {'algorithm_type': ['all'], 'cost_func_type': ['weighted_nlls'], 'hes_method': ['default'], 'jac_method': ['scipy'], 'max_runtime': 600, 'num_runs': 5, 'software': ['scipy', 'scipy_ls']}
DEFAULT_HESSIAN = {'analytic': ['default'], 'default': ['default'], 'numdifftools': ['central'], 'scipy': ['2-point']}
DEFAULT_JACOBIAN = {'analytic': ['default'], 'default': ['default'], 'numdifftools': ['central'], 'scipy': ['2-point']}
DEFAULT_LOGGING = {'append': False, 'external_output': 'log_only', 'file_name': 'fitbenchmarking.log', 'level': 'INFO'}
DEFAULT_MINIMZERS = {'bumps': ['amoeba', 'lm-bumps', 'newton', 'scipy-leastsq'], 'dfo': ['dfogn', 'dfols'], 'gofit': ['multistart'], 'gradient_free': ['HillClimbingOptimizer', 'RepulsingHillClimbingOptimizer', 'SimulatedAnnealingOptimizer', 'RandomSearchOptimizer', 'RandomRestartHillClimbingOptimizer', 'RandomAnnealingOptimizer', 'ParallelTemperingOptimizer', 'ParticleSwarmOptimizer', 'EvolutionStrategyOptimizer'], 'gsl': ['lmsder', 'lmder', 'nmsimplex', 'nmsimplex2', 'conjugate_pr', 'conjugate_fr', 'vector_bfgs', 'vector_bfgs2', 'steepest_descent'], 'horace': ['lm-lsqr'], 'levmar': ['levmar'], 'mantid': ['BFGS', 'Conjugate gradient (Fletcher-Reeves imp.)', 'Conjugate gradient (Polak-Ribiere imp.)', 'Damped GaussNewton', 'Levenberg-Marquardt', 'Levenberg-MarquardtMD', 'Simplex', 'SteepestDescent', 'Trust Region'], 'matlab': ['Nelder-Mead Simplex'], 'matlab_curve': ['Levenberg-Marquardt', 'Trust-Region'], 'matlab_opt': ['levenberg-marquardt', 'trust-region-reflective'], 'matlab_stats': ['Levenberg-Marquardt'], 'minuit': ['minuit'], 'ralfit': ['gn', 'gn_reg', 'hybrid', 'hybrid_reg'], 'scipy': ['Nelder-Mead', 'Powell', 'CG', 'BFGS', 'Newton-CG', 'L-BFGS-B', 'TNC', 'SLSQP'], 'scipy_go': ['differential_evolution', 'dual_annealing'], 'scipy_ls': ['lm-scipy', 'trf', 'dogbox']}
DEFAULT_OUTPUT = {'results_dir': 'fitbenchmarking_results'}
DEFAULT_PLOTTING = {'cmap_range': [0.2, 0.8], 'colour_map': 'magma_r', 'colour_ulim': 100, 'comparison_mode': 'both', 'make_plots': True, 'table_type': ['acc', 'runtime', 'compare', 'local_min']}
VALID = {'FITTING': {'algorithm_type': ['all', 'ls', 'deriv_free', 'general', 'simplex', 'trust_region', 'levenberg-marquardt', 'gauss_newton', 'bfgs', 'conjugate_gradient', 'steepest_descent', 'global_optimization'], 'cost_func_type': ['nlls', 'weighted_nlls', 'hellinger_nlls', 'poisson'], 'hes_method': ['scipy', 'analytic', 'default', 'numdifftools'], 'jac_method': ['scipy', 'analytic', 'default', 'numdifftools'], 'software': ['bumps', 'dfo', 'gofit', 'gradient_free', 'gsl', 'horace', 'levmar', 'mantid', 'matlab', 'matlab_curve', 'matlab_opt', 'matlab_stats', 'minuit', 'ralfit', 'scipy', 'scipy_ls', 'scipy_go']}, 'HESSIAN': {'analytic': ['default'], 'default': ['default'], 'numdifftools': ['central', 'complex', 'multicomplex', 'forward', 'backward'], 'scipy': ['2-point', '3-point', 'cs']}, 'JACOBIAN': {'analytic': ['default'], 'default': ['default'], 'numdifftools': ['central', 'complex', 'multicomplex', 'forward', 'backward'], 'scipy': ['2-point', '3-point', 'cs']}, 'LOGGING': {'append': [True, False], 'external_output': ['debug', 'display', 'log_only'], 'level': ['NOTSET', 'DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']}, 'MINIMIZERS': {'bumps': ['amoeba', 'lm-bumps', 'newton', 'de', 'scipy-leastsq'], 'dfo': ['dfogn', 'dfols'], 'gofit': ['alternating', 'multistart', 'regularisation'], 'gradient_free': ['HillClimbingOptimizer', 'RepulsingHillClimbingOptimizer', 'SimulatedAnnealingOptimizer', 'RandomSearchOptimizer', 'RandomRestartHillClimbingOptimizer', 'RandomAnnealingOptimizer', 'ParallelTemperingOptimizer', 'ParticleSwarmOptimizer', 'EvolutionStrategyOptimizer', 'BayesianOptimizer', 'TreeStructuredParzenEstimators', 'DecisionTreeOptimizer'], 'gsl': ['lmsder', 'lmder', 'nmsimplex', 'nmsimplex2', 'conjugate_pr', 'conjugate_fr', 'vector_bfgs', 'vector_bfgs2', 'steepest_descent'], 'horace': ['lm-lsqr'], 'levmar': ['levmar'], 'mantid': ['BFGS', 'Conjugate gradient (Fletcher-Reeves imp.)', 'Conjugate gradient (Polak-Ribiere imp.)', 'Damped GaussNewton', 'Levenberg-Marquardt', 'Levenberg-MarquardtMD', 'Simplex', 'SteepestDescent', 'Trust Region', 'FABADA'], 'matlab': ['Nelder-Mead Simplex'], 'matlab_curve': ['Levenberg-Marquardt', 'Trust-Region'], 'matlab_opt': ['levenberg-marquardt', 'trust-region-reflective'], 'matlab_stats': ['Levenberg-Marquardt'], 'minuit': ['minuit'], 'ralfit': ['gn', 'gn_reg', 'hybrid', 'hybrid_reg'], 'scipy': ['Nelder-Mead', 'Powell', 'CG', 'BFGS', 'Newton-CG', 'L-BFGS-B', 'TNC', 'SLSQP'], 'scipy_go': ['differential_evolution', 'shgo', 'dual_annealing'], 'scipy_ls': ['lm-scipy', 'trf', 'dogbox']}, 'OUTPUT': {}, 'PLOTTING': {'colour_map': ['Accent', 'Accent_r', 'Blues', 'Blues_r', 'BrBG', 'BrBG_r', 'BuGn', 'BuGn_r', 'BuPu', 'BuPu_r', 'CMRmap', 'CMRmap_r', 'Dark2', 'Dark2_r', 'GnBu', 'GnBu_r', 'Greens', 'Greens_r', 'Greys', 'Greys_r', 'OrRd', 'OrRd_r', 'Oranges', 'Oranges_r', 'PRGn', 'PRGn_r', 'Paired', 'Paired_r', 'Pastel1', 'Pastel1_r', 'Pastel2', 'Pastel2_r', 'PiYG', 'PiYG_r', 'PuBu', 'PuBuGn', 'PuBuGn_r', 'PuBu_r', 'PuOr', 'PuOr_r', 'PuRd', 'PuRd_r', 'Purples', 'Purples_r', 'RdBu', 'RdBu_r', 'RdGy', 'RdGy_r', 'RdPu', 'RdPu_r', 'RdYlBu', 'RdYlBu_r', 'RdYlGn', 'RdYlGn_r', 'Reds', 'Reds_r', 'Set1', 'Set1_r', 'Set2', 'Set2_r', 'Set3', 'Set3_r', 'Spectral', 'Spectral_r', 'Wistia', 'Wistia_r', 'YlGn', 'YlGnBu', 'YlGnBu_r', 'YlGn_r', 'YlOrBr', 'YlOrBr_r', 'YlOrRd', 'YlOrRd_r', 'afmhot', 'afmhot_r', 'autumn', 'autumn_r', 'binary', 'binary_r', 'bone', 'bone_r', 'brg', 'brg_r', 'bwr', 'bwr_r', 'cividis', 'cividis_r', 'cool', 'cool_r', 'coolwarm', 'coolwarm_r', 'copper', 'copper_r', 'cubehelix', 'cubehelix_r', 'flag', 'flag_r', 'gist_earth', 'gist_earth_r', 'gist_gray', 'gist_gray_r', 'gist_heat', 'gist_heat_r', 'gist_ncar', 'gist_ncar_r', 'gist_rainbow', 'gist_rainbow_r', 'gist_stern', 'gist_stern_r', 'gist_yarg', 'gist_yarg_r', 'gnuplot', 'gnuplot2', 'gnuplot2_r', 'gnuplot_r', 'gray', 'gray_r', 'hot', 'hot_r', 'hsv', 'hsv_r', 'inferno', 'inferno_r', 'jet', 'jet_r', 'magma', 'magma_r', 'nipy_spectral', 'nipy_spectral_r', 'ocean', 'ocean_r', 'pink', 'pink_r', 'plasma', 'plasma_r', 'prism', 'prism_r', 'rainbow', 'rainbow_r', 'seismic', 'seismic_r', 'spring', 'spring_r', 'summer', 'summer_r', 'tab10', 'tab10_r', 'tab20', 'tab20_r', 'tab20b', 'tab20b_r', 'tab20c', 'tab20c_r', 'terrain', 'terrain_r', 'turbo', 'turbo_r', 'twilight', 'twilight_r', 'twilight_shifted', 'twilight_shifted_r', 'viridis', 'viridis_r', 'winter', 'winter_r'], 'comparison_mode': ['abs', 'rel', 'both'], 'make_plots': [True, False], 'table_type': ['acc', 'runtime', 'compare', 'local_min']}}
VALID_FITTING = {'algorithm_type': ['all', 'ls', 'deriv_free', 'general', 'simplex', 'trust_region', 'levenberg-marquardt', 'gauss_newton', 'bfgs', 'conjugate_gradient', 'steepest_descent', 'global_optimization'], 'cost_func_type': ['nlls', 'weighted_nlls', 'hellinger_nlls', 'poisson'], 'hes_method': ['scipy', 'analytic', 'default', 'numdifftools'], 'jac_method': ['scipy', 'analytic', 'default', 'numdifftools'], 'software': ['bumps', 'dfo', 'gofit', 'gradient_free', 'gsl', 'horace', 'levmar', 'mantid', 'matlab', 'matlab_curve', 'matlab_opt', 'matlab_stats', 'minuit', 'ralfit', 'scipy', 'scipy_ls', 'scipy_go']}
VALID_HESSIAN = {'analytic': ['default'], 'default': ['default'], 'numdifftools': ['central', 'complex', 'multicomplex', 'forward', 'backward'], 'scipy': ['2-point', '3-point', 'cs']}
VALID_JACOBIAN = {'analytic': ['default'], 'default': ['default'], 'numdifftools': ['central', 'complex', 'multicomplex', 'forward', 'backward'], 'scipy': ['2-point', '3-point', 'cs']}
VALID_LOGGING = {'append': [True, False], 'external_output': ['debug', 'display', 'log_only'], 'level': ['NOTSET', 'DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']}
VALID_MINIMIZERS = {'bumps': ['amoeba', 'lm-bumps', 'newton', 'de', 'scipy-leastsq'], 'dfo': ['dfogn', 'dfols'], 'gofit': ['alternating', 'multistart', 'regularisation'], 'gradient_free': ['HillClimbingOptimizer', 'RepulsingHillClimbingOptimizer', 'SimulatedAnnealingOptimizer', 'RandomSearchOptimizer', 'RandomRestartHillClimbingOptimizer', 'RandomAnnealingOptimizer', 'ParallelTemperingOptimizer', 'ParticleSwarmOptimizer', 'EvolutionStrategyOptimizer', 'BayesianOptimizer', 'TreeStructuredParzenEstimators', 'DecisionTreeOptimizer'], 'gsl': ['lmsder', 'lmder', 'nmsimplex', 'nmsimplex2', 'conjugate_pr', 'conjugate_fr', 'vector_bfgs', 'vector_bfgs2', 'steepest_descent'], 'horace': ['lm-lsqr'], 'levmar': ['levmar'], 'mantid': ['BFGS', 'Conjugate gradient (Fletcher-Reeves imp.)', 'Conjugate gradient (Polak-Ribiere imp.)', 'Damped GaussNewton', 'Levenberg-Marquardt', 'Levenberg-MarquardtMD', 'Simplex', 'SteepestDescent', 'Trust Region', 'FABADA'], 'matlab': ['Nelder-Mead Simplex'], 'matlab_curve': ['Levenberg-Marquardt', 'Trust-Region'], 'matlab_opt': ['levenberg-marquardt', 'trust-region-reflective'], 'matlab_stats': ['Levenberg-Marquardt'], 'minuit': ['minuit'], 'ralfit': ['gn', 'gn_reg', 'hybrid', 'hybrid_reg'], 'scipy': ['Nelder-Mead', 'Powell', 'CG', 'BFGS', 'Newton-CG', 'L-BFGS-B', 'TNC', 'SLSQP'], 'scipy_go': ['differential_evolution', 'shgo', 'dual_annealing'], 'scipy_ls': ['lm-scipy', 'trf', 'dogbox']}
VALID_OUTPUT = {}
VALID_PLOTTING = {'colour_map': ['Accent', 'Accent_r', 'Blues', 'Blues_r', 'BrBG', 'BrBG_r', 'BuGn', 'BuGn_r', 'BuPu', 'BuPu_r', 'CMRmap', 'CMRmap_r', 'Dark2', 'Dark2_r', 'GnBu', 'GnBu_r', 'Greens', 'Greens_r', 'Greys', 'Greys_r', 'OrRd', 'OrRd_r', 'Oranges', 'Oranges_r', 'PRGn', 'PRGn_r', 'Paired', 'Paired_r', 'Pastel1', 'Pastel1_r', 'Pastel2', 'Pastel2_r', 'PiYG', 'PiYG_r', 'PuBu', 'PuBuGn', 'PuBuGn_r', 'PuBu_r', 'PuOr', 'PuOr_r', 'PuRd', 'PuRd_r', 'Purples', 'Purples_r', 'RdBu', 'RdBu_r', 'RdGy', 'RdGy_r', 'RdPu', 'RdPu_r', 'RdYlBu', 'RdYlBu_r', 'RdYlGn', 'RdYlGn_r', 'Reds', 'Reds_r', 'Set1', 'Set1_r', 'Set2', 'Set2_r', 'Set3', 'Set3_r', 'Spectral', 'Spectral_r', 'Wistia', 'Wistia_r', 'YlGn', 'YlGnBu', 'YlGnBu_r', 'YlGn_r', 'YlOrBr', 'YlOrBr_r', 'YlOrRd', 'YlOrRd_r', 'afmhot', 'afmhot_r', 'autumn', 'autumn_r', 'binary', 'binary_r', 'bone', 'bone_r', 'brg', 'brg_r', 'bwr', 'bwr_r', 'cividis', 'cividis_r', 'cool', 'cool_r', 'coolwarm', 'coolwarm_r', 'copper', 'copper_r', 'cubehelix', 'cubehelix_r', 'flag', 'flag_r', 'gist_earth', 'gist_earth_r', 'gist_gray', 'gist_gray_r', 'gist_heat', 'gist_heat_r', 'gist_ncar', 'gist_ncar_r', 'gist_rainbow', 'gist_rainbow_r', 'gist_stern', 'gist_stern_r', 'gist_yarg', 'gist_yarg_r', 'gnuplot', 'gnuplot2', 'gnuplot2_r', 'gnuplot_r', 'gray', 'gray_r', 'hot', 'hot_r', 'hsv', 'hsv_r', 'inferno', 'inferno_r', 'jet', 'jet_r', 'magma', 'magma_r', 'nipy_spectral', 'nipy_spectral_r', 'ocean', 'ocean_r', 'pink', 'pink_r', 'plasma', 'plasma_r', 'prism', 'prism_r', 'rainbow', 'rainbow_r', 'seismic', 'seismic_r', 'spring', 'spring_r', 'summer', 'summer_r', 'tab10', 'tab10_r', 'tab20', 'tab20_r', 'tab20b', 'tab20b_r', 'tab20c', 'tab20c_r', 'terrain', 'terrain_r', 'turbo', 'turbo_r', 'twilight', 'twilight_r', 'twilight_shifted', 'twilight_shifted_r', 'viridis', 'viridis_r', 'winter', 'winter_r'], 'comparison_mode': ['abs', 'rel', 'both'], 'make_plots': [True, False], 'table_type': ['acc', 'runtime', 'compare', 'local_min']}
VALID_SECTIONS = ['MINIMIZERS', 'FITTING', 'JACOBIAN', 'HESSIAN', 'PLOTTING', 'OUTPUT', 'LOGGING']
property minimizers

Returns the minimizers in a software package

read_value(func, option)

Helper function which loads in the value

Parameters
  • func (callable) – configparser function

  • option (str) – option to be read for file

Returns

value of the option

Return type

list/str/int/bool

reset()

Resets options object when running multiple problem groups.

property results_dir: str

Returns the directory to store the results in.

write(file_name)

Write the contents of the options object to a new options file.

Parameters

file_name (str) – The path to the new options file

write_to_stream(file_object)

Write the contents of the options object to a file object.

fitbenchmarking.utils.options.read_list(s)

Utility function to allow lists to be read by the config parser

Parameters

s (string) – string to convert to a list

Returns

list of items

Return type

list of str

fitbenchmarking.utils.options.read_range(s)

Utility function to allow ranges to be read by the config parser

Parameters

s (string) – string to convert to a list

Returns

two element list [lower_lim, upper lim]

Return type

list