Examples of ReadCSV


Examples of org.encog.util.csv.ReadCSV

  }
 
  public void loadCSV(String filename, boolean headers, CSVFormat format, int[] input, int[] ideal) {
    // first, just size it up
    ReadCSV csv = new ReadCSV(filename,headers,format);
    int lineCount = 0;
    while(csv.next()) {
      lineCount++;
    }
    csv.close();
   
    // allocate space to hold it
    float[][] data = new float[input.length+ideal.length][lineCount];
   
    // now read the data in
    csv = new ReadCSV(filename,headers,format);
    int rowIndex = 0;
    while(csv.next()) {
      int columnIndex = 0;
     
      for(int i=0;i<input.length;i++) {
        data[columnIndex++][rowIndex] = (float)csv.getDouble(input[i]);
      }
      for(int i=0;i<ideal.length;i++) {
        data[columnIndex++][rowIndex] = (float)csv.getDouble(ideal[i]);
      }
     
      rowIndex++;
    }
    csv.close();
   
    // now add the columns
    for(int i=0;i<data.length;i++) {
      addColumn(data[i]);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.