本文整理汇总了C++中TrainingSet::setPatternCount方法的典型用法代码示例。如果您正苦于以下问题:C++ TrainingSet::setPatternCount方法的具体用法?C++ TrainingSet::setPatternCount怎么用?C++ TrainingSet::setPatternCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TrainingSet
的用法示例。
在下文中一共展示了TrainingSet::setPatternCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fromFile
//.........这里部分代码省略.........
file.close();
return
{
retTSF, false, NotWellFormedError, "NotWellFormedError: Missing attributes (" + STR_TYPE + ", " + STR_MAXVALUE + ", " + STR_MINVALUE + ", " + STR_THRESHOLD + ", " + STR_ELONGATION + ") on tag " + STR_INPUTSNORMALIZATION, tsReadXML.lineNumber()
};
}
}else if(name == STR_TARGETSNORMALIZATION){
attributes = tsReadXML.attributes();
if(attributes.hasAttribute(STR_TYPE) &&
attributes.hasAttribute(STR_MAXVALUE) &&
attributes.hasAttribute(STR_MINVALUE) &&
attributes.hasAttribute(STR_THRESHOLD) &&
attributes.hasAttribute(STR_AMPLITUDE) &&
attributes.hasAttribute(STR_ELONGATION))
{
tnor->setType(normFromStrToInt(attributes.value(STR_TYPE).toString()));
tnor->setMaxValue(attributes.value(STR_MAXVALUE).toDouble());
tnor->setMinValue(attributes.value(STR_MINVALUE).toDouble());
tnor->setThreshold(attributes.value(STR_THRESHOLD).toDouble());
tnor->setAmplitude(attributes.value(STR_AMPLITUDE).toDouble());
tnor->setElongation(attributes.value(STR_ELONGATION).toDouble());
}else{
file.close();
return
{
retTSF, false, NotWellFormedError, "NotWellFormedError: Missing attributes (" + STR_TYPE + ", " + STR_MAXVALUE + ", " + STR_MINVALUE + ", " + STR_THRESHOLD + ", " + STR_ELONGATION + ") on tag " + STR_TARGETSNORMALIZATION, tsReadXML.lineNumber()
};
}
}else if(name == STR_PATTERN){
attributes = tsReadXML.attributes();
if(attributes.hasAttribute(STR_INDEX))
{
lastPatternIndex = attributes.value(STR_INDEX).toInt();
}else{
file.close();
return
{
retTSF, false, NotWellFormedError, "NotWellFormedError: Missing attributes (" + STR_INDEX + ") on tag " + STR_PATTERN, tsReadXML.lineNumber()
};
}
}else if(name == STR_INPUTS){
text = tsReadXML.readElementText(QXmlStreamReader::SkipChildElements);
textElements = text.split(STR_SEPARATOR, QString::KeepEmptyParts, Qt::CaseInsensitive);
sTextElements = textElements.size();
if(sTextElements == iSize){
for(int i = 0; i < sTextElements; i++){
inputs[lastPatternIndex][i] = textElements[i].toDouble();
}
}else{
file.close();
return
{
retTSF, false, NotWellFormedError, "NotWellFormedError: Incongruence between reported input size with found inputs elements", tsReadXML.lineNumber()
};
}
}else if(name == STR_TARGETS){
text = tsReadXML.readElementText(QXmlStreamReader::SkipChildElements);
textElements = text.split(STR_SEPARATOR, QString::KeepEmptyParts, Qt::CaseInsensitive);
sTextElements = textElements.size();
if(sTextElements == tSize){
for(int t = 0; t < sTextElements; t++){
targets[lastPatternIndex][t] = textElements[t].toDouble();
}
}else{
file.close();
return
{
retTSF, false, NotWellFormedError, "NotWellFormedError: Incongruence between reported target size with found target elements", tsReadXML.lineNumber()
};
}
}
}
}
retTSF->setFileName(file.fileName());
res.file = retTSF;
ts->setPatternCount(pSize);
ts->setInputs(inputs, iSize);
ts->setTargets(targets, tSize);
ts->setInputsNormalization(inor);
ts->setTargetsNormalization(tnor);
ts->setInputsDataRepresentation(idr);
ts->setTargetsDataRepresentation(tdr);
res.sucess = true;
res.errnum = toTSFError(QXmlStreamReader::NoError);
res.errormsg = "";
res.line = -1;
file.close();
return res;
}else{
file.close();
return
{
retTSF, false, toTSFError(file.error()), file.errorString(), -1
};
}
}