コード例 #1
0
  @Override
  public MetaData getGeneratedMetaData() throws OperatorException {
    ExampleSetMetaData emd = new ExampleSetMetaData();
    AttributeMetaData amd = new AttributeMetaData("label", Ontology.NOMINAL, Attributes.LABEL_NAME);
    emd.addAttribute(amd);
    int desirendNumberOfAttributes = getParameterAsInt(PARAMETER_NUMBER_ATTRIBUTES);
    double mean = getParameterAsDouble(PARAMETER_SPARSE_FRACTION);
    if (desirendNumberOfAttributes > 20) {
      emd.attributesAreSuperset();
      // first ten
      for (int i = 1; i < 11; i++) {
        AttributeMetaData newAMD = new AttributeMetaData("att" + i, Ontology.REAL);
        newAMD.setValueRange(new Range(0, 1), SetRelation.EQUAL);
        newAMD.setMean(new MDReal(mean));
        emd.addAttribute(newAMD);
      }
      // last ten
      for (int i = desirendNumberOfAttributes - 10; i <= desirendNumberOfAttributes; i++) {
        AttributeMetaData newAMD = new AttributeMetaData("att" + i, Ontology.REAL);
        newAMD.setValueRange(new Range(0, 1), SetRelation.EQUAL);
        newAMD.setMean(new MDReal(mean));
        emd.addAttribute(newAMD);
      }

    } else {
      for (int i = 0; i < desirendNumberOfAttributes; i++) {
        AttributeMetaData newAMD = new AttributeMetaData("att" + (i + 1), Ontology.REAL);
        newAMD.setValueRange(new Range(0, 1), SetRelation.EQUAL);
        newAMD.setMean(new MDReal(mean));
        emd.addAttribute(newAMD);
      }
    }
    return emd;
  }
コード例 #2
0
  public ProcessLog2ExampleSet(OperatorDescription description) {
    super(description);
    ExampleSetMetaData newEMD = new ExampleSetMetaData();
    newEMD.attributesAreSuperset();
    newEMD.setNumberOfExamples(0);
    newEMD.getNumberOfExamples().increaseByUnknownAmount();
    getTransformer().addRule(new GenerateNewMDRule(exampleSetOutput, newEMD));

    dummyPorts.start();

    getTransformer().addRule(dummyPorts.makePassThroughRule());
  }