void NetworkTests::NetworkTestInclTimingBCPNNRecurrent() { int nrHypercolumns = 65536;//65536;//128*16*10;//128*16*10;//128*16*10;//128*16; int nrRateUnits = 100;//50;//100;//100;//40;//10 //float activity = 0.05; int nrItems = 5; bool storeData = false; float probConnectivity = 0.0003;//0.00005;//0.000025;//0.00003;//0.000025;//0.001;//0.00044;//0.00011;//0.00024;//0.00006;//0.0004;//0.00001; bool doTesting = true; // false for some scaling tests // network construction Network* network = new Network(); network->AddTiming(network); PopulationColumns* layer1 = new PopulationColumns(network,nrHypercolumns,nrRateUnits,PopulationColumns::Graded); network->AddPopulation(layer1); FullConnectivity* full = new FullConnectivity();//false,"minicolumns"); full->SetRandomWeights(0,0); RandomConnectivity* randConn = new RandomConnectivity(probConnectivity);//0.1); randConn->SetRandomWeights(0,0); //network->AddTiming(randConn); layer1->AddPre(layer1,randConn); // recurrent // Add Projection changes float lambda0 = 10e-6; float alpha = 0.05; ProjectionModifierBcpnnOnline* bStandard = new ProjectionModifierBcpnnOnline(alpha,lambda0); //full->AddProjectionsEvent(bStandard); randConn->AddProjectionsEvent(bStandard); WTA* wta = new WTA(); layer1->AddPopulationModifier(wta); // Construct initial network network->Initialize(); //vector<int> partsOfDataToUseAsInput = layer1->GetMPIDistribution(network->MPIGetNodeId()); // Specify input data // - change to only create local part DataSources source; // not correct right now as SetValuesAll working locally and this is global vector<vector<float> > data = source.GetRandomHCsOrthogonal(nrHypercolumns/100,nrRateUnits,nrItems); // Meters Meter* l1meter = new Meter("layer1.csv", Storage::CSV); if(storeData) { l1meter->AttachPopulation(layer1); network->AddMeter(l1meter); } Meter* c1meter = new Meter("Projections1.csv",Storage::CSV); if(storeData) { c1meter->AttachProjection(layer1->GetIncomingProjections()[0],0); network->AddMeter(c1meter); } // Timings network->AddTiming(bStandard); network->AddTiming(layer1); network->AddTiming(full); // need to access after it has been built network->AddTiming(layer1->GetIncomingProjections()[0]); // Training // set fixed pattern layer1->SwitchOnOff(false); int trainIterations = 1; int testIterations = 5; for(int i=0;i<trainIterations;i++) { //cout<<i<<"\n"; for(int j=0;j<data.size();j++) { layer1->SetValuesAll(data[j]); // next time step network->Simulate(10); } } // Testing if(doTesting == true) { layer1->SwitchOnOff(true); bStandard->SwitchOnOff(false); for(int i=0;i<testIterations;i++) { for(int j=0;j<data.size();j++) { // clear all events before switching so no disturbance, can remove if moving average activity etc. network->ClearEventsIncoming(); layer1->SetValuesAll(data[j]); network->Simulate(10); //for(int i=0;i<testIterations;i++) // next time step // network->Simulate(); } } } network->RecordAll(); network->StoreAnalysis(); }