java.lang.Object
es.upm.fi.cig.multictbnc.performance.ValidationMethod
es.upm.fi.cig.multictbnc.performance.HoldOutMethod
Implements hold-out validation method.
-
Constructor Summary
ConstructorDescriptionHoldOutMethod
(DatasetReader datasetReader, double trainingSize, boolean estimateProbabilities, boolean shuffle, Long seed) Constructs aHoldOut
by receiving aDatasetReader
, the size of the training set and if the data should be shuffled. -
Method Summary
Modifier and TypeMethodDescriptionevaluate
(MultiCTBNC<?, ?> model) Evaluates the performance of the specified model using hold-out validation.evaluate
(MultiCTBNC<?, ?> model, double preprocessingExecutionTime) Evaluates the performance of the specified model and returns the results.void
Generates a training and a test dataset.Returns the training dataset.Methods inherited from class es.upm.fi.cig.multictbnc.performance.ValidationMethod
displayModel, displayResults, setWriter
-
Constructor Details
-
HoldOutMethod
public HoldOutMethod(DatasetReader datasetReader, double trainingSize, boolean estimateProbabilities, boolean shuffle, Long seed) Constructs aHoldOut
by receiving aDatasetReader
, the size of the training set and if the data should be shuffled.- Parameters:
datasetReader
- aDatasetReader
to read the datasettrainingSize
- size of the training dataset (percentage)estimateProbabilities
- true to estimate the probabilities of the class configurations, false otherwiseshuffle
- true to shuffle the sequences before splitting them into training and test datasets, false otherwiseseed
- seed used to shuffle the sequences
-
-
Method Details
-
generateTrainAndTest
Generates a training and a test dataset.- Throws:
UnreadDatasetException
- if the provided dataset could not be read
-
getTraining
Returns the training dataset.- Returns:
- training dataset
-
evaluate
public Map<String,Double> evaluate(MultiCTBNC<?, ?> model) throws UnreadDatasetException, ErroneousValueExceptionEvaluates the performance of the specified model using hold-out validation.- Specified by:
evaluate
in classValidationMethod
- Parameters:
model
- model to evaluate- Returns:
- test results in a
Map
- Throws:
UnreadDatasetException
- if the provided dataset could not be readErroneousValueException
- if a provided parameter is erroneous for the requested task
-
evaluate
public Map<String,Double> evaluate(MultiCTBNC<?, ?> model, double preprocessingExecutionTime) throws UnreadDatasetException, ErroneousValueExceptionDescription copied from class:ValidationMethod
Evaluates the performance of the specified model and returns the results. This method receives the execution time of previous tasks so it is add up to the total mean learning time.- Specified by:
evaluate
in classValidationMethod
- Parameters:
model
- model to evaluatepreprocessingExecutionTime
- execution time of previous tasks- Returns:
- results saved in a
Map
. - Throws:
UnreadDatasetException
- if there was an error while reading a datasetErroneousValueException
- if a provided parameter is erroneous for the requested task
-