コード例 #1
0
ファイル: Main.java プロジェクト: micyee/granada
  static void checkDataset() {
    Attribute[] outputs = Attributes.getOutputAttributes();

    if (outputs.length != 1) {
      LogManager.printErr("Only datasets with one output are supported");
      System.exit(1);
    }
    if (outputs[0].getType() != Attribute.NOMINAL) {
      LogManager.printErr("Output attribute should be nominal");
      System.exit(1);
    }
    Parameters.numClasses = outputs[0].getNumNominalValues();
    Parameters.numAttributes = Attributes.getInputAttributes().length;
  }
コード例 #2
0
ファイル: InstanceSet.java プロジェクト: Navieclipse/KEEL
  /**
   * It does return a new header (not necessary the same header as the input file one). It only
   * includes the valid attributes, those ones defined in @inputs and @outputs (or taken as that
   * role following the keel format specification).
   *
   * @return a String with the new header
   */
  public String getNewHeader() {
    String line = "";
    Attribute[] attrs = null;

    // Getting the relation name and the attributes
    if (storeAttributesAsNonStatic && attributes != null) {
      line = "@relation " + attributes.getRelationName() + "\n";
      attrs = attributes.getInputAttributes();
    } else {
      line = "@relation " + Attributes.getRelationName() + "\n";
      attrs = Attributes.getInputAttributes();
    }

    for (int i = 0; i < attrs.length; i++) {
      line += attrs[i].toString() + "\n";
    }

    // Gettin all the outputs attributes
    if (storeAttributesAsNonStatic && attributes != null) {
      attrs = attributes.getOutputAttributes();
      line += attrs[0].toString() + "\n";

      // Getting @inputs and @outputs
      line += attributes.getInputHeader() + "\n";
      line += attributes.getOutputHeader() + "\n";
    } else {
      attrs = Attributes.getOutputAttributes();
      line += attrs[0].toString() + "\n";

      // Getting @inputs and @outputs
      line += Attributes.getInputHeader() + "\n";
      line += Attributes.getOutputHeader() + "\n";
    }

    return line;
  } // end getNewHeader