Esempio n. 1
0
  /**
   * Generates output file for a clasification problem @ param Foutput Name of the output file @
   * param real Vector of outputs instances @ param obtained Vector of net outputs
   *
   * @return Nothing
   */
  public void generateResultsClasification(String Foutput, int[] real, int[] obtained) {

    // Output file, classification problems
    FileOutputStream out;
    PrintStream p;
    Attribute at = Attributes.getOutputAttribute(0);

    // Check whether the output value is nominal or integer
    boolean isNominal = (at.getType() == at.NOMINAL);
    try {
      out = new FileOutputStream(Foutput);
      p = new PrintStream(out);
      CopyHeaderTest(p);
      // System.out.println("Longitudes "+real.length+" "+obtained.length);
      for (int i = 0; i < real.length; i++) {
        // Write the label associated to the class number,
        // when the output is nominal
        if (isNominal)
          p.print(at.getNominalValue(real[i]) + " " + at.getNominalValue(obtained[i]) + "\n");
        else p.print(real[i] + " " + obtained[i] + "\n");
      }
      p.close();
    } catch (Exception e) {
      System.err.println("Error building file for results: " + Foutput);
    }
  }
Esempio n. 2
0
  /**
   * Generates output file for a modelling problem @ param Foutput Name of the output file @ param
   * real Vector of outputs instances @ param obtained Vector of net outputs
   *
   * @return Nothing
   */
  public void generateResultsModeling(String Foutput, double[] real, double[] obtained) {

    // Output file, modeling problems

    FileOutputStream out;
    PrintStream p;

    try {

      out = new FileOutputStream(Foutput);
      p = new PrintStream(out);
      CopyHeaderTest(p);
      for (int i = 0; i < real.length; i++) {
        p.print(real[i] + " " + obtained[i] + "\n");
      }
      p.close();
    } catch (Exception e) {
      System.err.println("Error building file for results: " + Foutput);
    }
  }