Example usage for weka.attributeSelection AttributeSelection CVResultsString

List of usage examples for weka.attributeSelection AttributeSelection CVResultsString

Introduction

In this page you can find the example usage for weka.attributeSelection AttributeSelection CVResultsString.

Prototype

public String CVResultsString() throws Exception 

Source Link

Document

returns a string summarizing the results of repeated attribute selection runs on splits of a dataset.

Usage

From source file:adams.flow.transformer.WekaAttributeSelectionSummary.java

License:Open Source License

/**
 * Executes the flow item.//  w ww. j  av a2 s. co m
 *
 * @return      null if everything is fine, otherwise error message
 */
@Override
protected String doExecute() {
    String result;
    AttributeSelection eval;
    boolean crossValidation;
    WekaAttributeSelectionContainer cont;

    result = null;

    if (m_InputToken.getPayload() instanceof AttributeSelection) {
        eval = (AttributeSelection) m_InputToken.getPayload();
        try {
            eval.CVResultsString(); // throws an exception if no CV performed
            crossValidation = true;
        } catch (Exception e) {
            crossValidation = false;
        }
    } else {
        cont = (WekaAttributeSelectionContainer) m_InputToken.getPayload();
        eval = (AttributeSelection) cont.getValue(WekaAttributeSelectionContainer.VALUE_EVALUATION);
        crossValidation = cont.hasValue(WekaAttributeSelectionContainer.VALUE_FOLD_COUNT);
    }

    try {
        if (crossValidation)
            m_OutputToken = new Token(eval.CVResultsString());
        else
            m_OutputToken = new Token(eval.toResultsString());
    } catch (Exception e) {
        result = handleException("Failed to generate summary string!", e);
    }

    return result;
}