status_t decodeInputVector(string * fragment) { float inputValue; unsigned int node; std::string::size_type startPos; unsigned int inputNodeCount; vector<float> lineVector( inputNodeCount = ((nn*) theNetwork)->layerZeroWidth()); startPos = 1; #ifdef _DEBUG_ cout << "Input Values,"; #endif for (node = 0; node < (inputNodeCount - 1); node++) //> { inputValue = nextFValue(fragment, startPos); lineVector[node] = inputValue; #ifdef _DEBUG_ cout << " Node " << node << ": " << inputValue; #endif } inputValue = nextFValue(fragment, startPos, ')'); #ifdef _DEBUG_ cout << " Node " << node << ": " << inputValue << "\n"; #endif lineVector[node] = inputValue; ((nn*) theNetwork)->run(&lineVector, NULL, lineCount); // run immediately return SUCCESS; }
status_t decodeInputVector(string * fragment, vector<float> * lineVector) { float inputValue; unsigned int node; std::string::size_type startPos; startPos = 1; #ifdef _DEBUG_ cout << "Input Values,"; #endif for (node = 0; node < (net.standardInputNodes() - 1); node++) //> { inputValue = nextFValue(fragment, startPos); lineVector->operator[](node) = inputValue; #ifdef _DEBUG_ cout << " Node " << node << ": " << inputValue; #endif } inputValue = nextFValue(fragment, startPos, ')'); #ifdef _DEBUG_ cout << " Node " << node << ": " << inputValue << "\n"; #endif lineVector->operator[](node) = inputValue; return SUCCESS; }
status_t decodeTrainingVector(string * fragment) { float readValue; unsigned int node; std::string::size_type startPos; unsigned int inWidth = ((nn*) theNetwork)->layerZeroWidth(); unsigned int outWidth = ((nn*) theNetwork)->layerNWidth(); vector<float> inVector(inWidth); vector<float> outVector(outWidth); startPos = 1; #ifdef _DEBUG_ cout << "Input Vector,"; #endif for (node = 0; node < (inWidth - 1); node++) //> { readValue = nextFValue(fragment, startPos); inVector[node] = readValue; #ifdef _DEBUG_ cout << " Node: " << node << ": " << readValue; #endif } readValue = nextFValue(fragment, startPos, ';'); #ifdef _DEBUG_ cout << " Node: " << node << ": " << readValue << "\n"; #endif inVector[node] = readValue; #ifdef _DEBUG_ cout << "Output Vector,"; #endif for (node = 0; node < (outWidth - 1); node++) //> { readValue = nextFValue(fragment, startPos); outVector[node] = readValue; #ifdef _DEBUG_ cout << " Node: " << node << ": " << readValue; #endif } readValue = nextFValue(fragment, startPos, ')'); #ifdef _DEBUG_ cout << " Node: " << node << ": " << readValue << "\n"; #endif outVector[node] = readValue; if (inputToTrain) ((nn*) theNetwork)->train(&inVector, &outVector); else ((nn*)theNetwork)->test(lineCount, &inVector, &outVector); return SUCCESS; }
status_t decodeTrainingVector(string * fragment, vector<float> * inVector, vector<float> * outVector) { float readValue; unsigned int node; std::string::size_type startPos; startPos = 1; #ifdef _DEBUG_ cout << "Input Vector,"; #endif for (node = 0; node < (net.standardInputNodes() - 1); node++) //> { readValue = nextFValue(fragment, startPos); inVector->operator[](node) = readValue; #ifdef _DEBUG_ cout << " Node: " << node << ": " << readValue; #endif } readValue = nextFValue(fragment, startPos, ';'); #ifdef _DEBUG_ cout << " Node: " << node << ": " << readValue << "\n"; #endif inVector->operator[](node) = readValue; #ifdef _DEBUG_ cout << "Output Vector,"; #endif for (node = 0; node < (net.outputNodes() - 1); node++) //> { readValue = nextFValue(fragment, startPos); outVector->operator[](node) = readValue; #ifdef _DEBUG_ cout << " Node: " << node << ": " << readValue; #endif } readValue = nextFValue(fragment, startPos, ')'); #ifdef _DEBUG_ cout << " Node: " << node << ": " << readValue << "\n"; #endif outVector->operator[](node) = readValue; return SUCCESS; }