|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--org.omegahat.Numerics.Optimizers.ModelObjectiveOmegahat
Create an object to evaluate a model function and possible gradients, starting from one or more Omegahat expressions.
| Field Summary | |
protected Evaluator |
evaluator
The evaluator object to be used to evaluate the objective. |
protected ExpressionInt |
initialize
An expression to be evaluated when the object is first intialized by the optimizer. |
protected ExpressionInt |
model
The expression defining the model objective, at the current parameter values. |
protected java.lang.String[] |
parameterNames
|
| Constructor Summary | |
ModelObjectiveOmegahat()
Create a model objective for which the model (as an Omegahat expression) and the evaluator will be specified later. |
|
ModelObjectiveOmegahat(ExpressionInt model)
Create the complete model objective with the given model formula and an empty evaluator of class BasicEvaluator. |
|
| Method Summary | |
void |
assignParameters(double[] pars)
Assign the parameters to the evaluator's database. |
void |
assignParameters(ModelPointNumericInt arg)
Assign the parameters from the model point to the evaluator's database. |
NumericArray |
collectGradient(ModelPointNumericInt x)
Retrieve the gradient from the database, if it is there and non-null. |
NumericMatrix |
collectHessian(ModelPointNumericInt x)
Retrieve the hessian from the database, if it is there and non-null. |
double |
collectValue(ModelPointNumericInt x)
Retrieve the value from the database and assign it into the value property of the model point argument. |
ModelPoint |
eval(ModelPointNumericInt arg)
Evaluate the model objective at this point. |
Evaluator |
getEvaluator()
Accessor for evaluator field |
NumericArray |
getGradient(ModelPointNumericInt x)
Retreive the return the computed gradient of the objective, and store it in the ModelPoint argument, if that is non-null. |
NumericMatrix |
getHessian(ModelPointNumericInt x)
Retreive the return the computed hessian of the objective, and store it in the ModelPoint argument, if that is non-null. |
ExpressionInt |
getInitialize()
Accessor for initialize field |
ExpressionInt |
getModel()
Accessor for model field |
java.lang.String[] |
getParameterNames()
Accessor for parameterNames field |
double |
getValue(ModelPointNumericInt x)
Retreive the return the computed value of the objective, and store it in the ModelPoint argument, if that is non-null. |
boolean |
handleError(ModelPointNumericInt current,
java.lang.Throwable e)
Handle an exception or error that occurred during the fitting. |
Evaluator |
setEvaluator(Evaluator value)
Accessor for setting evaluator field |
ExpressionInt |
setInitialize(ExpressionInt value)
Accessor for setting initialize field |
ExpressionInt |
setModel(ExpressionInt value)
Accessor for setting model field |
java.lang.String[] |
setParameterNames(java.lang.String[] value)
Accessor for setting parameterNames field |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected Evaluator evaluator
If not specified, the initializing code will create one.
protected ExpressionInt initialize
This may be used to attach database(s) or do other one-time computations.
protected ExpressionInt model
The method for communicating the parameter values to the expression and for communicating
the can be controlled in several ways.
By default, the parameters are assigned
under the name "Parameters" in the evaluator's default database.
If the property parameterNames is set to a
String[] array, the individual parameters will be assigned
with the corresponding names.
When the expression completes, it should assign the value of the model objective with
the name "Value"; if the gradient or hessian is computed by the expression,
these should be stored as "Gradient" or Hessian respectively.
We expect to define alternative communication mechanisms in the future; in any case, other communication mechanisms can be defined by sub-classing this class and over-riding the assignParameters, getValue, getGradient, or getHessian methods as appropriate.
protected java.lang.String[] parameterNames
| Constructor Detail |
public ModelObjectiveOmegahat()
public ModelObjectiveOmegahat(ExpressionInt model)
| Method Detail |
public Evaluator getEvaluator()
evaluator fieldpublic Evaluator setEvaluator(Evaluator value)
evaluator fieldpublic ExpressionInt getInitialize()
initialize fieldpublic ExpressionInt setInitialize(ExpressionInt value)
initialize fieldpublic ExpressionInt getModel()
model fieldpublic ExpressionInt setModel(ExpressionInt value)
model fieldpublic java.lang.String[] getParameterNames()
parameterNames fieldpublic java.lang.String[] setParameterNames(java.lang.String[] value)
parameterNames fieldpublic ModelPoint eval(ModelPointNumericInt arg)
eval in interface ModelObjectivepublic void assignParameters(double[] pars)
public void assignParameters(ModelPointNumericInt arg)
assignParameters in interface ModelObjectivepublic double getValue(ModelPointNumericInt x)
ModelObjectivegetValue in interface ModelObjectivepublic NumericArray getGradient(ModelPointNumericInt x)
ModelObjective
By convention, returns null if the gradient is not being computed.
getGradient in interface ModelObjectivepublic NumericMatrix getHessian(ModelPointNumericInt x)
ModelObjective
By convention, returns null if the hessian is not being computed.
getHessian in interface ModelObjectivepublic double collectValue(ModelPointNumericInt x)
public NumericArray collectGradient(ModelPointNumericInt x)
public NumericMatrix collectHessian(ModelPointNumericInt x)
If the model point has not been evaluated, first evaluate it.
public boolean handleError(ModelPointNumericInt current,
java.lang.Throwable e)
The default handler just prints some error information and sets the value to NaN.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||