Class MultiConditionDataProviderHDF5

Inheritance Relationships

Base Type

Class Documentation

class parpe::MultiConditionDataProviderHDF5 : public parpe::MultiConditionDataProvider

The MultiConditionDataProvider class reads simulation data for MultiConditionOptimizationProblem from a HDF5 file.

This class assumes a certain layout of the underlying HDF5 file. Der dataset names can be modified in hdf5*Path members.

Required dimensions:

  • hdf5MeasurementPath, hdf5MeasurementSigmaPath: numObservables x numConditions

  • hdf5ConditionPath: numFixedParameters x numConditions

  • hdf5AmiciOptionPath:

  • hdf5ParameterPath:

NOTE: The following dimensions are determined by the used AMICI model:

  • numObservables := Model::ny

  • numFixedParameters := Model::nk

Public Functions

MultiConditionDataProviderHDF5() = default
MultiConditionDataProviderHDF5(std::unique_ptr<amici::Model> model, const std::string &hdf5Filename)

MultiConditionDataProvider.

Parameters
  • model – A valid pointer to the amici::Model for which the data is to be provided.

  • hdf5Filename – Path to the HDF5 file from which the data is to be read

MultiConditionDataProviderHDF5(std::unique_ptr<amici::Model> model, std::string const &hdf5Filename, std::string const &rootPath)

See above.

Parameters
  • model

  • hdf5Filename

  • rootPath – The name of the HDF5 group under which the data is stored.

MultiConditionDataProviderHDF5(MultiConditionDataProviderHDF5 const&) = delete
virtual ~MultiConditionDataProviderHDF5() override
virtual int getNumberOfSimulationConditions() const override

Get the number of simulations required for objective function evaluation. Currently, this amounts to the number of conditions present in the data.

Returns

Number of conditions

virtual std::vector<int> getSimulationToOptimizationParameterMapping(int conditionIdx) const override

Get index vector of length of model parameter with indices of optimization parameters for the given condition.

NOTE: This may contain -1 for parameter which are not mapped.

Parameters

conditionIdx

Returns

virtual void mapSimulationToOptimizationGradientAddMultiply(int conditionIdx, gsl::span<double const> simulation, gsl::span<double> optimization, gsl::span<const double> parameters, double coefficient = 1.0) const override
virtual void mapAndSetOptimizationToSimulationVariables(int conditionIdx, gsl::span<double const> optimization, gsl::span<double> simulation, gsl::span<amici::ParameterScaling> optimizationScale, gsl::span<amici::ParameterScaling> simulationScale) const override
virtual std::vector<amici::ParameterScaling> getParameterScaleOpt() const override
virtual amici::ParameterScaling getParameterScaleOpt(int parameterIdx) const override

Get the parameter scale for the given optimization parameter.

Parameters

simulationIdx

Returns

Parameter scale

virtual std::vector<amici::ParameterScaling> getParameterScaleSim(int simulationIdx) const override

Get the parameter scale vector for the given simulation.

Parameters

simulationIdx

Returns

virtual amici::ParameterScaling getParameterScaleSim(int simulationIdx, int modelParameterIdx) const override

Get the parameter scale for the given parameter and simulation.

Parameters

simulationIdx

Returns

virtual void checkDataIntegrity() const

Check if the data in the HDF5 file has consistent dimensions. Aborts if not.

virtual void readFixedSimulationParameters(int conditionIdx, gsl::span<double> buffer) const
virtual std::unique_ptr<amici::ExpData> getExperimentalDataForCondition(int conditionIdx) const override
virtual std::vector<std::vector<double>> getAllMeasurements() const override
virtual std::vector<std::vector<double>> getAllSigmas() const override
std::vector<double> getSigmaForSimulationIndex(int simulationIdx) const
std::vector<double> getMeasurementForSimulationIndex(int conditionIdx) const
virtual void getOptimizationParametersLowerBounds(gsl::span<double> buffer) const

Writes lower parameter bounds into the provided buffer.

Parameters

buffer – allocated memory to write parameter bounds

virtual void getOptimizationParametersUpperBounds(gsl::span<double> buffer) const

Writes upper parameter bounds into the provided buffer.

Parameters

buffer – allocated memory to write parameter bounds

virtual int getNumOptimizationParameters() const override

Returns the number of optimization parameters of this problem.

Returns

Number of parameters

virtual std::unique_ptr<amici::Model> getModel() const override

Returns a pointer to a copy of the underlying AMICI model as provided to the constructor.

Returns

The model

virtual std::unique_ptr<amici::Solver> getSolver() const override
virtual void updateSimulationParametersAndScale(int simulationIdx, gsl::span<const double> optimizationParams, amici::Model &model) const override

Based on the array of optimization parameters, set the simulation parameters in the given Model object to the ones for simulation index.

Parameters
  • simulationIdx – Index of the simulation condition for which to set model parameters.

  • optimizationParams – Problem parameters from which to extract simulation parameters.

  • modelModel on which to set parameter values and scale

void copyInputData(const H5::H5File &target)
void getSimAndPreeqConditions(const int simulationIdx, int &preequilibrationConditionIdx, int &simulationConditionIdx) const
std::vector<int> getReinitializationIndices(const int simulationIdx) const
H5::H5File getHdf5File() const

Get a copy of the HDF5 file handle.

Returns

File handle

void setModel(std::unique_ptr<amici::Model> model)
virtual std::vector<std::string> getProblemParameterIds() const override

Protected Functions

void updateFixedSimulationParameters(int conditionIdx, amici::ExpData &edata) const

Update the constants in AMICI ExpData object. Reads a slab for the given simulation from fixed parameters matrix.

Parameters
  • simulationIdx – Index of the experimental condition for which the parameters should be taken.

  • edata – The object to be updated.