Class HierarchicalOptimizationWrapper¶
Defined in File hierarchicalOptimization.h
Inheritance Relationships¶
Base Type¶
public parpe::GradientFunction
(Class GradientFunction)
Class Documentation¶
-
class parpe::HierarchicalOptimizationWrapper : public parpe::GradientFunction¶
The HierarchicalOptimizationWrapper class is a wrapper for hierarchical optimization of scaling parameters.
Parameters with the given indices are hidden by the wrapper and computed analytically internally.
Computes the negative log likelihood for normally distributed measurement (others to be added).
Public Functions
-
HierarchicalOptimizationWrapper(AmiciSummedGradientFunction *wrapped_function, int numConditions = 0, int numObservables = 0)¶
For testing.
- Parameters
fun –
numConditions –
numObservables –
numTimepoints –
-
HierarchicalOptimizationWrapper(AmiciSummedGradientFunction *wrapped_function, const H5::H5File &file, const std::string &hdf5RootPath, int numConditions, int numObservables, ErrorModel errorModel)¶
Get information on analytically computed parameters from HDF5 file.
- Parameters
fun –
file –
hdf5RootPath –
numConditions –
numObservables –
errorModel –
-
HierarchicalOptimizationWrapper(AmiciSummedGradientFunction *wrapped_function, std::unique_ptr<AnalyticalParameterProvider> scalingReader, std::unique_ptr<AnalyticalParameterProvider> offsetReader, std::unique_ptr<AnalyticalParameterProvider> sigmaReader, int numConditions, int numObservables, ErrorModel errorModel)¶
Get information on analytically computed parameters from the provided objects.
- Parameters
fun –
scalingReader –
offsetReader –
numConditions –
numObservables –
errorModel –
-
virtual FunctionEvaluationStatus evaluate(gsl::span<double const> parameters, double &fval, gsl::span<double> gradient, Logger *logger, double *cpuTime) const override¶
-
FunctionEvaluationStatus evaluate(gsl::span<double const> reducedParameters, double &fval, gsl::span<double> gradient, std::vector<double> &fullParameters, std::vector<double> &fullGradient, Logger *logger, double *cpuTime) const¶
-
std::vector<double> getDefaultScalingFactors() const¶
Get parameters for initial function evaluation.
- Returns
-
std::vector<double> getDefaultOffsetParameters() const¶
Get parameters for initial function evaluation.
- Returns
-
std::vector<double> getDefaultSigmaParameters() const¶
-
std::tuple<std::vector<std::vector<double>>, std::vector<std::vector<double>>> getUnscaledModelOutputsAndSigmas(const gsl::span<double const> reducedParameters, Logger *logger, double *cpuTime) const¶
Run simulations with scaling parameters set to 1.0 and collect model outputs.
- Parameters
reducedParameters – parameter vector for
fun
without scaling parameters- Returns
Vector of double vectors containing AMICI ReturnData::y (nt x ny, column-major)
-
std::vector<double> computeAnalyticalScalings(std::vector<std::vector<double>> const &measurements, std::vector<std::vector<double>> const &modelOutputsUnscaled) const¶
Compute proportionality factors.
- Parameters
modelOutputs – Model outputs as provided by getModelOutputs
- Returns
the computed scaling factors
-
void applyOptimalScalings(std::vector<double> const &proportionalityFactors, std::vector<std::vector<double>> &modelOutputs) const¶
-
std::vector<double> computeAnalyticalOffsets(const std::vector<std::vector<double>> &measurements, std::vector<std::vector<double>> &modelOutputsUnscaled) const¶
Compute offset parameters.
- Parameters
modelOutputs – Model outputs as provided by getModelOutputs
- Returns
the computed offset parameters
-
std::vector<double> computeAnalyticalSigmas(std::vector<std::vector<double>> const &measurements, const std::vector<std::vector<double>> &modelOutputsScaled) const¶
-
void applyOptimalOffsets(std::vector<double> const &offsetParameters, std::vector<std::vector<double>> &modelOutputs) const¶
-
void fillInAnalyticalSigmas(std::vector<std::vector<double>> &allSigmas, const std::vector<double> &analyticalSigmas) const¶
Create vector with sigma matrix for each condition and timepoints from the given analytically computed sigmas.
- Parameters
sigmas –
- Returns
-
virtual FunctionEvaluationStatus evaluateWithOptimalParameters(std::vector<double> const &fullParameters, std::vector<double> const &sigmas, std::vector<std::vector<double>> const &measurements, std::vector<std::vector<double>> const &modelOutputsScaled, std::vector<std::vector<double>> &fullSigmaMatrices, double &fval, const gsl::span<double> gradient, std::vector<double> &fullGradient, Logger *logger, double *cpuTime) const¶
Evaluate
fun
using the computed optimal scaling and offset parameters.- Parameters
reducedParameters – Parameter vector without scaling and offset parameters
scalings – Optimal scaling parameters
offsets – Optimal offset parameters
modelOutputsUnscaled – Model outputs before applying optimal offset and scaling parameters
fval – out: computed function value
gradient – out: computed function gradient
- Returns
-
virtual int numParameters() const override¶
Get number of parameters the function expects.
- Returns
That
-
int numProportionalityFactors() const¶
-
std::vector<int> const &getProportionalityFactorIndices() const¶
-
int numOffsetParameters() const¶
-
int numSigmaParameters() const¶
-
std::vector<int> const &getOffsetParameterIndices() const¶
-
std::vector<int> const &getSigmaParameterIndices() const¶
-
std::vector<int> getAnalyticalParameterIndices() const¶
-
AmiciSummedGradientFunction *getWrappedFunction() const¶
-
virtual std::vector<std::string> getParameterIds() const override¶
-
HierarchicalOptimizationWrapper(AmiciSummedGradientFunction *wrapped_function, int numConditions = 0, int numObservables = 0)¶