本文整理汇总了C++中Gaussian::init_pi_tau方法的典型用法代码示例。如果您正苦于以下问题:C++ Gaussian::init_pi_tau方法的具体用法?C++ Gaussian::init_pi_tau怎么用?C++ Gaussian::init_pi_tau使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gaussian
的用法示例。
在下文中一共展示了Gaussian::init_pi_tau方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _internal_update
void SumFactor::_internal_update(
Variable* var,
std::vector<Gaussian*> y,
std::vector<Gaussian*> fy,
std::vector<double>* a) {
double sum_pi = 0.0, sum_tau = 0.0, new_pi, new_tau, da;
unsigned int i = 0, size = a->size();
Gaussian gy, gfy;
for (i = 0; i < size; ++i) {
da = (*a)[i];
gy = *y[i];
gfy = *fy[i];
sum_pi = sum_pi + ((da * da) / (gy.pi - gfy.pi));
sum_tau = sum_tau + (da * (gy.tau - gfy.tau) / (gy.pi - gfy.pi));
}
new_pi = 1.0 / sum_pi;
new_tau = new_pi * sum_tau;
Gaussian* gaussian = new Gaussian();
gaussian->init_pi_tau(new_pi, new_tau);
var->update_message(this, gaussian);
}
示例2: update_mean
void LikelihoodFactor::update_mean() {
Gaussian x = *this->value->value;
Gaussian fx = *this->value->get_message(this);
double a = 1.0 / (1.0 + this->variance * (x.pi - fx.pi));
Gaussian* gaussian = new Gaussian();
gaussian->init_pi_tau(
a * (x.pi - fx.pi),
a * (x.tau - fx.tau)
);
this->mean->update_message(this, gaussian);
}
示例3: update
void TruncateFactorDraw::update() {
Gaussian* x = this->variable->value;
Gaussian* fx = this->variable->get_message(this);
double c, d, sqrt_c, V, W, t, e, mW;
c = x->pi - fx->pi;
d = x->tau = fx->tau;
sqrt_c = sqrt(c);
t = d / sqrt_c;
e = epsilon * sqrt_c;
V = Vdraw(t, e);
W = Wdraw(t, e);
mW = 1.0 - W;
Gaussian* gaussian = new Gaussian();
gaussian->init_pi_tau(c / mW, (d + sqrt_c * V) / mW);
this->variable->update_value(this, gaussian);
}