"how to write my JAVA application by learning the XML from RM"

User: "gfyang"
New Altair Community Member
Updated by Jocelyn
Hi, I am beginning to integrate RM into my own application.
First of all,  I want to implement the following by  java codes,

<operator name="Root" class="Process" expanded="yes">
    <operator name="ArffExampleSource" class="ArffExampleSource">
        <parameter key="data_file" value="../data/iris.arff"/>
        <parameter key="label_attribute" value="class"/>
    </operator>
    <operator name="SimpleValidation" class="SimpleValidation" expanded="yes">
        <operator name="NaiveBayes" class="NaiveBayes">
        </operator>
        <operator name="ApplierChain" class="OperatorChain" expanded="yes">
            <operator name="Test" class="ModelApplier">
                <list key="application_parameters">
                </list>
            </operator>
            <operator name="Performance" class="Performance">
            </operator>
        </operator>
    </operator>
</operator>
This is what I know:

RapidMiner.init();

//read the data
Operator inputData = OperatorService.createOperator(ArffExampleSource.class);
inputData.setParameter("data_file", "C:/data/iris.arff");
inputData.setParameter("label_attribute", "class");
IOContainer container = inputData.apply(new IOContainer());

//build the model
OperatorChain simpleValidate =
(OperatorChain) OperatorService.createOperator("SimpleValidation");
OperatorChain applierChain =
(OperatorChain) OperatorService.createOperator("ApplierChain");

Operator naiveBayes = OperatorService.createOperator("NaiveBayes");
Operator test = OperatorService.createOperator("ModelApplier");
Operator performance = OperatorService.createOperator("Performance");

applierChain.addOperator(test);
applierChain.addOperator(performance);
simpleValidate.addOperator(naiveBayes);
simpleValidate.addOperator(applierChain);
Of course, it does not work. How could I really make the application run? That is, inputting data, validating naive bayes, and then outputting the accuracy?

Thank you very much.

Find more posts tagged with