org.debellor.base.evaluator
Class EvaluatorCell
java.lang.Object
org.debellor.core.Cell
org.debellor.base.evaluator.EvaluatorCell
- Direct Known Subclasses:
- CrossValidation, TrainAndTest
public class EvaluatorCell
- extends Cell
Base class for cells that implement evaluation of other cells -- decision systems.
To run evaluation you must insert the evaluated cell with either EvaluatorCell(Cell)
or setInner(Cell)
, set the data source with Cell.setSource(Cell)
and call Cell.learn()
which performs actual evaluation.
Afterwards you may read the result with either result()
or report()
.
If you want to use the same instance of EvaluatorCell
to run another evaluation
you must call Cell.erase()
first.
Note that usually the evaluated cell must be erasable
(it must correctly override Cell.onErase()
).
Parameters:
- score: score type, name of the
Score
class to be used to measure
quality of the evaluated decision system.
Currently either "Accuracy" (for classification problems) or
"RMSE" (root mean squared error, for regression problems).
Default: "Accuracy". Score instance of a different type can be set manually
with setScore(Score)
.
Note that manual setting of Score instance takes effect only
on the nearest invocation of learn
, as opposed to specifying the score type
through a parameter, which is effective on all consecutive calls to learn
until the parameter is explicitly changed.
- Author:
- Marcin Wojnarski
- See Also:
TrainAndTest
,
CrossValidation
Methods inherited from class org.debellor.core.Cell |
close, erase, getAvailableParams, getParameters, learn, newThread, newThread, next, onClose, onLearn, onNext, onOpen, open, openInputStream, set, set, set, set, setAvailableParams, setParameters, setRandomSeed, setSource, state, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
score
protected Score score
scoreFromUser
protected Score scoreFromUser
learner
protected Cell learner
EvaluatorCell
public EvaluatorCell()
EvaluatorCell
public EvaluatorCell(Cell cell)
setInner
public void setInner(Cell cell)
- Sets the cell - a decision system - that would undergo evaluation.
setScore
public void setScore(Score sc)
Sets Score
instance that will be used for calculation of a quality measure
of the evaluated decision system.
This method is an alternative for specifying the score type through
the cell parameter "score", which is a preferred way of doing this.
If both this method has been called and the parameter has been set,
the score instance passed to this method is used.
Supplied score instance will be used only in the nearest call to learn
.
The score will not be reset at the beginning of evaluation,
so the user may supply a previously-used score, in order to accumulate
results of different evaluations.
initScore
protected void initScore()
throws IllegalParameterValueException
- Throws:
IllegalParameterValueException
releaseData
protected void releaseData()
result
public java.lang.Double[] result()
report
public java.lang.String report()
onErase
protected void onErase()
throws java.lang.Exception
- Description copied from class:
Cell
- Called by
Cell.erase()
. Performs the actual erasure of cell content,
while erase
checks only against access violation and handles exceptions.
Must be overridden in subclasses if erasure is to be used.
Overriders may assume that the cell is in Cell.State.CLOSED
state.
- Overrides:
onErase
in class Cell
- Throws:
java.lang.Exception