/** * Fits a curve. * This method computes the coefficients of the curve that best * fit the sample of observed points. * * @param points Observations. * @return the fitted parameters. */ public double[] fit(Collection<WeightedObservedPoint> points) { // Perform the fit. return getOptimizer().optimize(getProblem(points)).getPoint().toArray(); }
public Optimum solve(double[] target, double[] weights, double[] initialPoint, boolean debugInfo) { if (debugInfo) { System.out.println("Max Number of Iterations : " + MAXNUMBEROFITERATIONS); } LeastSquaresProblem leastSquaresProblem = LeastSquaresFactory.create( // function to be optimized function, // target values at optimal point in least square equation // (x0+xi)^2 + (y0+yi)^2 + ri^2 = target[i] new ArrayRealVector(target, false), new ArrayRealVector(initialPoint, false), new DiagonalMatrix(weights), null, MAXNUMBEROFITERATIONS, MAXNUMBEROFITERATIONS); return leastSquaresOptimizer.optimize(leastSquaresProblem); }
/** * Fits a curve. * This method computes the coefficients of the curve that best * fit the sample of observed points. * * @param points Observations. * @return the fitted parameters. */ public double[] fit(Collection<WeightedObservedPoint> points) { // Perform the fit. return getOptimizer().optimize(getProblem(points)).getPoint().toArray(); }
/** * Fits a curve. * This method computes the coefficients of the curve that best * fit the sample of observed points. * * @param points Observations. * @return the fitted parameters. */ public double[] fit(Collection<WeightedObservedPoint> points) { // Perform the fit. return getOptimizer().optimize(getProblem(points)).getPoint().toArray(); }