Package org.apache.commons.math3.optim.nonlinear.vector

Examples of org.apache.commons.math3.optim.nonlinear.vector.ModelFunction


    public void testGetIterations() {
        AbstractLeastSquaresOptimizer optim = createOptimizer();
        optim.optimize(new MaxEval(100), new Target(new double[] { 1 }),
                       new Weight(new double[] { 1 }),
                       new InitialGuess(new double[] { 3 }),
                       new ModelFunction(new MultivariateVectorFunction() {
                               public double[] value(double[] point) {
                                   return new double[] {
                                       FastMath.pow(point[0], 4)
                                   };
                               }
View Full Code Here


        public Target getTarget() {
            return new Target(target);
        }

        public ModelFunction getModelFunction() {
            return new ModelFunction(new MultivariateVectorFunction() {
                    public double[] value(double[] params) {
                        return factors.operate(params);
                    }
                });
        }
View Full Code Here

        /**
         * @return the model function values.
         */
        public ModelFunction getModelFunction() {
            return new ModelFunction(new MultivariateVectorFunction() {
                    /** {@inheritDoc} */
                    public double[] value(double[] point) {
                        // compute the residuals
                        final double[] values = new double[observations.size()];
                        int i = 0;
View Full Code Here

        return w;
    }

    public ModelFunction getModelFunction() {
        return new ModelFunction(new MultivariateVectorFunction() {
                public double[] value(double[] params) {
                    final double cx = params[0];
                    final double cy = params[1];
                    final double r = params[2];
View Full Code Here

        return w;
    }

    public ModelFunction getModelFunction() {
        return new ModelFunction(new MultivariateVectorFunction() {
                public double[] value(double[] params) {
                    final Model line = new Model(params[0], params[1]);

                    final double[] model = new double[points.size()];
                    for (int i = 0; i < points.size(); i++) {
View Full Code Here

        this.problem = new LeastSquaresProblem();
    }

    class LeastSquaresProblem {
        public ModelFunction getModelFunction() {
            return new ModelFunction(new MultivariateVectorFunction() {
                    public double[] value(final double[] a) {
                        final int n = getNumObservations();
                        final double[] yhat = new double[n];
                        for (int i = 0; i < n; i++) {
                            yhat[i] = getModelValue(getX(i), a);
View Full Code Here

                }
            }
        }

        public ModelFunction getModelFunction() {
            return new ModelFunction(new MultivariateVectorFunction() {
                    public double[] value(double[] point) {
                        return computeValue(point);
                    }
                });
        }
View Full Code Here

            this.x.add(x);
            this.y.add(y);
        }

        public ModelFunction getModelFunction() {
            return new ModelFunction(new MultivariateVectorFunction() {
                    public double[] value(double[] variables) {
                        double[] values = new double[x.size()];
                        for (int i = 0; i < values.length; ++i) {
                            values[i] = (variables[0] * x.get(i) + variables[1]) * x.get(i) + variables[2];
                        }
View Full Code Here

            time.add(t);
            count.add(c);
        }

        public ModelFunction getModelFunction() {
            return new ModelFunction(new MultivariateVectorFunction() {
                    public double[] value(double[] params) {
                        double[] values = new double[time.size()];
                        for (int i = 0; i < values.length; ++i) {
                            final double t = time.get(i);
                            values[i] = params[0] +
View Full Code Here

        }
        return r / points.size();
    }

    public ModelFunction getModelFunction() {
        return new ModelFunction(new MultivariateVectorFunction() {
                public double[] value(double[] params) {
                    Vector2D center = new Vector2D(params[0], params[1]);
                    double radius = getRadius(center);
                    double[] residuals = new double[points.size()];
                    for (int i = 0; i < residuals.length; i++) {
View Full Code Here

TOP

Related Classes of org.apache.commons.math3.optim.nonlinear.vector.ModelFunction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.