/** * Compute the gradient vector. * * @param evaluationPoint Point at which the gradient must be evaluated. * @return the gradient at the specified point. */ protected double[] computeObjectiveGradient(final double[] evaluationPoint) { return gradient.value(evaluationPoint); }
/** * Compute the gradient vector. * * @param params Point at which the gradient must be evaluated. * @return the gradient at the specified point. */ protected double[] computeObjectiveGradient(final double[] params) { return gradient.value(params); }
/** * Compute the gradient vector. * * @param evaluationPoint Point at which the gradient must be evaluated. * @return the gradient at the specified point. * @throws org.apache.commons.math3.exception.TooManyEvaluationsException * if the allowed number of evaluations is exceeded. */ protected double[] computeObjectiveGradient(final double[] evaluationPoint) { return gradient.value(evaluationPoint); }
/** {@inheritDoc} */ public RealVector computeValue(final double[] params) { return new ArrayRealVector(value.value(params), false); }
/** * Computes the objective function value. * This method <em>must</em> be called by subclasses to enforce the * evaluation counter limit. * * @param params Point at which the objective function must be evaluated. * @return the objective function value at the specified point. * @throws TooManyEvaluationsException if the maximal number of evaluations * (of the model vector function) is exceeded. */ protected double[] computeObjectiveValue(double[] params) { super.incrementEvaluationCount(); return model.value(params); }
/** * Compute the objective function value. * * @param point Point at which the objective function must be evaluated. * @return the objective function value at the specified point. * @throws TooManyEvaluationsException if the maximal number of evaluations is * exceeded. */ protected double[] computeObjectiveValue(double[] point) { try { evaluations.incrementCount(); } catch (MaxCountExceededException e) { throw new TooManyEvaluationsException(e.getMax()); } return function.value(point); }
final double[] residuals = function.value(point); if (residuals.length != observations.length) { throw new DimensionMismatchException(residuals.length, observations.length);
final double[] residuals = function.value(point); if (residuals.length != observations.length) { throw new DimensionMismatchException(residuals.length, observations.length);
final double[] gradient = f.gradient().value(point);
/** * Compute the gradient vector. * * @param evaluationPoint Point at which the gradient must be evaluated. * @return the gradient at the specified point. */ protected double[] computeObjectiveGradient(final double[] evaluationPoint) { return gradient.value(evaluationPoint); }
/** * Compute the gradient vector. * * @param evaluationPoint Point at which the gradient must be evaluated. * @return the gradient at the specified point. * @throws org.apache.commons.math3.exception.TooManyEvaluationsException * if the allowed number of evaluations is exceeded. */ protected double[] computeObjectiveGradient(final double[] evaluationPoint) { return gradient.value(evaluationPoint); }
/** * Compute the gradient vector. * * @param params Point at which the gradient must be evaluated. * @return the gradient at the specified point. */ protected double[] computeObjectiveGradient(final double[] params) { return gradient.value(params); }
/** * Compute the gradient vector. * * @param params Point at which the gradient must be evaluated. * @return the gradient at the specified point. */ protected double[] computeObjectiveGradient(final double[] params) { return gradient.value(params); }
@Override public double[][] value(double[] point) throws IllegalArgumentException { double[][] retVal = new double[xgrid1.length + xgrid2.length][point.length]; for(int i = 0; i < point.length; i++) { double[] newPoint = point.clone(); newPoint[i] = newPoint[i] + step; double[] f1 = valueFunction.value(newPoint); double[] f2 = valueFunction.value(point); for(int j = 0; j < f1.length; j++) { retVal[j][i] = (f1[j] - f2[j]) / step; } } return retVal; } };
/** * Computes the objective function value. * This method <em>must</em> be called by subclasses to enforce the * evaluation counter limit. * * @param params Point at which the objective function must be evaluated. * @return the objective function value at the specified point. * @throws TooManyEvaluationsException if the maximal number of evaluations * (of the model vector function) is exceeded. */ protected double[] computeObjectiveValue(double[] params) { super.incrementEvaluationCount(); return model.value(params); }
/** {@inheritDoc} */ public RealVector computeValue(final double[] params) { return new ArrayRealVector(value.value(params), false); }
/** {@inheritDoc} */ public RealVector computeValue(final double[] params) { return new ArrayRealVector(value.value(params), false); }
/** * Computes the objective function value. * This method <em>must</em> be called by subclasses to enforce the * evaluation counter limit. * * @param params Point at which the objective function must be evaluated. * @return the objective function value at the specified point. * @throws TooManyEvaluationsException if the maximal number of evaluations * (of the model vector function) is exceeded. */ protected double[] computeObjectiveValue(double[] params) { super.incrementEvaluationCount(); return model.value(params); }
@Override public double[] value(double[] point) throws IllegalArgumentException { fixParams(point); // double[] retVal = new double[xgrid.length]; Arrays.fill(retVal, 0.0); for(int i = 0; i < nmol; i++) { double [] tmp = Arrays.copyOfRange(point, i*Params.PARAMS_LENGTH, (i+1)*Params.PARAMS_LENGTH); double [] values = psf.getValueFunction(xgrid, ygrid).value(tmp); for(int j = 0; j < values.length; j++) { retVal[j] += values[j]; } } return retVal; } };
@Override public double value(double[] point) { double[] expectedValues = valueFunction.value(point); double logLikelihood = 0; int index = 0; for(int i = 0; i < values1.length; i++, index++) { logLikelihood += values1[i] * Math.max(-1e6, log(expectedValues[index])) - expectedValues[index]; } for(int i = 0; i < values2.length; i++, index++) { logLikelihood += values2[i] * Math.max(-1e6, log(expectedValues[index])) - expectedValues[index]; } return logLikelihood; } };