/** * Train - Train for I iterations. * I is not necessarily m_E (yet)! */ public double train(double[][] X_, double[][] Y_, int I) throws Exception { if (getDebug()) { System.out.println("BPNN train; For "+I+" epochs ..."); } int N = X_.length; boolean breakEarly = (I < 0) ? true : false; I = Math.abs(I); double E_ = Double.MAX_VALUE; double E = 0.0; for(int e = 0; e < I; e++) { E = update(X_,Y_); if (breakEarly && E > E_) { if (getDebug()) System.out.println(" early stopped at epcho "+e+" ... "); break; // positive gradient } E_ = E; } if (getDebug()) System.out.println("Done."); return E; }
/** * Train - Train for I iterations. * I is not necessarily m_E (yet)! */ public double train(double[][] X_, double[][] Y_, int I) throws Exception { if (getDebug()) { System.out.println("BPNN train; For "+I+" epochs ..."); } int N = X_.length; boolean breakEarly = (I < 0) ? true : false; I = Math.abs(I); double E_ = Double.MAX_VALUE; double E = 0.0; for(int e = 0; e < I; e++) { E = update(X_,Y_); if (breakEarly && E > E_) { if (getDebug()) System.out.println(" early stopped at epcho "+e+" ... "); break; // positive gradient } E_ = E; } if (getDebug()) System.out.println("Done."); return E; }