本文整理汇总了C++中TrainingSet::getInputsDataRepresentation方法的典型用法代码示例。如果您正苦于以下问题:C++ TrainingSet::getInputsDataRepresentation方法的具体用法?C++ TrainingSet::getInputsDataRepresentation怎么用?C++ TrainingSet::getInputsDataRepresentation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TrainingSet
的用法示例。
在下文中一共展示了TrainingSet::getInputsDataRepresentation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: on_DataRepresentationBoxButton_clicked
void PruebaPantalla::on_DataRepresentationBoxButton_clicked()
{
QString openDir = QFileDialog::getOpenFileName(this, //widget
"Abrir conjunto de entrenamiento", //caption
"/home/edixon/programacion/INSYDE//samples/TrainingSets", //dir
"Conjunto de entrenamiento (*.tsf)", //filter
new QString("Conjunto de entrenamiento (*.tsf)"));
if(openDir == "") return;
TrainingSet *ts = new TrainingSet(openDir);
DataRepresentationBox *drb = new DataRepresentationBox(ts->getInputs()[0], ts->getInputsDataRepresentation());
drb->show();
}
示例2: fromFile
TrainingSetFile::TSFResult TrainingSetFile::fromFile(QFile &file)
{
QString
version,
text;
QStringRef name;
QXmlStreamReader tsReadXML;
QXmlStreamReader::TokenType tt;
QStringList textElements;
QXmlStreamAttributes attributes;
TrainingSetFile *retTSF = new TrainingSetFile();
TSFResult res = {retTSF, true, NoError, "", 0};
TrainingSet *ts = retTSF->getTrainingSet();
int
lastPatternIndex = 0,
sTextElements,
pSize = 0,
iSize = 0,
tSize = 0;
Normalization
*inor = new Normalization(),
*tnor = new Normalization();
vector<vector<double> >
inputs,
targets;
DataRepresentation
*idr = ts->getInputsDataRepresentation(),
*tdr = ts->getTargetsDataRepresentation();
if(file.open(QIODevice::ReadOnly)){
tsReadXML.setDevice(&file);
while (!tsReadXML.atEnd()) {
tt = tsReadXML.readNext();
if(tsReadXML.hasError()){
file.close();
return {retTSF, false, toTSFError(tsReadXML.error()), tsReadXML.errorString(), tsReadXML.lineNumber()};
}
if(tt == QXmlStreamReader::StartDocument){
continue;
}else if(tt == QXmlStreamReader::StartElement){
name = tsReadXML.name();
if(name == STR_TRAININGSET){
attributes = tsReadXML.attributes();
if(attributes.hasAttribute(STR_PATTERNSIZE) &&
attributes.hasAttribute(STR_INPUTSSIZE) &&
attributes.hasAttribute(STR_TARGETSSIZE))
{
pSize = attributes.value(STR_PATTERNSIZE).toInt();
iSize = attributes.value(STR_INPUTSSIZE).toInt();
tSize = attributes.value(STR_TARGETSSIZE).toInt();
inputs = vector<vector<double> >(pSize, vector<double>(iSize, 0));
targets = vector<vector<double> >(pSize, vector<double>(tSize, 0));
}else{
file.close();
return {
retTSF, false, NotWellFormedError, "NotWellFormedError: Missing attributes (" + STR_PATTERNSIZE + ", " + STR_INPUTSSIZE + ", " + STR_TARGETSSIZE + ") on tag " + STR_TRAININGSET, tsReadXML.lineNumber()
};
}
}else if(name == STR_PROPERTIES){
attributes = tsReadXML.attributes();
if(attributes.hasAttribute(STR_VERSION)){
version = attributes.value(STR_VERSION).toString();
}else{
file.close();
return
{
retTSF, false, NotWellFormedError, "NotWellFormedError: Missing attributes (" + STR_VERSION + ") on tag " + STR_PROPERTIES, tsReadXML.lineNumber()
};
}
}else if(name == STR_INPUTSDATAREPRESENTATION){
attributes = tsReadXML.attributes();
if(attributes.hasAttribute(STR_NAME) &&
attributes.hasAttribute(STR_WIDTH) &&
attributes.hasAttribute(STR_HEIGHT) &&
attributes.hasAttribute(STR_FORMAT))
{
idr->setType(drFromStrToInt(attributes.value(STR_NAME).toString()));
idr->setWidth(attributes.value(STR_WIDTH).toInt());
idr->setHeight(attributes.value(STR_HEIGHT).toInt());
idr->setImageFormat(fromStrToImgFormat(attributes.value(STR_FORMAT).toString()));
}else{
file.close();
return
{
retTSF, false, NotWellFormedError, "NotWellFormedError: Missing attributes (" + STR_NAME + ", " + STR_WIDTH + ", " + STR_HEIGHT + ", " + STR_FORMAT + ") on tag " + STR_INPUTSDATAREPRESENTATION, tsReadXML.lineNumber()
};
}
}else if(name == STR_TARGETSDATAREPRESENTATION){
//.........这里部分代码省略.........