Go to the documentation of this file. 1 #ifndef HOPS_GAMMAMODELS_HPP
2 #define HOPS_GAMMAMODELS_HPP
13 double gammaProbabilityDensityFunction(
double x,
double location,
double scale,
double shape) {
14 if (scale <= 0 || shape <= 0) {
15 throw std::runtime_error(
"scale and shape parameters have to be larger than 0.");
17 if (x - location < 0) {
20 return (std::pow(x - location, shape - 1) * std::exp(-(x - location) / scale)) /
21 (std::tgamma(shape) * std::pow(scale, shape));
31 explicit FullGammaModel(std::vector<FloatType> measurements) : measurements(std::move(measurements)) {
41 b << 0.9, 0., 10, -0.1, 10, -0.1;
46 for (
const auto &measurement : this->measurements) {
48 gammaProbabilityDensityFunction(measurement,
58 return parameterNames;
74 std::vector<std::string> parameterNames = {
"location",
"scale",
"shape"};
78 std::vector<FloatType> measurements;
87 explicit GammaModel1(std::vector<FloatType> measurements) : measurements(std::move(measurements)) {
95 b << 0.9, 0., 10, -0.1;
100 for (
const auto &measurement : this->measurements) {
102 gammaProbabilityDensityFunction(measurement,
112 return parameterNames;
128 std::vector<std::string> parameterNames = {
"location",
"shape"};
132 std::vector<FloatType> measurements;
133 constexpr
static const double scale = 1;
141 explicit GammaModel2(std::vector<FloatType> measurements) : measurements(std::move(measurements)) {
149 b << 10, -0.1, 10, -0.1;
154 for (
const auto &measurement : this->measurements) {
156 gammaProbabilityDensityFunction(measurement,
166 return parameterNames;
182 std::vector<std::string> parameterNames = {
"scale",
"shape"};
186 std::vector<FloatType> measurements;
188 constexpr
static double location = 0;
197 explicit MinimalGammaModel(std::vector<FloatType> measurements) : measurements(std::move(measurements)) {
206 for (
const auto &measurement : this->measurements) {
208 gammaProbabilityDensityFunction(measurement,
218 return parameterNames;
234 std::vector<std::string> parameterNames = {
"shape"};
238 std::vector<FloatType> measurements;
240 constexpr
static double location = 0;
241 constexpr
static double scale = 1;
246 #endif //HOPS_GAMMAMODELS_HPP
Definition: GammaModels.hpp:27
Definition: GammaModels.hpp:83
FloatType computeNegativeLogLikelihood(const VectorType ¶meters) const
Definition: GammaModels.hpp:44
Eigen::MatrixXd MatrixType
Definition: MatrixType.hpp:7
MatrixType getA() const
Definition: GammaModels.hpp:173
GammaModel1(std::vector< FloatType > measurements)
Definition: GammaModels.hpp:87
MinimalGammaModel(std::vector< FloatType > measurements)
Definition: GammaModels.hpp:197
typename VectorType::Scalar FloatType
Definition: GammaModels.hpp:195
GammaModel2(std::vector< FloatType > measurements)
Definition: GammaModels.hpp:141
const std::string & getModelName() const
Definition: GammaModels.hpp:123
typename VectorType::Scalar FloatType
Definition: GammaModels.hpp:29
const std::vector< std::string > & getParameterNames() const
Definition: GammaModels.hpp:111
const std::vector< std::string > & getParameterNames() const
Definition: GammaModels.hpp:57
FullGammaModel(std::vector< FloatType > measurements)
Definition: GammaModels.hpp:31
const std::string & getModelName() const
Definition: GammaModels.hpp:177
Definition: GammaModels.hpp:193
MatrixType getA() const
Definition: GammaModels.hpp:119
FloatType computeNegativeLogLikelihood(const VectorType ¶meters) const
Definition: GammaModels.hpp:98
FloatType computeNegativeLogLikelihood(const VectorType ¶meters) const
Definition: GammaModels.hpp:204
VectorType getB() const
Definition: GammaModels.hpp:61
typename VectorType::Scalar FloatType
Definition: GammaModels.hpp:85
MatrixType getA() const
Definition: GammaModels.hpp:225
typename VectorType::Scalar FloatType
Definition: GammaModels.hpp:139
const std::vector< std::string > & getParameterNames() const
Definition: GammaModels.hpp:217
Definition: CsvReader.hpp:8
VectorType getB() const
Definition: GammaModels.hpp:221
FloatType computeNegativeLogLikelihood(const VectorType ¶meters) const
Definition: GammaModels.hpp:152
const std::string & getModelName() const
Definition: GammaModels.hpp:69
MatrixType getA() const
Definition: GammaModels.hpp:65
NAME string(REPLACE ".cpp" "_bin" example_name ${example_filename}) if($
Definition: hops/Third-party/HighFive/src/examples/CMakeLists.txt:6
VectorType getB() const
Definition: GammaModels.hpp:115
Eigen::VectorXd VectorType
Definition: VectorType.hpp:7
Definition: GammaModels.hpp:137
const std::vector< std::string > & getParameterNames() const
Definition: GammaModels.hpp:165
VectorType getB() const
Definition: GammaModels.hpp:169
const std::string & getModelName() const
Definition: GammaModels.hpp:229