本文整理汇总了C++中Spectrum::get_peak方法的典型用法代码示例。如果您正苦于以下问题:C++ Spectrum::get_peak方法的具体用法?C++ Spectrum::get_peak怎么用?C++ Spectrum::get_peak使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Spectrum
的用法示例。
在下文中一共展示了Spectrum::get_peak方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: score_a_single_breakage_combo
/****************************************************************************
Returns the score of the variable element in the breakages:
the strong features that are aa dependant.
*****************************************************************************/
score_t RegionalScoreModel::score_a_single_breakage_combo(
PrmGraph *prm,
Node& node,
const Breakage *breakage,
BreakageInfo& info,
bool verbose) const
{
if (node.type == NODE_N_TERM || node.type == NODE_C_TERM)
{
const score_t terminal_score=config->get_terminal_score();
info.score = terminal_score;
return terminal_score;
}
Spectrum *spec = prm->get_source_spectrum();
const mass_t pm_with_19 = prm->get_pm_with_19();
if (node.const_strong_exps.size()==0)
calc_constant_element(node,spec,pm_with_19,breakage);
const bool print_all = false;
score_t score=0;
int f;
for (f=0; f<this->strong_models.size(); f++)
{
const StrongFragModel& strong_model = strong_models[f];
const int frag_idx = strong_model.model_frag_idx;
if (! strong_model.ind_has_models)
continue;
if (! breakage->is_frag_type_visible(frag_idx))
continue;
ME_Regression_Sample sam;
sam.f_vals.clear();
strong_model.fill_aa_variable_vals(spec,pm_with_19,breakage,&info,sam.f_vals);
score_t prev = score;
const int pos = breakage->get_position_of_frag_idx(frag_idx);
if (pos>=0)
{
const float var_exp = strong_model.inten_model.get_sum_exp(sam);
const float e = exp(var_exp + node.const_strong_exps[f]);
float prob = e/(1.0 + e);
if (prob>0.99)
prob=0.99;
if (prob<0.001)
prob=0.001;
const float log_random_peak = spec->get_peak(breakage->fragments[pos].peak_idx).log_rand_prob;
score += (strong_model.inten_log_scaling_factor + log(prob) - log_random_peak);
if (print_all)
{
cout << "viz >> SCORE " << score << "\t(lrp= " << log_random_peak << " , ilsf=" << strong_model.inten_log_scaling_factor <<
" , lp=" << log(prob) << " , lrandp=" << log_random_peak << endl;
}
}
else
{
const float var_exp = strong_model.no_inten_model.get_sum_exp(sam);
const float e = exp(var_exp + node.const_strong_exps[f]);
float prob = e/(1.0 + e);
if (prob>0.99)
prob=0.99;
if (prob<0.01)
prob=0.01;
score += (strong_model.no_inten_log_scaling_factor + log(prob) - log_one_minus_random);
if (print_all)
{
cout << "no viz >> SCORE " << score << "\t(nilsf=" << strong_model.inten_log_scaling_factor <<
" , lp=" << log(prob) << " , loneminusrandp=" << log_one_minus_random << endl;
}
}
if (verbose)
{
cout << setprecision(4) << fixed << f << "\t" << score-prev << endl;
}
}
for (f=0; f<regular_models.size(); f++)
{
const RegularFragModel& regular_model = regular_models[f];
const int frag_idx = regular_model.model_frag_idx;
if (! regular_model.ind_has_models)
continue;
//.........这里部分代码省略.........