List of usage examples for org.apache.commons.math3.optimization.univariate UnivariatePointValuePair getPoint
public double getPoint()
From source file:com.itemanalysis.psychometrics.kernel.LikelihoodCrossValidation.java
public double value() { BrentOptimizer brent = new BrentOptimizer(1e-10, 1e-14); UnivariatePointValuePair result; result = brent.optimize(400, this, GoalType.MAXIMIZE, 0.001, max); return result.getPoint(); }
From source file:com.itemanalysis.psychometrics.polycor.PolychoricTwoStepOLD.java
/** * Compute the two-step approximation to the polychoric correlation. * * @param data two way array of frequency counts *///from www .j a v a2 s . c o m public void compute(double[][] data) { loglik = new PolychoricLogLikelihoodTwoStep(data); BrentOptimizer brent = new BrentOptimizer(1e-10, 1e-14); UnivariatePointValuePair result = brent.optimize(200, loglik, GoalType.MINIMIZE, -1.0, 1.0); rhoComputed = true; rho = result.getPoint(); }
From source file:com.itemanalysis.psychometrics.kernel.LeastSquaresCrossValidation.java
public double value() { BrentOptimizer brent = new BrentOptimizer(1e-10, 1e-14); UnivariatePointValuePair pair; try {/*from ww w.j a va2s .c om*/ pair = brent.optimize(400, this, GoalType.MINIMIZE, 0.01, sd); } catch (Exception ex) { return Double.NaN; } return pair.getPoint(); }
From source file:edu.byu.nlp.math.optimize.UnivariateNewtonRaphson.java
/** {@inheritDoc} */ @Override/*from w w w .j av a 2 s. c om*/ public UnivariatePointValuePair optimize(int maxEval, DifferentiableUnivariateFunction f, GoalType goalType, double initial, double arg4) { Preconditions.checkArgument(maxEval > 0); Preconditions.checkNotNull(f); Preconditions.checkNotNull(goalType); Preconditions.checkNotNull(initial); // FIXME : goalType is being ignored! Updater updater = Updater.newUpdater(f); UnivariatePointValuePair prev = null; UnivariatePointValuePair next = updater.update(initial); logger.info(String.format("Iteration 0, value = %f", next.getValue())); evaluations = 1; do { prev = next; double x = prev.getPoint(); next = updater.update(x); ++evaluations; logger.info(String.format("Iteration %d, value = %f", evaluations, next.getValue())); } while (!convergenceChecker.converged(evaluations, prev, next) && evaluations < maxEval && evaluations < maxEvaluations); return next; }