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¶ See base class.
- Return
- Parameters
parameters
:fval
:gradient
:
-
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.
- Return
-
std::vector<double>
getDefaultOffsetParameters
() const¶ Get parameters for initial function evaluation.
- Return
-
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.
- Return
Vector of double vectors containing AMICI ReturnData::y (nt x ny, column-major)
- Parameters
reducedParameters
: parameter vector forfun
without scaling parameters
-
std::vector<double>
computeAnalyticalScalings
(std::vector<std::vector<double>> const &measurements, std::vector<std::vector<double>> const &modelOutputsUnscaled) const¶ Compute proportionality factors.
- Return
the computed scaling factors
- Parameters
modelOutputs
: Model outputs as provided by getModelOutputs
-
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.
- Return
the computed offset parameters
- Parameters
modelOutputs
: Model outputs as provided by getModelOutputs
-
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.
- Return
- Parameters
sigmas
:
-
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.- Return
- Parameters
reducedParameters
: Parameter vector without scaling and offset parametersscalings
: Optimal scaling parametersoffsets
: Optimal offset parametersmodelOutputsUnscaled
: Model outputs before applying optimal offset and scaling parametersfval
: out: computed function valuegradient
: out: computed function gradient
-
virtual int
numParameters
() const override¶ Get number of parameters the function expects.
- Return
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¶
-