void Clock::alarmTime() { qDebug()<<"alarmTime"; startNetwork(); readNetwork(); runClock = false; }
int main( int argc, char ** argv) { Magick::InitializeMagick(*argv); readNetwork("base"); int failed = 0, all = 0; for (int i = 1; i < argc; i++) { Magick::Image img(argv[i]); prepareImage(img); char res = runNetwork(img); char et = tolower(findChar(argv[i])); //printf("%c-%c\n", res, et); if (res != et) failed++; all++; } printf("%d/%d=%.2lf", failed, all, ((double)failed)/all); }
//gets the file name and reads the *txt file and outputs the readout as a network structure network read_network_from_file(string file_name){ network net; //read network from file ifstream readNetwork(file_name, ios::in); int v1, v2; //v1 and v2 store the vertices for each edge entry net.Number_of_Edges = 0; //NumberEdges counts the number of edges as input file streams vector<vector<int>> preVector; while (readNetwork >> v1) { readNetwork >> v2; net.Number_of_Edges++; if (preVector.size() <= max(v1, v2)) { preVector.resize(max(v1, v2) + 1); } preVector[v1].push_back(v2); //add corresponding info for an edge to the to vertices preVector[v2].push_back(v1); } readNetwork.close(); // net.Number_of_Vertices = preVector.size(); //net.graphVector.resize(net.Number_of_Edges * 2); //graphVector is the finall vector used to represent the network //net.delimiterInfo.resize(preVector.size() + 1); //the array used to store the information on where in graphVector each array starts net.dInfo[0] = 0; int current = 0; //to indicate where in the graphVector we are for (int i = 0; i < preVector.size(); i++) { net.dInfo[i + 1] = net.dInfo[i] + preVector[i].size(); for (int j = 0; j < preVector[i].size(); j++) { net.gVector[current] = preVector[i][j]; current++; } } return net; }
int main() { neural::Network net; char inFile[] = "net1.json"; char outFile[] = "test1.json"; readNetwork(inFile, &net); writeNetwork(outFile, &net); /* std::vector<double> inputValues; //Values to train neural network input with forward-propagation std::vector<double> targetValues; //Values to train neural network output with back-propagation std::vector<double> resultValues; //Holds output from neural net //Train network myNet.feedForward(inputValues); //Input on input training data myNet.backPropagation(targetValues); //Train on expected output with backpropagation myNet.getResults(resultValues); */ return 0; }