本文整理汇总了C++中Split::setWeight方法的典型用法代码示例。如果您正苦于以下问题:C++ Split::setWeight方法的具体用法?C++ Split::setWeight怎么用?C++ Split::setWeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Split
的用法示例。
在下文中一共展示了Split::setWeight方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addCandidateSplits
void CandidateSet::addCandidateSplits(string treeString) {
vector<string> taxaNames = aln->getSeqNames();
MTree tree(treeString, taxaNames, Params::getInstance().is_rooted);
SplitGraph allSplits;
tree.convertSplits(allSplits);
for (SplitGraph::iterator splitIt = allSplits.begin(); splitIt != allSplits.end(); splitIt++) {
int value;
Split *sp = candSplits.findSplit(*splitIt, value);
if (sp != NULL) {
sp->setWeight(value + 1);
candSplits.setValue(sp, value + 1);
} else {
sp = new Split(*(*splitIt));
sp->setWeight(1);
candSplits.insertSplit(sp, 1);
}
}
candSplits.setNumTree(candSplits.getNumTree() + 1);
}
示例2: computeSplitOccurences
int CandidateSet::computeSplitOccurences(double supportThreshold) {
candSplits.clear();
candSplits.setNumTree(size());
/* Store all splits in the best trees in candSplits.
* The variable numTree in SpitInMap is the number of trees, from which the splits are converted.
*/
CandidateSet::iterator treeIt;
//vector<string> taxaNames = aln->getSeqNames();
for (treeIt = begin(); treeIt != end(); treeIt++) {
MTree tree(treeIt->second.tree, Params::getInstance().is_rooted);
SplitGraph splits;
tree.convertSplits(splits);
SplitGraph::iterator itg;
for (itg = splits.begin(); itg != splits.end(); itg++) {
int value;
Split *sp = candSplits.findSplit(*itg, value);
if (sp != NULL) {
int newHashWeight = value + 1;
double newSupport = (double) newHashWeight / (double) candSplits.getNumTree();
sp->setWeight(newSupport);
candSplits.setValue(sp, newHashWeight);
}
else {
sp = new Split(*(*itg));
sp->setWeight(1.0 / (double) candSplits.getNumTree());
candSplits.insertSplit(sp, 1);
}
}
}
int newNumStableSplits = countStableSplits(supportThreshold);
if (verbose_mode >= VB_MED) {
cout << ((double) newNumStableSplits / (aln->getNSeq() - 3)) * 100;
cout << " % of the splits are stable (support threshold " << supportThreshold;
cout << " from " << candSplits.getNumTree() << " trees)" << endl;
}
return numStableSplits;
}
示例3: removeCandidateSplits
void CandidateSet::removeCandidateSplits(string treeString) {
vector<string> taxaNames = aln->getSeqNames();
MTree tree(treeString, taxaNames, Params::getInstance().is_rooted);
SplitGraph allSplits;
tree.convertSplits(allSplits);
for (SplitGraph::iterator splitIt = allSplits.begin(); splitIt != allSplits.end(); splitIt++) {
int value = 0;
Split *sp;
sp = candSplits.findSplit(*splitIt, value);
if (value == 0) {
cout << "Cannot find split: ";
(*splitIt)->report(cout);
exit(1);
} else {
assert(sp->getWeight() >= 1);
if (sp->getWeight() > 1) {
sp->setWeight(value - 1);
} else {
candSplits.eraseSplit(*splitIt);
}
}
}
candSplits.setNumTree(candSplits.getNumTree() - 1);
}