-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathparameters.cpp
More file actions
54 lines (49 loc) · 1.61 KB
/
parameters.cpp
File metadata and controls
54 lines (49 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include "parameters.hpp"
#include "aux.hpp"
using namespace std;
namespace STD {
GaussianProcessParameters::GaussianProcessParameters(size_t first_iter,
bool mean, bool center_)
: first_iteration(first_iter), free_mean(mean), center(center_) {}
double Hyperparameters::get_param(Coefficient::Type distribution,
size_t idx) const {
switch (distribution) {
case Coefficient::Type::gamma:
if (idx == 0)
return gamma_1;
else
return gamma_2;
case Coefficient::Type::beta:
if (idx == 0)
return beta_1;
else
return beta_2;
case Coefficient::Type::beta_prime:
if (idx == 0)
return beta_prime_1;
else
return beta_prime_2;
case Coefficient::Type::normal:
if (idx == 0)
return normal_1;
else
return normal_2;
default:
throw std::runtime_error(
"Error: no default hyper parameters defined for chosen "
"distribution.");
break;
}
}
std::ostream &operator<<(std::ostream &os, const Hyperparameters &hyperparams) {
os << "gamma_1 = " << hyperparams.gamma_1 << endl;
os << "gamma_2 = " << hyperparams.gamma_2 << endl;
os << "beta_1 = " << hyperparams.beta_1 << endl;
os << "beta_2 = " << hyperparams.beta_2 << endl;
os << "beta_prime_1 = " << hyperparams.beta_prime_1 << endl;
os << "beta_prime_2 = " << hyperparams.beta_prime_2 << endl;
os << "normal_1 = " << hyperparams.normal_1 << endl;
os << "normal_2 = " << hyperparams.normal_2 << endl;
return os;
}
} // namespace STD