Пример #1
0
CTTableDiff<COUNT,PROB>* model1::one_step_em(int it, bool seedModel1,
    Dictionary& dictionary, bool useDict)
{
  CTTableDiff<COUNT,PROB> *diff = new CTTableDiff<COUNT,PROB>();
  double minErrors=1.0;
  string modelName="Model1",shortModelName="1";
  time_t st, it_st, fn;
  string tfile, number, alignfile, test_alignfile;
  bool dump_files = false ;
  st = time(NULL);
  sHandler1.rewind();
  cout << "==========================================================\n";
  cout << modelName << " Training Started at: "<< my_ctime(&st) << "\n";
  it_st = time(NULL);
  cout <<  "-----------\n" << modelName << ": Iteration " << it << '\n';
  dump_files = (Model1_Dump_Freq != 0) &&  ((it % Model1_Dump_Freq)  == 0) && !NODUMPS ;
  number = "";
  int n = it;
  do {
    number.insert((size_t)0, 1, (char)(n % 10 + '0'));
  } while((n /= 10) > 0);
  tfile = Prefix + ".t" + shortModelName + "." + number ;
  alignfile = Prefix + ".A1" ;
  test_alignfile = Prefix +".tst.A" + shortModelName + "." + number ;
  initAL();
  em_loop_1(diff,it,perp, sHandler1, seedModel1,
            dump_files, alignfile.c_str(), dictionary, useDict, trainViterbiPerp);
  //if (testPerp && testHandler) // calculate test perplexity
  //    em_loop(it,*testPerp, *testHandler, seedModel1, dump_files, test_alignfile.c_str(), dictionary, useDict, *testViterbiPerp, true);
  if( errorsAL()<minErrors ) minErrors=errorsAL();
  fn = time(NULL) ;
  cout <<  "Partial " << modelName << " Training took: " << difftime(fn, it_st) << " seconds\n";
  return diff;
}
Пример #2
0
void Game::initialise (int argc, char *argv[]) {
   // Initialise libraries
   screen = NULL;
   errorLoadingLibraries = false;
   running = false;
   paused = false;
   initTime = SDL_GetTicks ();

   try {
      initGUI ();
      initGL ();
      resizeWindow (screen->w, screen->h);
      initAL ();
      initDecoder ();

   } catch (const char *message) {
      errorLoadingLibraries = true;
      std::cerr << message << std::endl;
   }
}
Пример #3
0
void loadResources(Resources *resources)
{
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);

    glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
    glEnable(GL_TEXTURE_2D);

    initAL(resources);

    std::string font_path;
    search_path("FreeMonoBold.ttf", font_path);
    font = new FTGLBitmapFont(font_path.c_str());
    Fontbig = new FTGLBitmapFont(font_path.c_str());

    if (font->Error()) {
        DEBUG_ERROR("error on font");
    }
    font->FaceSize(18);
    if (Fontbig->Error()) {
        DEBUG_ERROR("error on font");
    }
    Fontbig->FaceSize(110);

    restartButton = new Button(10, 10, 100, 50, Resources_Manager.texture("restart_button.tga"), restartMatch);
    newMazeButton = new Button(10, 10, 100, 50, Resources_Manager.texture("newmaze_button.tga"), newMatch);
    toggleCameraButton = new Button(10, 10, 100, 50, Resources_Manager.texture("togglecamera_button.tga"), toggleCameraMode);

    Widget_List.push_back(restartButton);
    Widget_List.push_back(newMazeButton);
    Widget_List.push_back(toggleCameraButton);

    skybox.setTexture(Resources_Manager.texture("checkerboard.tga"));
    skybox.build(Config_Info.matrixDimensions.x*Tilesize*20.0f);
}
Пример #4
0
int model1::em_with_tricks(int noIterations, /*Perplexity& perp, sentenceHandler& sHandler1, */
                bool seedModel1, Dictionary& dictionary, bool useDict, Word2Vec& word2vec, bool useWord2Vec /*Perplexity* testPerp, sentenceHandler* testHandler,
										     Perplexity& trainViterbiPerp, Perplexity* testViterbiPerp */ )
{
  double minErrors=1.0;int minIter=0;
  string modelName="Model1",shortModelName="1";
  time_t st, it_st, fn, it_fn;
  string tfile, number, alignfile, test_alignfile;
  int pair_no;
  bool dump_files = false ;
  st = time(NULL);
  if(useWord2Vec && word2vec.Method == 2){
      word2vec.computeSimilarities(sHandler1);
  }
  sHandler1.rewind();
  cout << "==========================================================\n";
  cout << modelName << " Training Started at: "<< ctime(&st) << "\n";  
  cout << "useDict: " << useDict << endl;
  for(int it = 1; it <= noIterations; it++){
    pair_no = 0 ;
    it_st = time(NULL);
    cout <<  "-----------\n" << modelName << ": Iteration " << it << '\n';
    dump_files = (Model1_Dump_Freq != 0) &&  ((it % Model1_Dump_Freq)  == 0) && !NODUMPS ;
    number = "";
    int n = it;
    do{
      number.insert((size_t)0, 1, (char)(n % 10 + '0'));
    } while((n /= 10) > 0);
    tfile = Prefix + ".t" + shortModelName + "." + number ;
    alignfile = Prefix + ".A" + shortModelName + "." + number ;
    test_alignfile = Prefix +".tst.A" + shortModelName + "." + number ;
    initAL();
    em_loop(it,perp, sHandler1, seedModel1, dump_files, alignfile.c_str(), dictionary, useDict, word2vec, useWord2Vec, trainViterbiPerp);
    if (testPerp && testHandler) // calculate test perplexity
      em_loop(it,*testPerp, *testHandler, seedModel1, dump_files, test_alignfile.c_str(), dictionary, useDict, word2vec, useWord2Vec, *testViterbiPerp, true);
    if( errorsAL()<minErrors )
      {
	minErrors=errorsAL();
        minIter=it;
      }
    if (dump_files){
      if( OutputInAachenFormat==1 )
	tTable.printCountTable(tfile.c_str(),Elist.getVocabList(),Flist.getVocabList(),1);
    }
    tTable.normalizeTable(Elist, Flist);
    cout << modelName << ": ("<<it<<") TRAIN CROSS-ENTROPY " << perp.cross_entropy()
	 << " PERPLEXITY " << perp.perplexity() << '\n';
    if (testPerp && testHandler)
      cout << modelName << ": ("<<it<<") TEST CROSS-ENTROPY " << (*testPerp).cross_entropy()
	   << " PERPLEXITY " << (*testPerp).perplexity() 
	   << '\n';
    cout << modelName << ": ("<<it<<") VITERBI TRAIN CROSS-ENTROPY " << trainViterbiPerp.cross_entropy()
	 << " PERPLEXITY " << trainViterbiPerp.perplexity() << '\n';
    if (testPerp && testHandler)
      cout << modelName << ": ("<<it<<") VITERBI TEST CROSS-ENTROPY " << (*testViterbiPerp).cross_entropy()
	   << " PERPLEXITY " << (*testViterbiPerp).perplexity() 
	   << '\n';
    if (dump_files){
      if( OutputInAachenFormat==0 )
	tTable.printProbTable(tfile.c_str(),Elist.getVocabList(),Flist.getVocabList(),OutputInAachenFormat);
    }
    it_fn = time(NULL);
    cout << "Model 1 Iteration: " << it<< " took: " << difftime(it_fn, it_st) << " seconds\n";
  }
  fn = time(NULL) ;
  cout <<  "Entire " << modelName << " Training took: " << difftime(fn, st) << " seconds\n";
  return minIter;
}
Пример #5
0
int model2::em_with_tricks(int noIterations)
{
  double minErrors=1.0;int minIter=0;
  string modelName="Model2",shortModelName="2";
  time_t it_st, st, it_fn, fn;
  string tfile, afile, number, alignfile, test_alignfile;
  int pair_no = 0;
  bool dump_files = false ;
  ofstream of2 ;
  st = time(NULL) ;
  sHandler1.rewind();
  cout << "\n==========================================================\n";
  cout << modelName << " Training Started at: " << ctime(&st) << " iter: " << noIterations << "\n";
  for(int it=1; it <= noIterations ; it++){
    pair_no = 0;
    it_st = time(NULL) ;
    cout << endl << "-----------\n" << modelName << ": Iteration " << it << '\n';
    dump_files = (Model2_Dump_Freq != 0) && ((it % Model2_Dump_Freq) == 0) && !NODUMPS;
    number = "";
    int n = it;
    do{
      number.insert((size_t)0, 1, (char)(n % 10 + '0'));
    } while((n /= 10) > 0);
    tfile = Prefix + ".t" + shortModelName + "." + number ;
    afile = Prefix + ".a" + shortModelName + "." + number ;
    alignfile = Prefix + ".A" + shortModelName + "." + number ;
    test_alignfile = Prefix + ".tst.A" + shortModelName + "." + number ;
    aCountTable.clear();
    initAL();
    em_loop(perp, sHandler1, dump_files, alignfile.c_str(), trainViterbiPerp, false);
    if( errorsAL()<minErrors )
      {
	minErrors=errorsAL();
        minIter=it;
      }
    if (testPerp && testHandler)
      em_loop(*testPerp, *testHandler, dump_files, test_alignfile.c_str(), *testViterbiPerp, true); 
    if (dump_files&&OutputInAachenFormat==1)
      tTable.printCountTable(tfile.c_str(),Elist.getVocabList(),Flist.getVocabList(),1);
    tTable.normalizeTable(Elist, Flist);
    aCountTable.normalize(aTable);
    cout << modelName << ": ("<<it<<") TRAIN CROSS-ENTROPY " << perp.cross_entropy()
	 << " PERPLEXITY " << perp.perplexity() << '\n';
     if (testPerp && testHandler)
       cout << modelName << ": ("<<it<<") TEST CROSS-ENTROPY " << (*testPerp).cross_entropy()
	    << " PERPLEXITY " << (*testPerp).perplexity() 
	    << '\n';
     cout << modelName << ": ("<<it<<") VITERBI TRAIN CROSS-ENTROPY " << trainViterbiPerp.cross_entropy()
	 << " PERPLEXITY " << trainViterbiPerp.perplexity() << '\n';
    if (testPerp && testHandler)
       cout << modelName << ": ("<<it<<") VITERBI TEST CROSS-ENTROPY " << testViterbiPerp->cross_entropy()
	    << " PERPLEXITY " << testViterbiPerp->perplexity() 
	    << '\n';
    if (dump_files)
      {
	if(OutputInAachenFormat==0)
	  tTable.printProbTable(tfile.c_str(),Elist.getVocabList(),Flist.getVocabList(),OutputInAachenFormat);
	aCountTable.printTable(afile.c_str());
      }
    it_fn = time(NULL) ;
    cout << modelName << " Iteration: " << it<< " took: " << difftime(it_fn, it_st) << " seconds\n";
  } // end of iterations 
  aCountTable.clear();
  fn = time(NULL) ;
  cout << endl << "Entire " << modelName << " Training took: " << difftime(fn, st) << " seconds\n";
  //  cout << "tTable contains " << tTable.getHash().bucket_count() 
  //     << " buckets and  " << tTable.getHash().size() << " entries." ;
  cout << "==========================================================\n";
  return minIter;
}
Пример #6
0
int model1::em_with_tricks(int noIterations, bool seedModel1, Dictionary& dictionary, bool useDict)
{
  double minErrors=1.0;int minIter=0;
  string modelName="Model1",shortModelName="1";
  time_t st, it_st, fn, it_fn;
  string tfile, number, alignfile, test_alignfile;
  int pair_no;
  bool dump_files = false ;
  st = time(NULL);
  sHandler1.rewind();
  cout << "==========================================================\n";
  cout << modelName << " Training Started at: "<< ctime(&st) << "\n";  
  for(int it = 1; it <= noIterations; it++){
    pair_no = 0 ;
    srcHits_.clear();
    it_st = time(NULL);
    cout <<  "-----------\n" << modelName << ": Iteration " << it << '\n';
    dump_files = (Model1_Dump_Freq != 0) &&  ((it % Model1_Dump_Freq)  == 0) && !NODUMPS ;
    number = "";
    int n = it;
    do{
      number.insert((size_t)0, 1, (char)(n % 10 + '0'));
    } while((n /= 10) > 0);
    tfile = Prefix + ".t" + shortModelName + "." + number ;
    alignfile = Prefix + ".A" + shortModelName + "." + number ;
    test_alignfile = Prefix +".tst.A" + shortModelName + "." + number ;
    initAL();
    em_loop(it,perp, sHandler1, seedModel1, dump_files, alignfile.c_str(), dictionary, useDict, trainViterbiPerp); 
    if (testPerp && testHandler) // calculate test perplexity
      em_loop(it,*testPerp, *testHandler, seedModel1, dump_files, test_alignfile.c_str(), dictionary, useDict, *testViterbiPerp, true); 
    if( errorsAL()<minErrors ) {
      minErrors=errorsAL();
      minIter=it;
    }
    /*if (dump_files){
      if( OutputInAachenFormat==1 )
        tTable.printCountTable(tfile.c_str(),Elist.getVocabList(),Flist.getVocabList(),1);
    }*/
    if(step_k != 0) tTable.interpolateStepCounts(); // interpolate stepcounts and full counts here
    tTable.normalizeTable(Elist, Flist, &srcHits_);
    cout << modelName << ": ("<<it<<") TRAIN CROSS-ENTROPY " << perp.cross_entropy()
	 << " PERPLEXITY " << perp.perplexity() << '\n';
    if (testPerp && testHandler)
      cout << modelName << ": ("<<it<<") TEST CROSS-ENTROPY " << (*testPerp).cross_entropy()
	   << " PERPLEXITY " << (*testPerp).perplexity() 
	   << '\n';
    cout << modelName << ": ("<<it<<") VITERBI TRAIN CROSS-ENTROPY " << trainViterbiPerp.cross_entropy()
	 << " PERPLEXITY " << trainViterbiPerp.perplexity() << '\n';
    if (testPerp && testHandler)
      cout << modelName << ": ("<<it<<") VITERBI TEST CROSS-ENTROPY " << (*testViterbiPerp).cross_entropy()
	   << " PERPLEXITY " << (*testViterbiPerp).perplexity() 
	   << '\n';
    if (dump_files && (!run_giza_server)){
      tTable.printProbTable(tfile.c_str(),Elist.getVocabList(),Flist.getVocabList(),OutputInAachenFormat);
    }
    it_fn = time(NULL);
    cout << "Model 1 Iteration: " << it<< " took: " << difftime(it_fn, it_st) << " seconds\n";
  }  // end noIterations
  fn = time(NULL) ;
  cout <<  "Entire " << modelName << " Training took: " << difftime(fn, st) << " seconds\n";
  return minIter;
}
//@ASHISH VASWANI: A FUNCTION THAT RUNS A SINGLE ITERATION OF MODEL1. WILL BE NEEDED TO RUN E-F and 
//F-E SEPARATELY
int model1::em_with_tricks_e_step(int iterationNumber, /*Perplexity& perp, sentenceHandler& sHandler1, */
			    bool seedModel1,
          Dictionary& dictionary,
          bool useDict,
          string model_prefix /*Perplexity* testPerp, sentenceHandler* testHandler, 
										     Perplexity& trainViterbiPerp, Perplexity* testViterbiPerp */ )
{
  double minErrors=1.0;int minIter=0;
  string modelName="Model1",shortModelName="1";
  time_t st, it_st, fn, it_fn;
  string tfile, number, alignfile, test_alignfile;
  int pair_no;
  bool dump_files = false ;
  st = time(NULL);
  sHandler1.rewind();
  cout << "==========================================================\n";
  cout << modelName << " Training for iteration number "<<iterationNumber<<" Started at: "<< ctime(&st) << "\n";  
  //for(int it = 1; it <= noIterations; it++){
  int it = iterationNumber;
  pair_no = 0 ;
  it_st = time(NULL);
  cout <<  "-----------\n" << modelName << ": Iteration " << it << '\n';
  dump_files = (Model1_Dump_Freq != 0) &&  ((it % Model1_Dump_Freq)  == 0) && !NODUMPS ;
  number = "";
  int n = it;
  do{
    number.insert((size_t)0, 1, (char)(n % 10 + '0'));
  } while((n /= 10) > 0);
  tfile = Prefix + ".t" + model_prefix + "." + shortModelName + "." + number ;
  alignfile = Prefix + ".A" + model_prefix + "." + shortModelName + "." + number ;
  test_alignfile = Prefix +".tst.A" + model_prefix + "." + shortModelName + "." + number ;
  initAL();
  em_loop(it,perp, sHandler1, seedModel1, dump_files, alignfile.c_str(), dictionary, useDict, trainViterbiPerp); 
  if (testPerp && testHandler) // calculate test perplexity
    em_loop(it,*testPerp, *testHandler, seedModel1, dump_files, test_alignfile.c_str(), dictionary, useDict, *testViterbiPerp, true); 
  if( errorsAL()<minErrors )
    {
      minErrors=errorsAL();
      minIter=it;
    }
  if (dump_files){
    if( OutputInAachenFormat==1 )
      tTable.printCountTable(tfile.c_str(),Elist.getVocabList(),Flist.getVocabList(),1);
  }

  /*
  // accumulate expected counts
  vector<vector<COUNT> > expCntsVec,probsVec;
  vector<float> rowwiseExpCntsSum;
  cout<<" Accumulating expected counts "<<endl;
  tTable.getCounts(&expCntsVec,&rowwiseExpCntsSum);
  //printCounts(expCntsVec);
  //getchar();
  cout<<" Accumulating probabilities"<<endl;
  tTable.getProbs(&probsVec);
  //printCounts(probsVec);
  //getchar();
  cout<<" Normalizing t table"<<endl; 
  //tTable.normalizeTable(Elist, Flist);
  */

  /*
  cout << modelName << ": ("<<it<<") TRAIN CROSS-ENTROPY " << perp.cross_entropy()
    << " PERPLEXITY " << perp.perplexity() << '\n';
  if (testPerp && testHandler)
    cout << modelName << ": ("<<it<<") TEST CROSS-ENTROPY " << (*testPerp).cross_entropy()
      << " PERPLEXITY " << (*testPerp).perplexity() 
      << '\n';
  cout << modelName << ": ("<<it<<") VITERBI TRAIN CROSS-ENTROPY " << trainViterbiPerp.cross_entropy()
 << " PERPLEXITY " << trainViterbiPerp.perplexity() << '\n';
  if (testPerp && testHandler)
    cout << modelName << ": ("<<it<<") VITERBI TEST CROSS-ENTROPY " << (*testViterbiPerp).cross_entropy()
      << " PERPLEXITY " << (*testViterbiPerp).perplexity() 
      << '\n';
  if (dump_files){
    if( OutputInAachenFormat==0 )
      tTable.printProbTable(tfile.c_str(),Elist.getVocabList(),Flist.getVocabList(),OutputInAachenFormat);
  }
  */
  it_fn = time(NULL);
  cout << "Model 1 Iteration: " << it<< " took: " << difftime(it_fn, it_st) << " seconds\n";
  //}
  
  fn = time(NULL) ;
  cout <<  "Entire " << modelName << " Training of iteration number "<<iterationNumber<<" took: " << difftime(fn, st) << " seconds\n";
  return minIter;
}
Пример #8
0
View::View( QWidget * parent ) : QGraphicsView( parent )
{
	initGL();
	initAL();
	initScene();
}
Пример #9
0
int model1::em_with_tricks(int noIterations, /*Perplexity& perp, sentenceHandler& sHandler1, */
                           bool seedModel1, Dictionary& dictionary, bool useDict /*Perplexity* testPerp, sentenceHandler* testHandler,
										     Perplexity& trainViterbiPerp, Perplexity* testViterbiPerp */
                           , bool dumpCount ,  const char* dumpCountName, bool useString)  // If specified, then will dump files before last iteration
{
  double minErrors=1.0;
  int minIter=0;
  string modelName="Model1",shortModelName="1";
  time_t st, it_st, fn, it_fn;
  string tfile, number, alignfile, test_alignfile;
  bool dump_files = false ;
  st = time(NULL);
  sHandler1.rewind();
  cout << "==========================================================\n";
  cout << modelName << " Training Started at: "<< my_ctime(&st) << "\n";
  for(int it = 1; it <= noIterations; it++) {
    it_st = time(NULL);
    cout <<  "-----------\n" << modelName << ": Iteration " << it << '\n';
    dump_files = (Model1_Dump_Freq != 0) &&  ((it % Model1_Dump_Freq)  == 0 || it == noIterations) && !NODUMPS ;
    //dump_files = true;
    number = "";
    int n = it;
    do {
      number.insert((size_t)0, 1, (char)(n % 10 + '0'));
    } while((n /= 10) > 0);
    tfile = Prefix + ".t" + shortModelName + "." + number ;
    alignfile = Prefix + ".A" + shortModelName + "." + number+".part0" ;
    test_alignfile = Prefix +".tst.A" + shortModelName + "." + number ;
    initAL();
    threadID = 0;
    int th;
    vector<em_loop_t> ths;
    ths.resize(NCPUS);
    sHandler1.rewind();
    for (th=1; th<NCPUS; th++) {
      ths[th].m1=this;
      ths[th].it = it;
      ths[th].nthread = th;
      ths[th].dict = & dictionary;
      ths[th].useDict = useDict;
      ths[th].result = 0;
      ths[th].valid = pthread_create(&(ths[th].thread),NULL,exe_emloop,&(ths[th]));
      if(ths[th].valid) {
        cerr << "Error starting thread " << th << endl;
      }
    }
    em_loop(it,perp, sHandler1, seedModel1, dump_files, alignfile.c_str(), dictionary, useDict, trainViterbiPerp);
    perp.record("Model1");
    trainViterbiPerp.record("Model1");
    errorReportAL(cout, "IBM-1");

    cerr << "Main thread done, waiting" << endl;;
    for (th=1; th<NCPUS; th++) {
      pthread_join((ths[th].thread),NULL);
      cerr << "Thread " << th << "done" << endl;
    }
    if (testPerp && testHandler) // calculate test perplexity
      em_loop(it,*testPerp, *testHandler, seedModel1, dump_files, test_alignfile.c_str(), dictionary, useDict, *testViterbiPerp, true);
    if( errorsAL()<minErrors ) {
      minErrors=errorsAL();
      minIter=it;
    }
    //if (dump_files){
    //    if( OutputInAachenFormat==1 )
    //        tTable.printCountTable(tfile.c_str(),Elist.getVocabList(),Flist.getVocabList(),1);
    //}
    cerr << "Normalizing T " << endl;

    /**
     If asked for dumping count table, just dump it.
     */
    if(dumpCount && it == noIterations) {
      string realTableName = dumpCountName;
      realTableName += ".t.count";
      tTable.printCountTable(realTableName.c_str(),Elist.getVocabList(),Flist.getVocabList(),useString);
    }

    tTable.normalizeTable(Elist, Flist);
    //cout << tTable.getProb(2,2) << endl;
    cerr << " DONE Normalizing " << endl;
    cout << modelName << ": ("<<it<<") TRAIN CROSS-ENTROPY " << perp.cross_entropy()
         << " PERPLEXITY " << perp.perplexity() << '\n';
    if (testPerp && testHandler)
      cout << modelName << ": ("<<it<<") TEST CROSS-ENTROPY " << (*testPerp).cross_entropy()
           << " PERPLEXITY " << (*testPerp).perplexity()
           << '\n';
    cout << modelName << ": ("<<it<<") VITERBI TRAIN CROSS-ENTROPY " << trainViterbiPerp.cross_entropy()
         << " PERPLEXITY " << trainViterbiPerp.perplexity() << '\n';
    if (testPerp && testHandler)
      cout << modelName << ": ("<<
           it<<") VITERBI TEST CROSS-ENTROPY "
           << (*testViterbiPerp).cross_entropy()
           << " PERPLEXITY " << (*testViterbiPerp).perplexity()
           << '\n';
    if (dump_files) {
      if( OutputInAachenFormat==0 )
        tTable.printProbTable(tfile.c_str(),Elist.getVocabList(),
                              Flist.getVocabList(),OutputInAachenFormat);
    }
    it_fn = time(NULL);
    cout << "Model 1 Iteration: " << it<< " took: " << difftime(it_fn, it_st) << " seconds\n";


  }
  fn = time(NULL) ;
  cout <<  "Entire " << modelName << " Training took: " << difftime(fn, st) << " seconds\n";
  return minIter;
}