Package weka.core.converters

Examples of weka.core.converters.CSVLoader


  Reader r = new BufferedReader(new FileReader(f));
  setInstances(new Instances(r));
  r.close();
      } else if (f.getName().toLowerCase().endsWith(CSVLoader.FILE_EXTENSION)) {
  fileType = "csv";
  CSVLoader cnv = new CSVLoader();
  cnv.setSource(f);
  Instances inst = cnv.getDataSet();
  setInstances(inst);
      } else {
  throw new Exception(Messages.getInstance().getString("ResultsPanel_SetInstancesFromFile_Error_Text"));
      }
    } catch (Exception ex) {
View Full Code Here


    else if(className.equalsIgnoreCase(ArffLoader.class.getName())) {
      ArffLoader arffLoader = (ArffLoader)loader.getLoader();
      buffer.append("  Loader type: ArffLoader" + "\n");
    }
    else if(className.equalsIgnoreCase(CSVLoader.class.getName())) {
      CSVLoader csvLoader = (CSVLoader)loader.getLoader();
      buffer.append("  Loader type: CSVLoader" + "\n");
    }
    else {
      buffer.append("  Loader type: Unknown" + "\n");
    }
View Full Code Here

        }
      } else if(className.equalsIgnoreCase(ArffLoader.class.getName())) {
        ArffLoader arffLoader = (ArffLoader)loader.getLoader();
        // setup operation goes here
      } else if(className.equalsIgnoreCase(CSVLoader.class.getName())) {
        CSVLoader csvLoader = (CSVLoader)loader.getLoader();
        // setup operation goes here       
      }   
    }
    logger.debug("OUT");
  }
View Full Code Here

      System.exit(-1);
    }
    try {
      Instances insts = null;
      if (args[0].endsWith(".csv")) {
        CSVLoader csv = new CSVLoader();
        csv.setFile(new File(args[0]));
        insts = csv.getDataSet();
      } else {
        insts = new Instances(new BufferedReader(new FileReader(args[0])));
      }

      CoverTree tree = new CoverTree();
View Full Code Here

  Reader r = new BufferedReader(new FileReader(f));
  setInstances(new Instances(r));
  r.close();
      } else if (f.getName().toLowerCase().endsWith(CSVLoader.FILE_EXTENSION)) {
  fileType = "csv";
  CSVLoader cnv = new CSVLoader();
  cnv.setSource(f);
  Instances inst = cnv.getDataSet();
  setInstances(inst);
      } else {
  throw new Exception("Unrecognized file type");
      }
    } catch (Exception ex) {
View Full Code Here

     *
     * @throws IOException
     * @return the set of instances read
     */
    public Instances readFromCSV() throws IOException {
        CSVLoader loader = new CSVLoader();
        loader.setSource(new File(_filename));
        _instances = loader.getDataSet();
        return _instances;
    }
View Full Code Here

    }

    public static Instances load(String csvFile) throws IOException {
        // load CSV
        System.out.println("Loading CSV dataset");
        CSVLoader loader = new MyCSVLoader();
        loader.setFieldSeparator("\\t");
        loader.setSource(new File(csvFile));
        Instances data = loader.getDataSet();
        return data;
    }
View Full Code Here

  Reader r = new BufferedReader(new FileReader(f));
  setInstances(new Instances(r));
  r.close();
      } else if (f.getName().toLowerCase().endsWith(CSVLoader.FILE_EXTENSION)) {
  fileType = "csv";
  CSVLoader cnv = new CSVLoader();
  cnv.setSource(f);
  Instances inst = cnv.getDataSet();
  setInstances(inst);
      } else {
  throw new Exception("Unrecognized file type");
      }
    } catch (Exception ex) {
View Full Code Here

      System.exit(-1);
    }
    try {
      Instances insts = null;
      if (args[0].endsWith(".csv")) {
        CSVLoader csv = new CSVLoader();
        csv.setFile(new File(args[0]));
        insts = csv.getDataSet();
      } else {
        insts = new Instances(new BufferedReader(new FileReader(args[0])));
      }

      CoverTree tree = new CoverTree();
View Full Code Here

        return fileNameString;
    }

    private boolean convertCSVtoARFF(String input, String output) throws  Exception{
    // load CSV
    CSVLoader loader = new CSVLoader();
    loader.setSource(new File(input));
    Instances data = loader.getDataSet();

    // save ARFF
    ArffSaver saver = new ArffSaver();
    saver.setInstances(data);
    saver.setFile(new File(output));
View Full Code Here

TOP

Related Classes of weka.core.converters.CSVLoader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.