List of usage examples for org.apache.commons.math3.optimization.direct CMAESOptimizer DEFAULT_MAXITERATIONS
int DEFAULT_MAXITERATIONS
To view the source code for org.apache.commons.math3.optimization.direct CMAESOptimizer DEFAULT_MAXITERATIONS.
Click Source Link
From source file:edu.stevens.cpe.reservior.readout.CMAES.java
public double[] train(int numberWeightsToTrain) { this.epoch = 0; //Number of weights to evolve final double[] start = new double[numberWeightsToTrain]; Arrays.fill(start, startValue); final double[] lower = new double[numberWeightsToTrain]; Arrays.fill(lower, lowerBound); final double[] upper = new double[numberWeightsToTrain]; Arrays.fill(upper, upperBound); //Set to 1/3 the initial search volume final double[] sigma = new double[numberWeightsToTrain]; Arrays.fill(sigma, insigma);//from w w w . j av a2 s .c o m int lambda = 4 + (int) (3. * Math.log(numberWeightsToTrain)); int maxEvals = CMAESOptimizer.DEFAULT_MAXITERATIONS; double stopValue = .01; boolean isActive = true; //Chooses the covariance matrix update method. int diagonalOnly = 0; int checkFeasable = 0; final CMAESOptimizer optimizer = new CMAESOptimizer(lambda, sigma, CMAESOptimizer.DEFAULT_MAXITERATIONS, stopValue, isActive, diagonalOnly, checkFeasable, new MersenneTwister(), false); final PointValuePair result = optimizer.optimize(maxEvals, fitnessFuntion, GoalType.MINIMIZE, start, lower, upper); logger.info(Arrays.toString(result.getPoint())); logger.info("Best weights: " + Arrays.toString(bestWeights)); updateReadoutWeights(result.getPoint()); logger.info("done training."); return bestWeights; }