model.getModelFunctionJacobian(), new Target(target), new Weight(weights), new InitialGuess(initialGuess));
/** * Scans the list of (required and optional) optimization data that * characterize the problem. * If the weight matrix is specified, the {@link #weightMatrixSqrt} * field is recomputed. * * @param optData Optimization data. The following data will be looked for: * <ul> * <li>{@link Weight}</li> * </ul> */ @Override protected void parseOptimizationData(OptimizationData... optData) { // Allow base class to register its own data. super.parseOptimizationData(optData); // The existing values (as set by the previous call) are reused if // not provided in the argument list. for (OptimizationData data : optData) { if (data instanceof Weight) { weightMatrixSqrt = squareRoot(((Weight) data).getWeight()); // If more data must be parsed, this statement _must_ be // changed to "continue". break; } } }
model.getModelFunctionJacobian(), new Target(target), new Weight(weights), new InitialGuess(initialGuess));
weightMatrix = ((Weight) data).getWeight(); continue;
model.getModelFunctionJacobian(), new Target(target), new Weight(weights), new InitialGuess(initialGuess));
/** * Scans the list of (required and optional) optimization data that * characterize the problem. * If the weight matrix is specified, the {@link #weightMatrixSqrt} * field is recomputed. * * @param optData Optimization data. The following data will be looked for: * <ul> * <li>{@link Weight}</li> * </ul> */ @Override protected void parseOptimizationData(OptimizationData... optData) { // Allow base class to register its own data. super.parseOptimizationData(optData); // The existing values (as set by the previous call) are reused if // not provided in the argument list. for (OptimizationData data : optData) { if (data instanceof Weight) { weightMatrixSqrt = squareRoot(((Weight) data).getWeight()); // If more data must be parsed, this statement _must_ be // changed to "continue". break; } } }
protected Molecule fit(ILsqFunctions functions) { // init double[] weights = functions.calcWeights(useWeighting); double[] observations = functions.getObservations(); // fit LevenbergMarquardtOptimizer optimizer = new LevenbergMarquardtOptimizer( new SimplePointChecker<PointVectorValuePair>(10e-10, 10e-10, maxIter)); PointVectorValuePair pv; pv = optimizer.optimize( MaxEval.unlimited(), new MaxIter(MAX_ITERATIONS + 1), new ModelFunction(functions.getValueFunction()), new ModelFunctionJacobian(functions.getJacobianFunction()), new Target(observations), new InitialGuess(psfModel.transformParametersInverse(functions.getInitialParams())), new Weight(weights)); // estimate background and return an instance of the `Molecule` fittedParameters = pv.getPointRef(); if (bkgStdColumn >= 0) { fittedParameters[bkgStdColumn] = VectorMath.stddev(sub(observations, functions.getValueFunction().value(fittedParameters))); } return psfModel.newInstanceFromParams(psfModel.transformParameters(fittedParameters), functions.getImageUnits(), true); } }
/** * Scans the list of (required and optional) optimization data that * characterize the problem. * If the weight matrix is specified, the {@link #weightMatrixSqrt} * field is recomputed. * * @param optData Optimization data. The following data will be looked for: * <ul> * <li>{@link Weight}</li> * </ul> */ @Override protected void parseOptimizationData(OptimizationData... optData) { // Allow base class to register its own data. super.parseOptimizationData(optData); // The existing values (as set by the previous call) are reused if // not provided in the argument list. for (OptimizationData data : optData) { if (data instanceof Weight) { weightMatrixSqrt = squareRoot(((Weight) data).getWeight()); // If more data must be parsed, this statement _must_ be // changed to "continue". break; } } }
weightMatrix = ((Weight) data).getWeight(); continue;
weightMatrix = ((Weight) data).getWeight(); continue;