void RBM::preTraining(string filename) { for (size_t i = 0; i < selfTrainingTime; i++) { ifstream fin(filename, ios::in); size_t index = 0; while (!fin.eof()) { index++; shared_ptr<AbstractMatrix> datum = readDatum(fin); double err = singleTraining(datum); if (index % 1000 == 0) printf("count: %d %.4f\n", index, err); //this->weight->print(); //system("pause"); if (index % selfBatchSize == 0) selfUpdate(false); } selfUpdate(true); fin.close(); } }
void ofx2DPro::update(ofEventArgs & args){ if(bUpdateSystem){ selfUpdate(); if(logGui.isRecording()){ logGui.recordAddFrame(); } } }
void CloudsVisualSystemOpenP5Spaghetti::regenerate(){ color1.setHsb(hue1,saturation1,brightness1); // cout << "regenerated color1 = "<< color1 << endl; color2.setHsb(hue2,saturation2,brightness2); // cout << "regenerated color2 = "<< color2 << endl; for(int i = 0; i<NWalkers; i++){ //clear all meshes walkers[i].mesh.getVertices().clear(); walkers[i].mesh.getColors().clear(); //set positions to zero walkers[i].position.x = 0; walkers[i].position.y = 0; walkers[i].position.z = 0; // COLOR MODES if(rainbow){ //if rainbow mode is selected, choose a random hue between 0 and 255 dichromatic = false; oscillate = false; newColor.setHsb(ofRandom(255),saturation, brightness); walkers[i].setColor(newColor); } else if(dichromatic){ //if rainbow mode is not selected, choose a random color between color1 and color2 rainbow = false; randomColor = color1.getLerped(color2, ofRandom(1.0)); //newColor.setHsb(randomColor.getHue(),saturation, brightness); newColor = randomColor; // cout << "new color = " << i << " " << newColor << endl; walkers[i].setColor(newColor); } else if(oscillate){ rainbow = false; newColor = color1; walkers[i].setColor(newColor); } } //shouldn't PRELOADS should happen in regenerate...? for (int j = 0; j<numPreloads; j++){ selfUpdate(); // cout << "preloaded " << j << "times" << endl; //selfDraw(); } }
//-------------------------------------------------------------- void ofxScene::update(float dt) { selfUpdate(dt); }