本文整理汇总了C++中Sig::load方法的典型用法代码示例。如果您正苦于以下问题:C++ Sig::load方法的具体用法?C++ Sig::load怎么用?C++ Sig::load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sig
的用法示例。
在下文中一共展示了Sig::load方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getFileList
/*
* Load Train Data (Signatures and respective names) from a directory
* Returns the number of signatures read
* TODO: make this windows compatible
*/
TrainData *Database::loadTrainDataFromDir(string dir, int *n)
{
Sig sig;
vector<string> files = vector<string>();
string fname, temp;
char buf[1024];
unsigned int ii;
TrainData *data;
getFileList(dir, files);
data = new TrainData [files.size()];
getcwd(buf, 1024); // save current dir
// cout << "Changing CWD to " << dir << "." << endl;
chdir(dir.c_str()); // change current dir to data dir
for (ii = 0; ii < files.size(); ii++) {
fname = files[ii];
// cout << "Reading " << fname << "." << endl;
sig.load(fname);
data[ii].name = filenameToName(files[ii]); // Get Name from sig file
data[ii].sigArr = sig.toArray(); // convert sig to array
data[ii].value = (double) tableLookup(data[ii].name); /* get value
* (table index)
*/
}
// cout << "Back to previous CWD." << endl;
chdir(buf); // change back to original working dir
// cout << "Read a total of " << ii << " files." << endl;
*n = ii;
return data;
}
示例2: test
int NeuralNet::test(string filePath, double *prob)
{
Sig testSig;
double temp;
double *test;
int max, ii;
testSig.load(filePath);
test = testSig.toArray();
/* feed the test data to the net */
bp->ffwd(test);
for (ii = 0 ; ii < numRes ; ii++) {
if ((prob[ii] = bp->Out(ii)) > temp) {
/* the highest value of the output nodes
* will determine the actual result
* i.e. who the test signature belongs to */
temp = bp->Out(ii);
max = ii;
}
}
return max;
}