Hello,
we are using RapidMiner in our Java-project (
https://github.com/igorvatolkin/AMUSE). We are currently using version 5.3 and are trying to update to the latest version (9.7).
At one point in the project we load a previously trained ".mod"-model-file in order to classify new data with it. In order to do that we use the class "com.rapidminer.operator.io.ModelLoader". When I downloaded the new Rapidminer version I noticed that this class no longer exists. Is there a way to do the same thing using another class with Rapidminer 9.7? Unfortunately I was no able to find anything about this problem and I am hoping that you can help me.
Our code looks like this (I excluded the parts that don't have anything to do with the problem and are specific to our project):
import com.rapidminer.Process;
import com.rapidminer.example.ExampleSet;
import com.rapidminer.operator.IOContainer;
import com.rapidminer.operator.ModelApplier;
import com.rapidminer.operator.Operator;
import com.rapidminer.operator.io.ModelLoader;
import com.rapidminer.operator.ports.InputPort;
import com.rapidminer.operator.ports.OutputPort;
import com.rapidminer.tools.OperatorService;
.
.
.
Process process = new Process();
// (1) Create ExampleSet
.
. //code that creates the ExampleSet exampleSet that should be classified
.
// (2) Load the model
Operator modelLoader = OperatorService.createOperator(ModelLoader.class);
modelLoader.setParameter(ModelLoader.PARAMETER_MODEL_FILE, pathToModelFile);
process.getRootOperator().getSubprocess(0).addOperator(modelLoader);
// (3) Apply the model
Operator modelApplier = OperatorService.createOperator(ModelApplier.class);
process.getRootOperator().getSubprocess(0).addOperator(modelApplier);
// (4) Connect the ports
InputPort modelApplierModelInputPort = modelApplier.getInputPorts().getPortByName("model");
InputPort modelApplierUnlabelledDataInputPort = modelApplier.getInputPorts().getPortByName("unlabelled data");
OutputPort modelLoaderOutputPort = modelLoader.getOutputPorts().getPortByName("output");
OutputPort processOutputPort = process.getRootOperator().getSubprocess(0).getInnerSources().getPortByIndex(0);
modelLoaderOutputPort.connectTo(modelApplierModelInputPort);
processOutputPort.connectTo(modelApplierUnlabelledDataInputPort);
// (5) Run the process
process.run(new IOContainer(exampleSet));
Thank you very much for your help.
Philipp