🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

Decision tree classification without process in JAVA

User: "justinkrause"
New Altair Community Member
Updated by Jocelyn

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

 

Find more posts tagged with

Comments

No comments on this post.