Example usage for weka.classifiers.trees.j48 Distribution add

List of usage examples for weka.classifiers.trees.j48 Distribution add

Introduction

In this page you can find the example usage for weka.classifiers.trees.j48 Distribution add.

Prototype

public final void add(int bagIndex, double[] counts) 

Source Link

Document

Adds counts to given bag.

Usage

From source file:org.knime.knip.suise.node.port.WekaClassifierPortObject.java

License:Open Source License

/**
 * {@inheritDoc}/*from  w  w  w .j ava2 s .com*/
 */
@Override
public JComponent[] getViews() {

    JPanel panel = new JPanel(new GridLayout(1, 2));

    // classifier info
    JPanel classifierInfoPanel = new JPanel();
    String text = m_classifier.getClass().getSimpleName() + "\n";
    text += m_classifier.toString();
    classifierInfoPanel.add(new JTextArea(text));
    classifierInfoPanel.setBorder(BorderFactory.createTitledBorder("Weka Classifier Details"));
    panel.add(new JScrollPane(classifierInfoPanel));

    // training instances info
    if (m_trainingInstances.numInstances() > 0) {
        JPanel dataInfoPanel = new JPanel();
        text = "Training instances\n\n";
        Distribution distr = new Distribution(1, m_trainingInstances.numClasses());
        for (Instance i : m_trainingInstances) {
            try {
                distr.add(0, i);
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }

        text += "Class-distribution: " + Arrays.toString(distr.matrix()[0]) + " (labels: "
                + Arrays.toString(m_modelspec.getClassLabels()) + ")" + "\n\n";
        text += m_trainingInstances.toSummaryString();

        dataInfoPanel.add(new JTextArea(text));
        dataInfoPanel.setBorder(BorderFactory.createTitledBorder("Training Instances Details"));
        panel.add(new JScrollPane(dataInfoPanel));
    }

    panel.setName("Weka Outport");
    return new JComponent[] { panel };
}