本文整理汇总了C++中ModelType::getConPrb方法的典型用法代码示例。如果您正苦于以下问题:C++ ModelType::getConPrb方法的具体用法?C++ ModelType::getConPrb怎么用?C++ ModelType::getConPrb使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelType
的用法示例。
在下文中一共展示了ModelType::getConPrb方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: calcConProbs
void* calcConProbs(void* arg) {
Params *params = (Params*)arg;
ModelType *model = (ModelType*)(params->model);
ReadReader<ReadType> *reader = (ReadReader<ReadType>*)(params->reader);
HitContainer<HitType> *hitv = (HitContainer<HitType>*)(params->hitv);
double *ncpv = (double*)(params->ncpv);
ReadType read;
READ_INT_TYPE N = hitv->getN();
HIT_INT_TYPE fr, to;
assert(model->getNeedCalcConPrb());
reader->reset();
for (READ_INT_TYPE i = 0; i < N; i++) {
general_assert(reader->next(read), "Can not load a read!");
fr = hitv->getSAt(i);
to = hitv->getSAt(i + 1);
ncpv[i] = model->getNoiseConPrb(read);
for (HIT_INT_TYPE j = fr; j < to; j++) {
HitType &hit = hitv->getHitAt(j);
hit.setConPrb(model->getConPrb(read, hit));
}
}
return NULL;
}
示例2: E_STEP
void* E_STEP(void* arg) {
Params *params = (Params*)arg;
ModelType *model = (ModelType*)(params->model);
ReadReader<ReadType> *reader = (ReadReader<ReadType>*)(params->reader);
HitContainer<HitType> *hitv = (HitContainer<HitType>*)(params->hitv);
double *ncpv = (double*)(params->ncpv);
ModelType *mhp = (ModelType*)(params->mhp);
double *countv = (double*)(params->countv);
bool needCalcConPrb = model->getNeedCalcConPrb();
ReadType read;
READ_INT_TYPE N = hitv->getN();
double sum;
vector<double> fracs; //to remove this, do calculation twice
HIT_INT_TYPE fr, to, id;
if (needCalcConPrb || updateModel) { reader->reset(); }
if (updateModel) { mhp->init(); }
memset(countv, 0, sizeof(double) * (M + 1));
for (READ_INT_TYPE i = 0; i < N; i++) {
if (needCalcConPrb || updateModel) {
general_assert(reader->next(read), "Can not load a read!");
}
fr = hitv->getSAt(i);
to = hitv->getSAt(i + 1);
fracs.resize(to - fr + 1);
sum = 0.0;
if (needCalcConPrb) { ncpv[i] = model->getNoiseConPrb(read); }
fracs[0] = probv[0] * ncpv[i];
if (fracs[0] < EPSILON) fracs[0] = 0.0;
sum += fracs[0];
for (HIT_INT_TYPE j = fr; j < to; j++) {
HitType &hit = hitv->getHitAt(j);
if (needCalcConPrb) { hit.setConPrb(model->getConPrb(read, hit)); }
id = j - fr + 1;
fracs[id] = probv[hit.getSid()] * hit.getConPrb();
if (fracs[id] < EPSILON) fracs[id] = 0.0;
sum += fracs[id];
}
if (sum >= EPSILON) {
fracs[0] /= sum;
countv[0] += fracs[0];
if (updateModel) { mhp->updateNoise(read, fracs[0]); }
if (calcExpectedWeights) { ncpv[i] = fracs[0]; }
for (HIT_INT_TYPE j = fr; j < to; j++) {
HitType &hit = hitv->getHitAt(j);
id = j - fr + 1;
fracs[id] /= sum;
countv[hit.getSid()] += fracs[id];
if (updateModel) { mhp->update(read, hit, fracs[id]); }
if (calcExpectedWeights) { hit.setConPrb(fracs[id]); }
}
}
else if (calcExpectedWeights) {
ncpv[i] = 0.0;
for (HIT_INT_TYPE j = fr; j < to; j++) {
HitType &hit = hitv->getHitAt(j);
hit.setConPrb(0.0);
}
}
}
return NULL;
}