コード例 #1
0
  public static void main(String[] args) throws IOException {
    RegressionInputs inputs = Conversion.toRegressionInputs(getInputs());
    Parameters params = getParams();

    RegressionSVM svm = LazySVM.loadOrTrainRegression("generated", params, inputs);

    System.out.println("Maybe reused a trained svm!");
    openChart(getRegressionChart(svm, inputs));
  }
コード例 #2
0
ファイル: LibSvmIO.java プロジェクト: kf200660306/svm3d
  /** *************************************************** */
  public static RegressionInputs loadRegressionCsv(String filename) throws IOException {
    CSVReader reader = new CSVReader(new FileReader(filename));
    String[] nextLine;

    Vector<svm_node[]> x = new Vector<svm_node[]>();
    Vector<Double> y = new Vector<Double>();
    while ((nextLine = reader.readNext()) != null) {
      int m = nextLine.length;

      svm_node[] xk = new svm_node[m - 1];
      for (int i = 0; i < m - 1; i++)
        xk[i] = Conversion.toVector(i, Double.parseDouble(nextLine[i]));

      x.add(xk);
      y.add(Double.parseDouble(nextLine[m - 1]));
    }
    reader.close();
    return new RegressionInputs(x, y);
  }
コード例 #3
0
 public static Coord3d[] getInputs() {
   return Conversion.toArray(SphereScatterGenerator.generate(new Coord3d(0, 0, 0), 1, 20, true));
 }