Package org.apache.commons.math.optimization.general

Examples of org.apache.commons.math.optimization.general.AbstractLeastSquaresOptimizer


          minDegree, maxDegree);

      if (!polyDegreeDialog.isCancelled()) {
        setDegree(polyDegreeDialog.getDegree());

        final AbstractLeastSquaresOptimizer optimizer = new LevenbergMarquardtOptimizer();

        final PolynomialFitter fitter = new PolynomialFitter(
            getDegree(), optimizer);

        model = new IModel() {
          boolean interrupted = false;
          List<ValidObservation> fit;
          List<ValidObservation> residuals;
          PolynomialFunction function;
          // ICoordSource coordSrc = JDCoordSource.instance;
          Map<String, String> functionStrMap = new LinkedHashMap<String, String>();
          double aic = Double.NaN;
          double bic = Double.NaN;

          @Override
          public String getDescription() {
            return LocaleProps
                .get("MODEL_INFO_POLYNOMIAL_DEGREE_DESC")
                + degree
                + " for "
                + obs.get(0).getBand()
                + " series";
          }

          @Override
          public List<ValidObservation> getFit() {
            return fit;
          }

          @Override
          public List<ValidObservation> getResiduals() {
            return residuals;
          }

          @Override
          public String getKind() {
            return LocaleProps.get("ANALYSIS_MENU_POLYNOMIAL_FIT");
          }

          @Override
          public List<PeriodFitParameters> getParameters() {
            // None for a polynomial fit.
            return null;
          }

          @Override
          public boolean hasFuncDesc() {
            return true;
          }

          public String toFitMetricsString() throws AlgorithmError {
            String strRepr = functionStrMap
                .get("MODEL_INFO_FIT_METRICS_TITLE");

            // DecimalFormat fmt = NumericPrecisionPrefs
            // .getOtherOutputFormat();

            // List<Double> derivs = new ArrayList<Double>();

            if (strRepr == null) {
              // Goodness of fit.
              strRepr = "RMS: "
                  + NumericPrecisionPrefs
                      .formatOther(optimizer.getRMS());

              // Akaike and Bayesean Information Criteria.
              if (aic != Double.NaN && bic != Double.NaN) {
                strRepr += "\nAIC: "
                    + NumericPrecisionPrefs
View Full Code Here

TOP

Related Classes of org.apache.commons.math.optimization.general.AbstractLeastSquaresOptimizer

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.