本文整理汇总了C++中Parameters::ComputeScore方法的典型用法代码示例。如果您正苦于以下问题:C++ Parameters::ComputeScore方法的具体用法?C++ Parameters::ComputeScore怎么用?C++ Parameters::ComputeScore使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parameters
的用法示例。
在下文中一共展示了Parameters::ComputeScore方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ComputeScores
void DependencyPipe::ComputeScores(Instance *instance, Parts *parts,
Features *features,
bool pruner,
vector<double> *scores) {
Parameters *parameters;
if (pruner) {
parameters = pruner_parameters_;
} else {
parameters = parameters_;
}
scores->resize(parts->size());
DependencyParts *dependency_parts = static_cast<DependencyParts*>(parts);
for (int r = 0; r < parts->size(); ++r) {
// Labeled arcs will be treated by looking at the unlabeled arcs and
// conjoining with the label.
if (pruner) CHECK_EQ((*parts)[r]->type(), DEPENDENCYPART_ARC);
if ((*parts)[r]->type() == DEPENDENCYPART_LABELEDARC) continue;
const BinaryFeatures &part_features = features->GetPartFeatures(r);
if ((*parts)[r]->type() == DEPENDENCYPART_ARC && !pruner &&
GetDependencyOptions()->labeled()) {
(*scores)[r] = 0.0;
DependencyPartArc *arc = static_cast<DependencyPartArc*>((*parts)[r]);
const vector<int> &index_labeled_parts =
dependency_parts->FindLabeledArcs(arc->head(), arc->modifier());
vector<int> allowed_labels(index_labeled_parts.size());
for (int k = 0; k < index_labeled_parts.size(); ++k) {
DependencyPartLabeledArc *labeled_arc =
static_cast<DependencyPartLabeledArc*>(
(*parts)[index_labeled_parts[k]]);
allowed_labels[k] = labeled_arc->label();
}
vector<double> label_scores;
parameters->ComputeLabelScores(part_features, allowed_labels,
&label_scores);
for (int k = 0; k < index_labeled_parts.size(); ++k) {
(*scores)[index_labeled_parts[k]] = label_scores[k];
}
continue;
}
(*scores)[r] = parameters->ComputeScore(part_features);
}
}