| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectemolib.classifier.eval.KFoldXValidation
public class KFoldXValidation
The KFoldXValidation class performs the k-fold cross-validation method on the stratified input data file.
The k-fold cross-validation method divides the input file into `k' parts, trains the specified classifier with `k-1' parts and tests it with the remaining part. The effectiveness is scored using a macroaveraging method (precision and recall calculations) and the results obtained over all iterations are averaged with the arithmetic mean.
It is emphasised that the input dataset needs to be stratified, i.e., each fold must maintain the category balance of the dataset.
This class uses the whole textual affect processing pipeline of EmoLib defined in an external config file, taking advantage from the partial contributions of each module. The KFoldXValidation class seeks the kfoldcv component in the XML config file, so please beware of its existence and correct definition.
The the KFoldXValidation is launched with one fold (test data) and a fixed dataset (training data), it performs the train-test process.
| Constructor Summary | |
|---|---|
| KFoldXValidation()Void constructor. | |
| Method Summary | |
|---|---|
|  void | evaluate(Classifier theClassifier)Method to evaluate the dataset and output the result of the k-fold cross-validation process. | 
|  int | indexOf(java.lang.String query,
        java.lang.String[] theArray)Function to get the index of a query in an array of strings. | 
|  void | inputFixedInstance(java.lang.String inputFixedInstance)Method to include a new fixed instance. | 
|  void | inputInstance(java.lang.String inputInstance)Mehtod to include a new input corpus instance into the system. | 
| static void | main(java.lang.String[] args)The main method of the KFoldXValidation application. | 
|  void | printSynopsis()Prints the synopsis. | 
|  void | setBasicCategories(java.lang.String inputCategories)Method to set the basic categories of the system. | 
|  void | setFixedDataset()Method to set only if a fixed dataset is given for training. | 
|  void | setNumberOfFolds(int nf)Method to set the number of folds. | 
|  void | setTextProcessingPipeline(AffectiveTagger pipe)Method to set the text processing pipeline. | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
|---|
public KFoldXValidation()
| Method Detail | 
|---|
public void setNumberOfFolds(int nf)
The - number of folds.public void setTextProcessingPipeline(AffectiveTagger pipe)
Reference - to the pipeline;public void setFixedDataset()
public void setBasicCategories(java.lang.String inputCategories)
inputCategories - The categories.public void inputInstance(java.lang.String inputInstance)
inputInstance - The input instance.public void inputFixedInstance(java.lang.String inputFixedInstance)
inputFixedInstance - The input fixed instance.public void evaluate(Classifier theClassifier)
theClassifier - The classifier.public void printSynopsis()
public int indexOf(java.lang.String query,
                   java.lang.String[] theArray)
query - The query.theArray - The array of strings.
public static void main(java.lang.String[] args)
                 throws java.lang.Exception
args - The input arguments.
java.lang.Exception| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||