aepsych.config

aepsych.config module

class aepsych.config.Config(config_dict=None, config_fnames=None, config_str=None)[source]

Bases: ConfigParser

Initialize the AEPsych config object. This can be used to instantiate most objects in AEPsych by calling object.from_config(config).

Parameters
  • config_dict (Mapping[str, str], optional) – Mapping to build configuration from. Keys are section names, values are dictionaries with keys and values that should be present in the section. Defaults to None.

  • config_fnames (Sequence[str], optional) – List of INI filenames to load configuration from. Defaults to None.

  • config_str (str, optional) – String formatted as an INI file to load configuration from. Defaults to None.

registered_names: ClassVar[Dict[str, object]] = {'AdditiveKernel': <class 'gpytorch.kernels.kernel.AdditiveKernel'>, 'AdditiveStructureKernel': <class 'gpytorch.kernels.additive_structure_kernel.AdditiveStructureKernel'>, 'ApproxGlobalSUR': <class 'aepsych.acquisition.lookahead.ApproxGlobalSUR'>, 'ArcKernel': <class 'gpytorch.kernels.arc_kernel.ArcKernel'>, 'BernoulliLikelihood': <class 'gpytorch.likelihoods.bernoulli_likelihood.BernoulliLikelihood'>, 'BernoulliMCMutualInformation': <class 'aepsych.acquisition.mutual_information.BernoulliMCMutualInformation'>, 'BernoulliObjectiveLikelihood': <class 'aepsych.likelihoods.bernoulli.BernoulliObjectiveLikelihood'>, 'CosineKernel': <class 'gpytorch.kernels.cosine_kernel.CosineKernel'>, 'CylindricalKernel': <class 'gpytorch.kernels.cylindrical_kernel.CylindricalKernel'>, 'DistributionalInputKernel': <class 'gpytorch.kernels.distributional_input_kernel.DistributionalInputKernel'>, 'EAVC': <class 'aepsych.acquisition.lookahead.EAVC'>, 'EpsilonGreedyGenerator': <class 'aepsych.generators.epsilon_greedy_generator.EpsilonGreedyGenerator'>, 'FloorGumbelObjective': <class 'aepsych.acquisition.objective.FloorGumbelObjective'>, 'FloorLogitObjective': <class 'aepsych.acquisition.objective.FloorLogitObjective'>, 'FloorProbitObjective': <class 'aepsych.acquisition.objective.FloorProbitObjective'>, 'GPClassificationModel': <class 'aepsych.models.gp_classification.GPClassificationModel'>, 'GPRegressionModel': <class 'aepsych.models.gp_regression.GPRegressionModel'>, 'GaussianLikelihood': <class 'gpytorch.likelihoods.gaussian_likelihood.GaussianLikelihood'>, 'GaussianSymmetrizedKLKernel': <class 'gpytorch.kernels.gaussian_symmetrized_kl_kernel.GaussianSymmetrizedKLKernel'>, 'GlobalMI': <class 'aepsych.acquisition.lookahead.GlobalMI'>, 'GlobalSUR': <class 'aepsych.acquisition.lookahead.GlobalSUR'>, 'GridInterpolationKernel': <class 'gpytorch.kernels.grid_interpolation_kernel.GridInterpolationKernel'>, 'GridKernel': <class 'gpytorch.kernels.grid_kernel.GridKernel'>, 'IndexKernel': <class 'gpytorch.kernels.index_kernel.IndexKernel'>, 'InducingPointKernel': <class 'gpytorch.kernels.inducing_point_kernel.InducingPointKernel'>, 'Kernel': <class 'gpytorch.kernels.kernel.Kernel'>, 'LCMKernel': <class 'gpytorch.kernels.lcm_kernel.LCMKernel'>, 'LinearKernel': <class 'gpytorch.kernels.linear_kernel.LinearKernel'>, 'LocalMI': <class 'aepsych.acquisition.lookahead.LocalMI'>, 'LocalSUR': <class 'aepsych.acquisition.lookahead.LocalSUR'>, 'MCLevelSetEstimation': <class 'aepsych.acquisition.lse.MCLevelSetEstimation'>, 'MCPosteriorVariance': <class 'aepsych.acquisition.mc_posterior_variance.MCPosteriorVariance'>, 'ManualGenerator': <class 'aepsych.generators.manual_generator.ManualGenerator'>, 'MaternKernel': <class 'gpytorch.kernels.matern_kernel.MaternKernel'>, 'MonotonicBernoulliMCMutualInformation': <class 'aepsych.acquisition.mutual_information.MonotonicBernoulliMCMutualInformation'>, 'MonotonicMCLSE': <class 'aepsych.acquisition.monotonic_rejection.MonotonicMCLSE'>, 'MonotonicMCPosteriorVariance': <class 'aepsych.acquisition.mc_posterior_variance.MonotonicMCPosteriorVariance'>, 'MonotonicProjectionGP': <class 'aepsych.models.monotonic_projection_gp.MonotonicProjectionGP'>, 'MonotonicRejectionGP': <class 'aepsych.models.monotonic_rejection_gp.MonotonicRejectionGP'>, 'MonotonicRejectionGenerator': <class 'aepsych.generators.monotonic_rejection_generator.MonotonicRejectionGenerator'>, 'MonotonicThompsonSamplerGenerator': <class 'aepsych.generators.monotonic_thompson_sampler_generator.MonotonicThompsonSamplerGenerator'>, 'MultiDeviceKernel': <class 'gpytorch.kernels.multi_device_kernel.MultiDeviceKernel'>, 'MultitaskKernel': <class 'gpytorch.kernels.multitask_kernel.MultitaskKernel'>, 'NewtonGirardAdditiveKernel': <class 'gpytorch.kernels.newton_girard_additive_kernel.NewtonGirardAdditiveKernel'>, 'None': None, 'OptimizeAcqfGenerator': <class 'aepsych.generators.optimize_acqf_generator.OptimizeAcqfGenerator'>, 'OrdinalGPModel': <class 'aepsych.models.ordinal_gp.OrdinalGPModel'>, 'OrdinalLikelihood': <class 'aepsych.likelihoods.ordinal.OrdinalLikelihood'>, 'PairwiseOptimizeAcqfGenerator': <class 'aepsych.generators.pairwise_optimize_acqf_generator.PairwiseOptimizeAcqfGenerator'>, 'PairwiseProbitModel': <class 'aepsych.models.pairwise_probit.PairwiseProbitModel'>, 'PairwiseSobolGenerator': <class 'aepsych.generators.pairwise_sobol_generator.PairwiseSobolGenerator'>, 'PeriodicKernel': <class 'gpytorch.kernels.periodic_kernel.PeriodicKernel'>, 'PiecewisePolynomialKernel': <class 'gpytorch.kernels.piecewise_polynomial_kernel.PiecewisePolynomialKernel'>, 'PolynomialKernel': <class 'gpytorch.kernels.polynomial_kernel.PolynomialKernel'>, 'PolynomialKernelGrad': <class 'gpytorch.kernels.polynomial_kernel_grad.PolynomialKernelGrad'>, 'ProbitObjective': <class 'aepsych.acquisition.objective.ProbitObjective'>, 'ProductKernel': <class 'gpytorch.kernels.kernel.ProductKernel'>, 'ProductStructureKernel': <class 'gpytorch.kernels.product_structure_kernel.ProductStructureKernel'>, 'RBFKernel': <class 'gpytorch.kernels.rbf_kernel.RBFKernel'>, 'RBFKernelGrad': <class 'gpytorch.kernels.rbf_kernel_grad.RBFKernelGrad'>, 'RFFKernel': <class 'gpytorch.kernels.rff_kernel.RFFKernel'>, 'RQKernel': <class 'gpytorch.kernels.rq_kernel.RQKernel'>, 'RandomGenerator': <class 'aepsych.generators.random_generator.RandomGenerator'>, 'ScaleKernel': <class 'gpytorch.kernels.scale_kernel.ScaleKernel'>, 'SequentialStrategy': <class 'aepsych.strategy.SequentialStrategy'>, 'SobolGenerator': <class 'aepsych.generators.sobol_generator.SobolGenerator'>, 'SpectralDeltaKernel': <class 'gpytorch.kernels.spectral_delta_kernel.SpectralDeltaKernel'>, 'SpectralMixtureKernel': <class 'gpytorch.kernels.spectral_mixture_kernel.SpectralMixtureKernel'>, 'Strategy': <class 'aepsych.strategy.Strategy'>, 'default_mean_covar_factory': <function default_mean_covar_factory>, 'monotonic_mean_covar_factory': <function monotonic_mean_covar_factory>, 'ordinal_mean_covar_factory': <function ordinal_mean_covar_factory>, 'song_mean_covar_factory': <function song_mean_covar_factory>}
to_dict(deduplicate=True)[source]
jsonifyMetadata()[source]
jsonifyAll()[source]
update(config_dict=None, config_fnames=None, config_str=None)[source]

Update this object with a new configuration.

Parameters
  • config_dict (Mapping[str, str], optional) – Mapping to build configuration from. Keys are section names, values are dictionaries with keys and values that should be present in the section. Defaults to None.

  • config_fnames (Sequence[str], optional) – List of INI filenames to load configuration from. Defaults to None.

  • config_str (str, optional) – String formatted as an INI file to load configuration from. Defaults to None.

classmethod register_module(module)[source]
Register a module with Config so that objects in it can

be referred to by their string name in config files.

Parameters

module (ModuleType) – Module to register.

classmethod register_object(obj)[source]
Register an object with Config so that it can be

referred to by its string name in config files.

Parameters

obj (object) – Object to register.

get_section(section)[source]
convert_to_latest()[source]
convert(from_version, to_version)[source]

Converts a config from an older version to a newer version.

Parameters
  • from_version (str) – The version of the config to be converted.

  • to_version (str) – The version the config should be converted to.

Return type

None

property version: str

Returns the version number of the config.