本文整理汇总了C++中GMatrix::takeRow方法的典型用法代码示例。如果您正苦于以下问题:C++ GMatrix::takeRow方法的具体用法?C++ GMatrix::takeRow怎么用?C++ GMatrix::takeRow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GMatrix
的用法示例。
在下文中一共展示了GMatrix::takeRow方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doJob
virtual void doJob(size_t jobId)
{
// Randomly draw some data (with replacement)
GReleaseDataHolder hDrawnFeatures(&m_drawnFeatures);
GReleaseDataHolder hDrawnLabels(&m_drawnLabels);
for(size_t j = 0; j < m_drawSize; j++)
{
size_t r = (size_t)m_rand.next(m_features.rows());
m_drawnFeatures.takeRow((GVec*)&m_features[r]); // This case is only okay because we only use drawFeatures as a const GMatrix
m_drawnLabels.takeRow((GVec*)&m_labels[r]); // This case is only okay because we only use drawnLabels as a const GMatrix
}
// Train the learner with the drawn data
m_pBag->models()[jobId]->m_pModel->train(m_drawnFeatures, m_drawnLabels);
}
示例2: aggregateRows
void aggregateRows(GArgReader& args)
{
size_t r = args.pop_uint();
vector<string> files;
GFile::fileList(files);
GMatrix* pResults = NULL;
Holder<GMatrix> hResults;
for(vector<string>::iterator it = files.begin(); it != files.end(); it++)
{
PathData pd;
GFile::parsePath(it->c_str(), &pd);
if(strcmp(it->c_str() + pd.extStart, ".arff") != 0)
continue;
GMatrix* pData = loadData(it->c_str());
Holder<GMatrix> hData(pData);
if(!pResults)
{
pResults = new GMatrix(pData->relation());
hResults.reset(pResults);
}
pResults->takeRow(pData->releaseRow(r));
}
pResults->print(cout);
}