Example usage for weka.core.converters Loader getDataSet

List of usage examples for weka.core.converters Loader getDataSet

Introduction

In this page you can find the example usage for weka.core.converters Loader getDataSet.

Prototype

Instances getDataSet() throws IOException;

Source Link

Document

Return the full data set.

Usage

From source file:com.kdcloud.lib.rest.ext.AbstractInstancesRepresentation.java

License:Open Source License

public Instances getInstances() throws IOException {
    if (instances == null) {
        if (representation == null)
            throw new IOException("instances is null");
        if (representation instanceof AbstractInstancesRepresentation)
            instances = ((AbstractInstancesRepresentation) representation).getInstances();
        else {//from  www .  j  a v  a2  s.  c o  m
            Loader loader = getLoader();
            loader.setSource(representation.getStream());
            instances = loader.getDataSet();
        }
    }
    return instances;
}

From source file:sirius.trainer.step3.SelectFeaturePane.java

License:Open Source License

/**
 * Applies the selected converter/*from  w w  w.  j  a  v a 2 s .  c o m*/
 *
 * @param cnv the converter to apply to the input file
 * @param f the input file
 */
private void tryConverter(final Loader cnv, final File f) {
    if (applicationData.getOneThread() == null) {
        applicationData.setOneThread(new Thread() {
            public void run() {
                try {
                    cnv.setSource(f);
                    Instances inst = cnv.getDataSet();
                    setDataset1Instances(inst);
                } catch (Exception ex) {
                    JOptionPane
                            .showMessageDialog(parent,
                                    cnv.getClass().getName() + " failed to load '" + f.getName() + "'.\n"
                                            + "Reason:\n" + ex.getMessage(),
                                    "Convert File", JOptionPane.ERROR_MESSAGE);
                    converterQuery(f);
                }
                applicationData.setOneThread(null);
            }
        });
        applicationData.getOneThread().setPriority(Thread.MIN_PRIORITY); // UI has most priority
        applicationData.getOneThread().start();
    }
}