The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here

Decision tree classification without process in JAVA

justinkrausejustinkrause Member Posts: 3 Contributor I
edited June 2019 in Help

Hi,

 

I have trained my decision tree in RM and now want to load it in my Java application. Once loaded I want to be able to classificate an example (as long as my application is alive). But I do not want to use a process because this would need to reload the model every time. That would not be efficient.

For example:

 

private String classificate(double[] attributes){

//Create a classification given these attributes

return classification;

}

 

 

Right now I have something like this:

 

RapidMiner.setExecutionMode(ExecutionMode.COMMAND_LINE);
RapidMiner.init();

 

Operator modelReader = OperatorService.createOperator(ModelLoader.class);
modelReader.setParameter("model_file", "C:/Users/birdman/Desktop/TreeModel.mod");

Operator modelApplier = OperatorService.createOperator(ModelApplier.class);
InputPort inApply = modelApplier.getInputPorts().getAllPorts().get(0);
modelReader.getOutputPorts().getAllPorts().get(0).connectTo(inApply);

modelReader.execute();

modelApplier.execute();

 

Now I need an operator which has an output linking to the modelApplier's input to generate a classification.

 

How do I do this? Is this even the right way to realize this?

Thanks in advance,

BM

 

Sign In or Register to comment.