mirror of
https://github.com/BlackLight/neuralpp.git
synced 2024-11-16 06:47:16 +01:00
Testing, again
This commit is contained in:
parent
aac905673b
commit
3f56c8404c
2 changed files with 18 additions and 16 deletions
|
@ -21,6 +21,7 @@ int main() {
|
||||||
xml += NeuralNet::XMLFromSet(1, "3,3,1;7");
|
xml += NeuralNet::XMLFromSet(1, "3,3,1;7");
|
||||||
xml += NeuralNet::XMLFromSet(2, "5,4,2;11");
|
xml += NeuralNet::XMLFromSet(2, "5,4,2;11");
|
||||||
NeuralNet::closeXML(xml);
|
NeuralNet::closeXML(xml);
|
||||||
|
cout << "xml:\n" << xml << endl;
|
||||||
|
|
||||||
net.train(xml, NeuralNet::str);
|
net.train(xml, NeuralNet::str);
|
||||||
vector<double> v;
|
vector<double> v;
|
||||||
|
|
|
@ -466,9 +466,10 @@ namespace neuralpp {
|
||||||
string NeuralNet::XMLFromSet(int id, string set) {
|
string NeuralNet::XMLFromSet(int id, string set) {
|
||||||
string xml;
|
string xml;
|
||||||
vector<double> in, out;
|
vector<double> in, out;
|
||||||
|
stringstream ss (stringstream::in | stringstream::out);
|
||||||
|
|
||||||
unsigned int delimPos = -1;
|
unsigned int delimPos = -1;
|
||||||
char delim = ';';
|
char delim = ';';
|
||||||
char tmp[1024];
|
|
||||||
|
|
||||||
for (delimPos = 0;
|
for (delimPos = 0;
|
||||||
delimPos < set.length() && set[delimPos] != delim;
|
delimPos < set.length() && set[delimPos] != delim;
|
||||||
|
@ -483,27 +484,27 @@ namespace neuralpp {
|
||||||
in = split(',', inStr);
|
in = split(',', inStr);
|
||||||
out = split(',', outStr);
|
out = split(',', outStr);
|
||||||
|
|
||||||
snprintf(tmp, sizeof(tmp), "%d", id);
|
ss << id;
|
||||||
xml += "\t<TRAINING ID=\"" + string(tmp) + "\">\n";
|
xml += "\t<TRAINING ID=\"" + ss.str() + "\">\n";
|
||||||
|
|
||||||
for (unsigned int i = 0; i < in.size(); i++) {
|
for (unsigned int i = 0; i < in.size(); i++) {
|
||||||
memset(tmp, 0x0, sizeof(tmp));
|
ss.str(string());
|
||||||
snprintf(tmp, sizeof(tmp), "%d", i);
|
ss << i;
|
||||||
xml += "\t\t<INPUT ID=\"" + string(tmp) + "\">";
|
xml += "\t\t<INPUT ID=\"" + ss.str() + "\">";
|
||||||
|
|
||||||
memset(tmp, 0x0, sizeof(tmp));
|
ss.str(string());
|
||||||
snprintf(tmp, sizeof(tmp), "%f", in[i]);
|
ss << in[i];
|
||||||
xml += string(tmp) + "</INPUT>\n";
|
xml += ss.str() + "</INPUT>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int i = 0; i < out.size(); i++) {
|
for (unsigned int i = 0; i < out.size(); i++) {
|
||||||
memset(tmp, 0x0, sizeof(tmp));
|
ss.str(string());
|
||||||
snprintf(tmp, sizeof(tmp), "%d", i);
|
ss << i;
|
||||||
xml += "\t\t<OUTPUT ID=\"" + string(tmp) + "\">";
|
xml += "\t\t<OUTPUT ID=\"" + ss.str() + "\">";
|
||||||
|
|
||||||
memset(tmp, 0x0, sizeof(tmp));
|
ss.str(string());
|
||||||
snprintf(tmp, sizeof(tmp), "%f", out[i]);
|
ss << out[i];
|
||||||
xml += string(tmp) + "</OUTPUT>\n";
|
xml += ss.str() + "</OUTPUT>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
xml += "\t</TRAINING>\n\n";
|
xml += "\t</TRAINING>\n\n";
|
||||||
|
|
Loading…
Reference in a new issue