Setting correct data type for output port of Operator

RMUser2806
RMUser2806 New Altair Community Member
edited November 5 in Community Q&A
Hello everyone,
I recently encountered a problem while I was trying to define the correct data type for the output ports of my curstom operator in my extension.
It seems to be not possible to define a data type at all. No matter which data type I define, this port's data type is in RapidMiner always displayed as an IOObject. I was trying the same for the input ports of this operator and it works perfectly...
Can somebody help me to set the correct data type for the output port of an operator? How can I do it within the Java class of my operator?

Thanks in advance.

Answers

  • MartinLiebig
    MartinLiebig
    Altair Employee
    Hi,
    i think this is taken from the meta data transformtion, which is defined in the constructor. here is for example my LDAOperator constructor:

    public LDA(OperatorDescription description) {
    super(description); getTransformer().addRule(new GenerateNewExampleSetMDRule(exaOutput) {

    @Override
    public void transformMD() {
    try {
    exaOutput.deliverMD(LDAModel.createExampleSetMetaData(getParameterAsInt(PARAMETER_NUMTOPICS)));
    } catch (UndefinedParameterError undefinedParameterError) {
    exaOutput.deliverMD(LDAModel.createExampleSetMetaData(1));
    }
    }
    });

    getTransformer().addRule(new GenerateNewExampleSetMDRule(topicOutput) {

    @Override
    public void transformMD() {
    ExampleSetMetaData md = new ExampleSetMetaData();
    md.addAttribute(new AttributeMetaData("topicId", Ontology.INTEGER));
    md.addAttribute(new AttributeMetaData("word", Ontology.NOMINAL));
    md.addAttribute(new AttributeMetaData("weight", Ontology.REAL));
    topicOutput.deliverMD(md);
    }
    });

    getTransformer().addRule(new GenerateNewMDRule(performanceOutput, new MetaData(PerformanceVector.class)));
    }

    there is plenty of examples in the OS studio code.

    BR,
    Martin