本文整理汇总了C++中DataFrame::getFactorLabelFromIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ DataFrame::getFactorLabelFromIndex方法的具体用法?C++ DataFrame::getFactorLabelFromIndex怎么用?C++ DataFrame::getFactorLabelFromIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataFrame
的用法示例。
在下文中一共展示了DataFrame::getFactorLabelFromIndex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
std::vector<std::string> GreedyStepwiseSearch::findSubset(const DataFrame& df,
TgsProgress* p)
{
TgsProgress* dataFrameProgress = NULL;
TgsProgress* evaluateProgress = NULL;
if (p)
{
dataFrameProgress = p->createTgsChild("Data Frame Processing", .5);
evaluateProgress = p->createTgsChild("Evaluate Subsets", .5);
}
std::vector<std::string> result;
_fse->setDataFrame(df, dataFrameProgress);
assert(_direction == Backward);
_progress = evaluateProgress;
_iteration = 0;
_totalIterations = (df.getNumFactors() * (df.getNumFactors() + 1)) / 2;
double bestScore = -1e300;
vector<int> bestSolution;
if (_direction == Backward)
{
vector<int> columns;
for (unsigned int i = 0; i < df.getNumFactors(); i++)
{
columns.push_back(i);
}
double score = _fse->evaluateSubset(columns);
bestScore = score;
bestSolution = columns;
// printf("score: %.3f size: %d\n", score, columns.size());
do
{
score = _removeWorst(columns);
// printf("score: %.3f size: %d\n", score, columns.size());
for (unsigned int i = 0; i < columns.size(); i++)
{
string s = df.getFactorLabelFromIndex(columns[i]);
char* s2 = (char*)s.c_str();
s2[4] = 0;
// printf("%s\t", s2);
}
// printf("\n");
if (score >= bestScore)
{
bestScore = score;
bestSolution = columns;
}
} while (columns.size() > 1);
}
result.clear();
for (unsigned int i = 0; i < bestSolution.size(); i++)
{
result.push_back(df.getFactorLabelFromIndex(bestSolution[i]));
}
if (p)
{
p->setProgress(1.0);
}
return result;
}