本文整理汇总了C++中DataManager::saveArray方法的典型用法代码示例。如果您正苦于以下问题:C++ DataManager::saveArray方法的具体用法?C++ DataManager::saveArray怎么用?C++ DataManager::saveArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataManager
的用法示例。
在下文中一共展示了DataManager::saveArray方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: saveTopicData
void TopicModel::saveTopicData(QString qname, int k) {
DataManager *datamanager = new DataManager();
sleep(1);
connect(datamanager, SIGNAL(saveTick(int)), this, SIGNAL(saveTick(int)));
emit changeStatus("Saving");
/*************************************/
// Save parameters
/*************************************/
datamanager->saveInt(qname, "M", "M", M);
/*************************************/
// Save Theta
/*************************************/
if(k == 0) {
datamanager->saveArray(qname, "Theta", "feature", "probability", Theta0);
} else {
datamanager->saveArray(qname, "Theta", "feature", "probability", Theta[k-1]);
}
emit changeStatus("Ready");
disconnect(datamanager, SIGNAL(loadTick(int)), this, SIGNAL(loadTick(int)));
delete datamanager;
}
示例2: saveData
void TopicModel::saveData(QString qname) {
int i, j;
vector < double > storage1;
vector < vector < double > > storage2;
vector < vector < vector < double > > > storage3;
DataManager *datamanager = new DataManager();
sleep(1);
connect(datamanager, SIGNAL(saveTick(int)), this, SIGNAL(saveTick(int)));
emit changeStatus("Saving");
/*************************************/
// Save parameters
/*************************************/
datamanager->saveInt(qname, "K", "K", K);
datamanager->saveInt(qname, "M", "M", M);
datamanager->saveDouble(qname, "Theta_MIN", "Theta_MIN", Theta_MIN);
datamanager->saveDouble(qname, "Log_Likelihood", "likelihood", ll);;
cout << "Saving Omega values...\n";
/*************************************/
// Save P0
/*************************************/
storage1.resize(K+1);
storage1[0] = -1;
for(i=1; i < K+1; i++) {
storage1[i] = P0[i-1];
}
datamanager->saveArray(qname, "P0", "category", "probability", storage1);
/*************************************/
// Save Omega
/*************************************/
storage2.resize(K+1);
for(i=0; i < K+1; i++) {
storage2[i].resize(K+1);
for(j=0; j < K+1; j++) {
if(j == 0) {
storage2[i][j] = -1.0;
} else if(i == 0) {
storage2[i][j] = Omega0[j-1];
} else {
storage2[i][j] = Omega[j-1][i-1];
}
}
}
vector < QString > keyNames;
keyNames.resize(3);
keyNames[0] = "cause";
keyNames[1] = "effect";
keyNames[2] = "probability";
datamanager->saveArray(qname, "Omega", keyNames, storage2);
/*************************************/
// Save Theta
/*************************************/
storage2.resize(K+1);
for(i=0; i < K+1; i++) {
storage2[i].resize(M);
for(j=0; j < M; j++) {
if(i == 0) {
storage2[i][j] = Theta0[j];
} else {
storage2[i][j] = Theta[i-1][j];
}
}
}
keyNames.resize(3);
keyNames[0] = "category";
keyNames[1] = "feature";
keyNames[2] = "probability";
datamanager->saveArray(qname, "Theta", keyNames, storage2);
/*************************************/
// Save Sigma
/*************************************/
storage1.resize(K+1);
storage1[0] = Sigma0;
//.........这里部分代码省略.........