Example usage for weka.core Capabilities getMinimumNumberInstances

List of usage examples for weka.core Capabilities getMinimumNumberInstances

Introduction

In this page you can find the example usage for weka.core Capabilities getMinimumNumberInstances.

Prototype

public int getMinimumNumberInstances() 

Source Link

Document

returns the minimum number of instances that have to be in the dataset

Usage

From source file:adams.data.conversion.WekaCapabilitiesToSpreadSheet.java

License:Open Source License

/**
 * Performs the actual conversion./* w w  w. j a  va  2s . c  o m*/
 *
 * @return      the converted data
 * @throws Exception   if something goes wrong with the conversion
 */
@Override
protected Object doConvert() throws Exception {
    SpreadSheet result;
    Capabilities caps;
    Row row;

    caps = (Capabilities) m_Input;
    result = new DefaultSpreadSheet();
    result.setName(OptionUtils.getCommandLine(caps.getOwner()));

    // header
    row = result.getHeaderRow();
    row.addCell("K").setContent("Capability");
    row.addCell("S").setContent("Supported");
    row.addCell("D").setContent("Dependency");

    // data
    for (Capability cap : Capability.values()) {
        row = result.addRow();
        row.addCell("K").setContentAsString(cap.toString());
        row.addCell("S").setContent(caps.handles(cap));
        row.addCell("D").setContent(caps.hasDependency(cap));
    }
    row = result.addRow();
    row.addCell("K").setContentAsString("Minimum # Instances ");
    row.addCell("S").setContent(caps.getMinimumNumberInstances());

    return result;
}

From source file:adams.gui.help.WekaOptionHandlerHelpGenerator.java

License:Open Source License

/**
 * generates a string from the capapbilities, suitable to add to the help
 * text./*from ww w.j  a v a  2  s  .  c o  m*/
 *
 * @param title   the title for the capabilities
 * @param c      the capabilities
 * @return      a string describing the capabilities
 */
protected String addCapabilities(String title, Capabilities c) {
    String result;
    String caps;

    result = title + "<br>";

    // class
    caps = listCapabilities(c.getClassCapabilities());
    if (caps.length() != 0) {
        result += "<i>Class</i> - ";
        result += caps;
        result += "<br><br>";
    }

    // attribute
    caps = listCapabilities(c.getAttributeCapabilities());
    if (caps.length() != 0) {
        result += "<i>Attributes</i> - ";
        result += caps;
        result += "<br><br>";
    }

    // other capabilities
    caps = listCapabilities(c.getOtherCapabilities());
    if (caps.length() != 0) {
        result += "<i>Other</i> - ";
        result += caps;
        result += "<br><br>";
    }

    // additional stuff
    result += "<i>Additional</i><br>";
    result += "min # of instances: " + c.getMinimumNumberInstances() + "<br>";
    result += "<br>";

    return result;
}