Finds the best fit parameters.

@param initParam The initial set of parameters for the function.
@param X The inputs to the function.
@param Y The "observed" output of the function
@return true if it succeeded and false if it did not.
487818
public boolean optimize( DenseMatrix64F initParam ,
                             DenseMatrix64F X ,
                             DenseMatrix64F Y )
    {
        if (X.numRows == 0)
        {
            return false;
        }
        configure(initParam,X,Y);

        // save the cost of the initial parameters so that it knows if it improves or not
        initialCost = cost(param,X,Y);

        // iterate until the difference between the costs is insignificant
        // or it iterates too many times
        if( !adjustParam(X, Y, initialCost) ) {
            finalCost = Double.NaN;
            return false;
        }

        return true;
    }
145901
public List<InitParamType<PortletType<T>>> getAllInitParam()
   {
      List<InitParamType<PortletType<T>>> list = new ArrayList<InitParamType<PortletType<T>>>();
      List<Node> nodeList = childNode.get("init-param");
      for(Node node: nodeList)
      {
         InitParamType<PortletType<T>>  type = new InitParamTypeImpl<PortletType<T>>(this, "init-param", childNode, node);
         list.add(type);
      }
      return list;
   }
1316505
protected void init() {
        if (defaults) {
            initializeDefaults();
            return;
        }
        mapfx(cfgMap, new MapFunction<String, String>() {
            @Override
            public void apply(String name, String value) {
                processSetting(name, value);
            }
        });
        readComplete();
    }
553000
public void doFit(double[] xdata, double[] ydata, boolean reduced){
			CurveFitter fitter = new CurveFitter(xdata, ydata);
			if(reduced==false){
				double ia = Double.isNaN(initA)?0:initA;
				double ib = Double.isNaN(initB)?0:initB;
				double ic = Double.isNaN(initC)?0:initC;
				double id = Double.isNaN(initD)?0:initD;
				double[] initialParams = new double[]{ia,ib,ic,id};//,regest.evaluate()[0]};
				fitter.setInitialParameters(initialParams);
				//fitter.doCustomFit("y=a*(1-b*exp(-4*c*d*x/a))", initialParams, false);
				fitter.doCustomFit("y=sqrt(a*a)*(1-sqrt(b*b)*exp(-4*sqrt(c*c)*sqrt(d*d)*x/sqrt(a*a)))", initialParams, false);
				double[] params = fitter.getParams();
				a = Math.abs(params[0]);
				b = Math.abs(params[1]);
				c = Math.abs(params[2]);
				D = Math.abs(params[3]);
				goodness = fitter.getFitGoodness();
			}else{
				double ia = Double.isNaN(initA)?0:initA;
				double id = Double.isNaN(initD)?0:initD;
				double[] initialParams = new double[]{ia,id};//,regest.evaluate()[0]};
				fitter.setInitialParameters(initialParams);
				//fitter.doCustomFit("y=a*(1-b*exp(-4*c*d*x/a))", initialParams, false);
				fitter.doCustomFit("y=sqrt(a*a)*(1-exp(-4*sqrt(b*b)*x/sqrt(a*a)))", initialParams, false);
				double[] params = fitter.getParams();
				a = Math.abs(params[0]);
				D = Math.abs(params[1]);
				goodness = fitter.getFitGoodness();
			}
	}
388494
@Override
    public void init(String x, int minsize, int maxsize) {
        super.init(double2string(x), minsize, maxsize);
    }
2335
public void addFunctionParameter(final String param) {
    if (param == null || param.isEmpty()) {
      throw new IllegalArgumentException("Parameter cannot be null or empty");
    }
    if (func_params == null) {
      func_params = Lists.newArrayList();
    }
    func_params.add(param);
  }
1335210
def _initParams(self):
         
         params = SP.zeros(self.getNumberParams())
         self.setParams(params)
104259
@Override
    protected void init(DifferentiableBatchFunction function, IntDoubleVector point) {
        super.init(function, point);
        this.iterOfLastStep = new int[function.getNumDimensions()];
        Arrays.fill(iterOfLastStep, -1);        
        this.gradSumSquares = new double[function.getNumDimensions()];
        Arrays.fill(gradSumSquares, prm.initialSumSquares);
    }
557941
public void initialize(double initial[] , int numberOfParameters , double minimumFunctionValue ) {
		super.initialize(initial,numberOfParameters);

		tmp_p.reshape(numberOfParameters,1);

		regionRadius = config.regionInitial;

		fx = cost(x);

		if( verbose != null ) {
			verbose.println("Steps     fx        change      |step|   f-test     g-test    tr-ratio  region ");
			verbose.printf("%-4d  %9.3E  %10.3E  %9.3E  %9.3E  %9.3E  %6.2f   %6.2E\n",
					totalSelectSteps, fx, 0.0,0.0,0.0,0.0, 0.0, regionRadius);
		}

		this.parameterUpdate.initialize(this,numberOfParameters, minimumFunctionValue);

		// a perfect initial guess is a pathological case. easiest to handle it here
		if( fx <= minimumFunctionValue ) {
			if( verbose != null ) {
				verbose.println("Converged minimum value");
			}
			mode = TrustRegionBase_F64.Mode.CONVERGED;
		} else {
			mode = TrustRegionBase_F64.Mode.COMPUTE_DERIVATIVES;
		}
	}
887291
function(x, y) {
        OpenLayers.Geometry.prototype.initialize.apply(this, arguments);
        
        this.x = parseFloat(x);
        this.y = parseFloat(y);
    }
401587
public void startPath(double x, double y) {
		Point2D endPoint = new Point2D();
		endPoint.x = x;
		endPoint.y = y;
		startPath(endPoint);
	}
571685
void optimizeReset() {
    FlatParagraphTools flatPara = new FlatParagraphTools(xContext);
    flatPara.markFlatParasAsChecked(resetFrom + divNum, resetTo + divNum, isChecked);
    resetCheck = false;
  }
411461
@Override
	public void initParam(Object session) {
		super.initParam(session);
		
		this.session = (Session) session;
		for (AbstractParamPanel panel : super.getPanels()) {
			if (panel instanceof AbstractContextPropertiesPanel) {
				initContextPanel((AbstractContextPropertiesPanel) panel);
			}
		}
	}
473236
public ParamValueType<FilterType<T>> getOrCreateInitParam()
   {
      List<Node> nodeList = childNode.get("init-param");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new ParamValueTypeImpl<FilterType<T>>(this, "init-param", childNode, nodeList.get(0));
      }
      return createInitParam();
   }
814274
public void showAt(Node target, double x, double y) {
        requireNonNull(target, "Parameter 'target' is null");

        internalShow(pointer, target, x, y);
        pointer.setVisible(true);
    }
348311
public void addParameter(String parameterName, int parameterStart, int parameterEnd) {
        addParameter(parameterName, parameterStart, parameterEnd, null, null);
    }
883621
def _initParams(self, init_method=None):
        
        if self.bgRE:
            if init_method=='random':
                params0 = {'covar': sp.randn(self._gpNull.covar.getNumberParams())}
            else:
                if self.P==1:
                    params0 = {'covar':sp.sqrt(0.5) * sp.ones(2)}
                else:
                    cov = 0.5*sp.cov(self.Y.T) + 1e-4*sp.eye(self.P)
                    chol = la.cholesky(cov, lower=True)
                    params = chol[sp.tril_indices(self.P)]
                    params0 = {'covar': sp.concatenate([params, params])}
        else:
            if self.P==1:
                params_cn = sp.array([1.])
            else:
                cov = sp.cov(self.Y.T) + 1e-4*sp.eye(self.P)
                chol = la.cholesky(cov, lower=True)
                params_cn = chol[sp.tril_indices(self.P)]
            params0 = {'covar': params_cn}
        return params0