コード例 #1
0
 public MLDataSet getValidationSet() {
   if (this.comboValidation.getSelectedValue() == null) return null;
   File file = ((ProjectTraining) this.comboValidation.getSelectedValue()).getFile();
   BufferedMLDataSet result = new BufferedMLDataSet(file);
   if (this.loadToMemory.getValue()) return result.loadToMemory();
   else return result;
 }
コード例 #2
0
  public static void convertCSV2Binary(
      File csvFile, CSVFormat format, File binFile, int[] input, int[] ideal, boolean headers) {

    binFile.delete();
    ReadCSV csv = new ReadCSV(csvFile.toString(), headers, format);

    BufferedMLDataSet buffer = new BufferedMLDataSet(binFile);
    buffer.beginLoad(input.length, ideal.length);
    while (csv.next()) {
      BasicMLData inputData = new BasicMLData(input.length);
      BasicMLData idealData = new BasicMLData(ideal.length);

      // handle input data
      for (int i = 0; i < input.length; i++) {
        inputData.setData(i, csv.getDouble(input[i]));
      }

      // handle input data
      for (int i = 0; i < ideal.length; i++) {
        idealData.setData(i, csv.getDouble(ideal[i]));
      }

      // add to dataset

      buffer.add(inputData, idealData);
    }
    buffer.endLoad();
  }
コード例 #3
0
  /**
   * Convert a CSV file to a binary training file.
   *
   * @param csvFile The binary file.
   * @param binFile The binary file.
   * @param inputCount The number of input values.
   * @param outputCount The number of output values.
   * @param headers True, if there are headers on the CSV.
   */
  public static void convertCSV2Binary(
      String csvFile, String binFile, int inputCount, int outputCount, boolean headers) {

    (new File(binFile)).delete();
    CSVNeuralDataSet csv =
        new CSVNeuralDataSet(csvFile.toString(), inputCount, outputCount, headers);
    BufferedMLDataSet buffer = new BufferedMLDataSet(new File(binFile));
    buffer.beginLoad(inputCount, outputCount);
    for (MLDataPair pair : csv) {
      buffer.add(pair);
    }
    buffer.endLoad();
  }
コード例 #4
0
 /**
  * Convert a CSV file to a binary training file.
  *
  * @param csvFile The CSV file.
  * @param binFile The binary file.
  * @param inputCount The number of input values.
  * @param outputCount The number of output values.
  * @param headers True, if there are headers on the3 CSV.
  */
 public static void convertCSV2Binary(
     final File csvFile,
     final File binFile,
     final int inputCount,
     final int outputCount,
     final boolean headers) {
   binFile.delete();
   final CSVNeuralDataSet csv =
       new CSVNeuralDataSet(csvFile.toString(), inputCount, outputCount, false);
   final BufferedMLDataSet buffer = new BufferedMLDataSet(binFile);
   buffer.beginLoad(inputCount, outputCount);
   for (final MLDataPair pair : csv) {
     buffer.add(pair);
   }
   buffer.endLoad();
 }
コード例 #5
0
 public BufferedDataSetTableModel(final BufferedMLDataSet data) {
   this.data = data;
   this.egb = data.getEGB();
 }
コード例 #6
0
 /**
  * Save a training set to an EGB file.
  *
  * @param f
  * @param data
  */
 public static void saveEGB(File f, MLDataSet data) {
   BufferedMLDataSet binary = new BufferedMLDataSet(f);
   binary.load(data);
   data.close();
 }
コード例 #7
0
 public static MLDataSet loadEGB2Memory(File filename) {
   BufferedMLDataSet buffer = new BufferedMLDataSet(filename);
   return buffer.loadToMemory();
 }