ResultType
- Type of result to expect, such as GradientDescendableEvaluatorType
- Type of Evaluator to use internally, such as
DifferentiableEvaluatorpublic abstract class AbstractMinimizerBasedParameterCostMinimizer<ResultType extends VectorizableVectorFunction,EvaluatorType extends Evaluator<? super Vector,? extends java.lang.Double>> extends AnytimeAlgorithmWrapper<ResultType,FunctionMinimizer<Vector,java.lang.Double,? super EvaluatorType>> implements ParameterCostMinimizer<ResultType>
Modifier and Type | Field and Description |
---|---|
static SupervisedCostFunction<Vector,Vector> |
DEFAULT_COST_FUNCTION
Default cost function,
SumSquaredErrorCostFunction |
DEFAULT_ITERATION, iteration
Constructor and Description |
---|
AbstractMinimizerBasedParameterCostMinimizer(FunctionMinimizer<Vector,java.lang.Double,? super EvaluatorType> algorithm)
Creates a new instance of AbstractMinimizerBasedParameterCostMinimizer
|
AbstractMinimizerBasedParameterCostMinimizer(FunctionMinimizer<Vector,java.lang.Double,? super EvaluatorType> algorithm,
SupervisedCostFunction<Vector,Vector> costFunction)
Creates a new instance of AbstractMinimizerBasedParameterCostMinimizer
|
Modifier and Type | Method and Description |
---|---|
AbstractMinimizerBasedParameterCostMinimizer<ResultType,EvaluatorType> |
clone()
This makes public the clone method on the
Object class and
removes the exception that it throws. |
abstract EvaluatorType |
createInternalFunction()
Creates the internal function that maps the parameter set of
result as the input to the function, so that the minimization
algorithms can perturb this input in their minimization schemes.
|
SupervisedCostFunction<Vector,Vector> |
getCostFunction()
Gets the cost function that the learner is minimizing.
|
ResultType |
getObjectToOptimize()
Gets the object to optimize
|
NamedValue<java.lang.Double> |
getPerformance()
Gets the performance, which is the cost of the minimizer on the last
iteration.
|
ResultType |
getResult()
Gets the current result of the algorithm.
|
ResultType |
learn(java.util.Collection<? extends InputOutputPair<? extends Vector,Vector>> data)
The
learn method creates an object of ResultType using
data of type DataType , using some form of "learning" algorithm. |
void |
setCostFunction(SupervisedCostFunction<Vector,Vector> costFunction)
Setter for costFunction
|
void |
setObjectToOptimize(ResultType objectToOptimize)
Set the object to optimize
|
void |
setResult(ResultType result)
Setter for result
|
algorithmEnded, algorithmStarted, getAlgorithm, getIteration, getMaxIterations, isResultValid, readResolve, setAlgorithm, setMaxIterations, stepEnded, stepStarted, stop
addIterativeAlgorithmListener, fireAlgorithmEnded, fireAlgorithmStarted, fireStepEnded, fireStepStarted, getListeners, removeIterativeAlgorithmListener, setIteration, setListeners
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getMaxIterations, setMaxIterations
addIterativeAlgorithmListener, getIteration, removeIterativeAlgorithmListener
isResultValid, stop
public static final SupervisedCostFunction<Vector,Vector> DEFAULT_COST_FUNCTION
SumSquaredErrorCostFunction
public AbstractMinimizerBasedParameterCostMinimizer(FunctionMinimizer<Vector,java.lang.Double,? super EvaluatorType> algorithm)
algorithm
- Minimization algorithm to use.public AbstractMinimizerBasedParameterCostMinimizer(FunctionMinimizer<Vector,java.lang.Double,? super EvaluatorType> algorithm, SupervisedCostFunction<Vector,Vector> costFunction)
algorithm
- Minimization algorithm to use.costFunction
- Cost function to compute the cost of objectToOptimizepublic AbstractMinimizerBasedParameterCostMinimizer<ResultType,EvaluatorType> clone()
AbstractCloneableSerializable
Object
class and
removes the exception that it throws. Its default behavior is to
automatically create a clone of the exact type of object that the
clone is called on and to copy all primitives but to keep all references,
which means it is a shallow copy.
Extensions of this class may want to override this method (but call
super.clone()
to implement a "smart copy". That is, to target
the most common use case for creating a copy of the object. Because of
the default behavior being a shallow copy, extending classes only need
to handle fields that need to have a deeper copy (or those that need to
be reset). Some of the methods in ObjectUtil
may be helpful in
implementing a custom clone method.
Note: The contract of this method is that you must use
super.clone()
as the basis for your implementation.clone
in interface CloneableSerializable
clone
in class AnytimeAlgorithmWrapper<ResultType extends VectorizableVectorFunction,FunctionMinimizer<Vector,java.lang.Double,? super EvaluatorType extends Evaluator<? super Vector,? extends java.lang.Double>>>
public abstract EvaluatorType createInternalFunction()
public ResultType getObjectToOptimize()
ParameterCostMinimizer
getObjectToOptimize
in interface ParameterCostMinimizer<ResultType extends VectorizableVectorFunction>
public void setObjectToOptimize(ResultType objectToOptimize)
ParameterCostMinimizer
setObjectToOptimize
in interface ParameterCostMinimizer<ResultType extends VectorizableVectorFunction>
objectToOptimize
- object to optimizepublic ResultType getResult()
AnytimeAlgorithm
getResult
in interface AnytimeAlgorithm<ResultType extends VectorizableVectorFunction>
public void setResult(ResultType result)
result
- Result of the minimizationpublic ResultType learn(java.util.Collection<? extends InputOutputPair<? extends Vector,Vector>> data)
BatchLearner
learn
method creates an object of ResultType
using
data of type DataType
, using some form of "learning" algorithm.learn
in interface BatchCostMinimizationLearner<java.util.Collection<? extends InputOutputPair<? extends Vector,Vector>>,ResultType extends VectorizableVectorFunction>
learn
in interface BatchLearner<java.util.Collection<? extends InputOutputPair<? extends Vector,Vector>>,ResultType extends VectorizableVectorFunction>
data
- The data that the learning algorithm will use to create an
object of ResultType
.public SupervisedCostFunction<Vector,Vector> getCostFunction()
BatchCostMinimizationLearner
getCostFunction
in interface BatchCostMinimizationLearner<java.util.Collection<? extends InputOutputPair<? extends Vector,Vector>>,ResultType extends VectorizableVectorFunction>
public void setCostFunction(SupervisedCostFunction<Vector,Vector> costFunction)
costFunction
- Cost function that maps the object to optimize onto a scalar costpublic NamedValue<java.lang.Double> getPerformance()
getPerformance
in interface MeasurablePerformanceAlgorithm