@Override public WeightVector train(SLProblem problem,WeightVector init) throws Exception {
  log.info("Starting Structured Perceptron learner");
  long start=System.currentTimeMillis();
  WeightVector avg=new WeightVector(10000);
  WeightVector w=init;
  int epoch=0;
  boolean done=false;
  int count=1;
  while (!done) {
    if (epoch % params.PROGRESS_REPORT_ITER == 0)     log.info("Starting epoch {}",epoch);
    count=doOneIteration(w,avg,problem,epoch,count);
    if (epoch % params.PROGRESS_REPORT_ITER == 0)     log.info("End of epoch {}. {} updates made",epoch,epochUpdateCount);
    epoch++;
    done=!reachedStoppingCriterion(w,epoch);
    if (params.PROGRESS_REPORT_ITER > 0 && (epoch + 1) % params.PROGRESS_REPORT_ITER == 0 && this.f != null)     f.run(w,inference);
  }
  long end=System.currentTimeMillis();
  log.info("Learning complete. Took {}s","" + (end - start) * 1.0 / 1000);
  WeightVector a=new WeightVector(w);
  a.addDenseVector(avg,-1.0f / (count));
  return a;
}

@ Override public WeightVector train ( SLProblem problem , WeightVector init ) throws Exception { log . info ( "Starting Structured Perceptron learner" ) ; long start = System . currentTimeMillis ( ) ; WeightVector avg = new WeightVector ( 10000 ) ; WeightVector w = init ; int epoch = 0 ; boolean done = false ; int count = 1 ; while ( ! done ) { if ( epoch % params . PROGRESS_REPORT_ITER == 0 ) log . info ( "Starting epoch {}" , epoch ) ; count = doOneIteration ( w , avg , problem , epoch , count ) ; if ( epoch % params . PROGRESS_REPORT_ITER == 0 ) log . info ( "End of epoch {}. {} updates made" , epoch , epochUpdateCount ) ; epoch ++ ; done = ! reachedStoppingCriterion ( w , epoch ) ; if ( params . PROGRESS_REPORT_ITER > 0 && ( epoch + 1 ) % params . PROGRESS_REPORT_ITER == 0 && this . f != null ) f . run ( w , inference ) ; } long end = System . currentTimeMillis ( ) ; log . info ( "Learning complete. Took {}s" , "" + ( end - start ) * 1.0 / 1000 ) ; WeightVector a = new WeightVector ( w ) ; a . addDenseVector ( avg , - 1.0f / ( count ) ) ; return a ; }
to train with a custom ( possibly non - zero ) initial weight vector
