本文整理汇总了C++中ParameterList::deleteParameters方法的典型用法代码示例。如果您正苦于以下问题:C++ ParameterList::deleteParameters方法的具体用法?C++ ParameterList::deleteParameters怎么用?C++ ParameterList::deleteParameters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParameterList
的用法示例。
在下文中一共展示了ParameterList::deleteParameters方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: estimateDistanceMatrix
DistanceMatrix* OptimizationTools::estimateDistanceMatrix(
DistanceEstimation& estimationMethod,
const ParameterList& parametersToIgnore,
const std::string& param,
unsigned int verbose) throw (Exception)
{
if (param != DISTANCEMETHOD_PAIRWISE && param != DISTANCEMETHOD_INIT)
throw Exception("OptimizationTools::estimateDistanceMatrix. Invalid option param=" + param + ".");
estimationMethod.resetAdditionalParameters();
estimationMethod.setVerbose(verbose);
if (param == DISTANCEMETHOD_PAIRWISE)
{
ParameterList tmp = estimationMethod.getSubstitutionModel().getIndependentParameters();
tmp.addParameters(estimationMethod.getRateDistribution().getIndependentParameters());
tmp.deleteParameters(parametersToIgnore.getParameterNames());
estimationMethod.setAdditionalParameters(tmp);
}
// Compute matrice:
if (verbose > 0)
ApplicationTools::displayTask("Estimating distance matrix", true);
estimationMethod.computeMatrix();
auto_ptr<DistanceMatrix> matrix(estimationMethod.getMatrix());
if (verbose > 0)
ApplicationTools::displayTaskDone();
return matrix.release();
}
示例2: tl
TreeTemplate<Node>* OptimizationTools::buildDistanceTree(
DistanceEstimation& estimationMethod,
AgglomerativeDistanceMethod& reconstructionMethod,
const ParameterList& parametersToIgnore,
bool optimizeBrLen,
const std::string& param,
double tolerance,
unsigned int tlEvalMax,
OutputStream* profiler,
OutputStream* messenger,
unsigned int verbose) throw (Exception)
{
estimationMethod.resetAdditionalParameters();
estimationMethod.setVerbose(verbose);
if (param == DISTANCEMETHOD_PAIRWISE)
{
ParameterList tmp = estimationMethod.getSubstitutionModel().getIndependentParameters();
tmp.addParameters(estimationMethod.getRateDistribution().getIndependentParameters());
tmp.deleteParameters(parametersToIgnore.getParameterNames());
estimationMethod.setAdditionalParameters(tmp);
}
TreeTemplate<Node>* tree = NULL;
TreeTemplate<Node>* previousTree = NULL;
bool test = true;
while (test)
{
// Compute matrice:
if (verbose > 0)
ApplicationTools::displayTask("Estimating distance matrix", true);
estimationMethod.computeMatrix();
DistanceMatrix* matrix = estimationMethod.getMatrix();
if (verbose > 0)
ApplicationTools::displayTaskDone();
// Compute tree:
if (matrix->size() == 2) {
//Special case, there is only one possible tree:
Node* n1 = new Node(0);
Node* n2 = new Node(1, matrix->getName(0));
n2->setDistanceToFather((*matrix)(0,0) / 2.);
Node* n3 = new Node(2, matrix->getName(1));
n3->setDistanceToFather((*matrix)(0,0) / 2.);
n1->addSon(n2);
n1->addSon(n3);
tree = new TreeTemplate<Node>(n1);
break;
}
if (verbose > 0)
ApplicationTools::displayTask("Building tree");
reconstructionMethod.setDistanceMatrix(*matrix);
reconstructionMethod.computeTree();
previousTree = tree;
delete matrix;
tree = dynamic_cast<TreeTemplate<Node>*>(reconstructionMethod.getTree());
if (verbose > 0)
ApplicationTools::displayTaskDone();
if (previousTree && verbose > 0)
{
int rf = TreeTools::robinsonFouldsDistance(*previousTree, *tree, false);
ApplicationTools::displayResult("Topo. distance with previous iteration", TextTools::toString(rf));
test = (rf == 0);
delete previousTree;
}
if (param != DISTANCEMETHOD_ITERATIONS)
break; // Ends here.
// Now, re-estimate parameters:
auto_ptr<SubstitutionModel> model(estimationMethod.getSubstitutionModel().clone());
auto_ptr<DiscreteDistribution> rdist(estimationMethod.getRateDistribution().clone());
DRHomogeneousTreeLikelihood tl(*tree,
*estimationMethod.getData(),
model.get(),
rdist.get(),
true, verbose > 1);
tl.initialize();
ParameterList parameters = tl.getParameters();
if (!optimizeBrLen)
{
vector<string> vs = tl.getBranchLengthsParameters().getParameterNames();
parameters.deleteParameters(vs);
}
parameters.deleteParameters(parametersToIgnore.getParameterNames());
optimizeNumericalParameters(&tl, parameters, NULL, 0, tolerance, tlEvalMax, messenger, profiler, verbose > 0 ? verbose - 1 : 0);
if (verbose > 0)
{
ParameterList tmp = tl.getSubstitutionModelParameters();
for (unsigned int i = 0; i < tmp.size(); i++)
{
ApplicationTools::displayResult(tmp[i].getName(), TextTools::toString(tmp[i].getValue()));
}
tmp = tl.getRateDistributionParameters();
for (unsigned int i = 0; i < tmp.size(); i++)
{
ApplicationTools::displayResult(tmp[i].getName(), TextTools::toString(tmp[i].getValue()));
}
}
}
return tree;
}