@Override public ParameterDifferentiableCostMinimizer clone() { return (ParameterDifferentiableCostMinimizer) super.clone(); }
/** * Creates a new instance of AbstractMinimizerBasedParameterCostMinimizer * @param algorithm * Minimization algorithm to use. * @param costFunction * Cost function to compute the cost of objectToOptimize */ public AbstractMinimizerBasedParameterCostMinimizer( FunctionMinimizer<Vector,Double,? super EvaluatorType> algorithm, SupervisedCostFunction<Vector,Vector> costFunction ) { super( algorithm ); this.setCostFunction( costFunction ); }
@Override public AbstractMinimizerBasedParameterCostMinimizer<ResultType,EvaluatorType> clone() { @SuppressWarnings("unchecked") AbstractMinimizerBasedParameterCostMinimizer<ResultType,EvaluatorType> clone = (AbstractMinimizerBasedParameterCostMinimizer<ResultType,EvaluatorType>) super.clone(); clone.setObjectToOptimize( ObjectUtil.cloneSafe( this.getObjectToOptimize() ) ); clone.setResult( ObjectUtil.cloneSafe( this.getResult() ) ); clone.setCostFunction( ObjectUtil.cloneSafe( this.getCostFunction() ) ); return clone; }
@SuppressWarnings("unchecked") public ResultType learn( Collection<? extends InputOutputPair<? extends Vector, Vector>> data ) { this.getCostFunction().setCostParameters( data ); this.setResult( (ResultType) this.getObjectToOptimize().clone() ); Vector parameters = this.getResult().convertToVector(); this.getAlgorithm().setInitialGuess( parameters ); EvaluatorType internalFunction = this.createInternalFunction(); InputOutputPair<Vector,Double> bestParameters = this.getAlgorithm().learn( internalFunction ); this.getResult().convertFromVector( bestParameters.getInput() ); return this.getResult(); }
/** * Gets the performance, which is the cost of the minimizer on the last * iteration. * * @return The performance of the algorithm. */ public NamedValue<Double> getPerformance() { Double performance = (this.getAlgorithm().getResult() != null) ? this.getAlgorithm().getResult().getSecond() : null; return new DefaultNamedValue<Double>( "cost", performance ); } }
@Override public AbstractMinimizerBasedParameterCostMinimizer<ResultType,EvaluatorType> clone() { @SuppressWarnings("unchecked") AbstractMinimizerBasedParameterCostMinimizer<ResultType,EvaluatorType> clone = (AbstractMinimizerBasedParameterCostMinimizer<ResultType,EvaluatorType>) super.clone(); clone.setObjectToOptimize( ObjectUtil.cloneSafe( this.getObjectToOptimize() ) ); clone.setResult( ObjectUtil.cloneSafe( this.getResult() ) ); clone.setCostFunction( ObjectUtil.cloneSafe( this.getCostFunction() ) ); return clone; }
@SuppressWarnings("unchecked") public ResultType learn( Collection<? extends InputOutputPair<? extends Vector, Vector>> data ) { this.getCostFunction().setCostParameters( data ); this.setResult( (ResultType) this.getObjectToOptimize().clone() ); Vector parameters = this.getResult().convertToVector(); this.getAlgorithm().setInitialGuess( parameters ); EvaluatorType internalFunction = this.createInternalFunction(); InputOutputPair<Vector,Double> bestParameters = this.getAlgorithm().learn( internalFunction ); this.getResult().convertFromVector( bestParameters.getInput() ); return this.getResult(); }
/** * Gets the performance, which is the cost of the minimizer on the last * iteration. * * @return The performance of the algorithm. */ public NamedValue<Double> getPerformance() { Double performance = (this.getAlgorithm().getResult() != null) ? this.getAlgorithm().getResult().getSecond() : null; return new DefaultNamedValue<Double>( "cost", performance ); } }
@Override public AbstractMinimizerBasedParameterCostMinimizer<ResultType,EvaluatorType> clone() { @SuppressWarnings("unchecked") AbstractMinimizerBasedParameterCostMinimizer<ResultType,EvaluatorType> clone = (AbstractMinimizerBasedParameterCostMinimizer<ResultType,EvaluatorType>) super.clone(); clone.setObjectToOptimize( ObjectUtil.cloneSafe( this.getObjectToOptimize() ) ); clone.setResult( ObjectUtil.cloneSafe( this.getResult() ) ); clone.setCostFunction( ObjectUtil.cloneSafe( this.getCostFunction() ) ); return clone; }
@SuppressWarnings("unchecked") public ResultType learn( Collection<? extends InputOutputPair<? extends Vector, Vector>> data ) { this.getCostFunction().setCostParameters( data ); this.setResult( (ResultType) this.getObjectToOptimize().clone() ); Vector parameters = this.getResult().convertToVector(); this.getAlgorithm().setInitialGuess( parameters ); EvaluatorType internalFunction = this.createInternalFunction(); InputOutputPair<Vector,Double> bestParameters = this.getAlgorithm().learn( internalFunction ); this.getResult().convertFromVector( bestParameters.getInput() ); return this.getResult(); }
@Override public ParameterDifferentiableCostMinimizer clone() { return (ParameterDifferentiableCostMinimizer) super.clone(); }
/** * Creates a new instance of AbstractMinimizerBasedParameterCostMinimizer * @param algorithm * Minimization algorithm to use. * @param costFunction * Cost function to compute the cost of objectToOptimize */ public AbstractMinimizerBasedParameterCostMinimizer( FunctionMinimizer<Vector,Double,? super EvaluatorType> algorithm, SupervisedCostFunction<Vector,Vector> costFunction ) { super( algorithm ); this.setCostFunction( costFunction ); }
/** * Gets the performance, which is the cost of the minimizer on the last * iteration. * * @return The performance of the algorithm. */ public NamedValue<Double> getPerformance() { Double performance = (this.getAlgorithm().getResult() != null) ? this.getAlgorithm().getResult().getSecond() : null; return new DefaultNamedValue<Double>( "cost", performance ); } }
@Override public ParameterDerivativeFreeCostMinimizer clone() { return (ParameterDerivativeFreeCostMinimizer) super.clone(); }
/** * Creates a new instance of AbstractMinimizerBasedParameterCostMinimizer * @param algorithm * Minimization algorithm to use. * @param costFunction * Cost function to compute the cost of objectToOptimize */ public AbstractMinimizerBasedParameterCostMinimizer( FunctionMinimizer<Vector,Double,? super EvaluatorType> algorithm, SupervisedCostFunction<Vector,Vector> costFunction ) { super( algorithm ); this.setCostFunction( costFunction ); }
@Override public ParameterDifferentiableCostMinimizer clone() { return (ParameterDifferentiableCostMinimizer) super.clone(); }
@Override public ParameterDerivativeFreeCostMinimizer clone() { return (ParameterDerivativeFreeCostMinimizer) super.clone(); }
@Override public ParameterDerivativeFreeCostMinimizer clone() { return (ParameterDerivativeFreeCostMinimizer) super.clone(); }