"Connecting ports between CSV Data Reader and Apply Model operators in Java"
leonardormachad
MemberPosts:3Contributor I
Hello.
Using RapidMiner 5 IDE, I'm able to connect the "output" port of a Read CSV operator to the "unlabelled data" input port of an Apply Model Operator, and it works fine.
However, in Java, I'm receiving the follow exception message when trying to connect these ports:
"Exception in thread "AWT-EventQueue-0" com.rapidminer.operator.ports.impl.CannotConnectPortException: Cannot connect Read CSV.output to Apply Model.unlabelled data"
My Java code is the following:
com.rapidminer.Process processo = new com.rapidminer.Process();
leitorCSV = OperatorService.createOperator(CSVDataReader.class);
leitorCSV.setParameter("file_name",nomeArquivoNormalizado);
leitorCSV.setParameter("column_separators",""");
leitorCSV.setParameter("trim_lines","true");
leitorCSV.setParameter("use_first_row_as_attribute_names", "true");
leitorCSV.setParameter("attribute_names_already_defined", "true");
OutputPort portaSaidaLeitorCSV = leitorCSV.getOutputPorts().getPortByName("output");
carregadorModelo = OperatorService.createOperator(ModelLoader.class);
carregadorModelo.setParameter("model_file", this.getCaminhoArquivoClassificador());
OutputPort portaSaidaCarregadorModelo = leitorCSV.getOutputPorts().getPortByName("output");
aplicadorModelo = OperatorService.createOperator(ModelApplier.class);
InputPort portaEntrada1AplicadorModelo = aplicadorModelo.getInputPorts().getPortByName("model");
InputPort portaEntrada2AplicadorModelo = aplicadorModelo.getInputPorts().getPortByName("unlabelled data");
portaSaidaCarregadorModelo.connectTo(portaEntrada1AplicadorModelo);
portaSaidaLeitorCSV.connectTo(portaEntrada2AplicadorModelo);
Last line is throwing the exception...
Could somebody help me, please?
Thanks in advance!
Leonardo
Using RapidMiner 5 IDE, I'm able to connect the "output" port of a Read CSV operator to the "unlabelled data" input port of an Apply Model Operator, and it works fine.
However, in Java, I'm receiving the follow exception message when trying to connect these ports:
"Exception in thread "AWT-EventQueue-0" com.rapidminer.operator.ports.impl.CannotConnectPortException: Cannot connect Read CSV.output to Apply Model.unlabelled data"
My Java code is the following:
com.rapidminer.Process processo = new com.rapidminer.Process();
leitorCSV = OperatorService.createOperator(CSVDataReader.class);
leitorCSV.setParameter("file_name",nomeArquivoNormalizado);
leitorCSV.setParameter("column_separators",""");
leitorCSV.setParameter("trim_lines","true");
leitorCSV.setParameter("use_first_row_as_attribute_names", "true");
leitorCSV.setParameter("attribute_names_already_defined", "true");
OutputPort portaSaidaLeitorCSV = leitorCSV.getOutputPorts().getPortByName("output");
carregadorModelo = OperatorService.createOperator(ModelLoader.class);
carregadorModelo.setParameter("model_file", this.getCaminhoArquivoClassificador());
OutputPort portaSaidaCarregadorModelo = leitorCSV.getOutputPorts().getPortByName("output");
aplicadorModelo = OperatorService.createOperator(ModelApplier.class);
InputPort portaEntrada1AplicadorModelo = aplicadorModelo.getInputPorts().getPortByName("model");
InputPort portaEntrada2AplicadorModelo = aplicadorModelo.getInputPorts().getPortByName("unlabelled data");
portaSaidaCarregadorModelo.connectTo(portaEntrada1AplicadorModelo);
portaSaidaLeitorCSV.connectTo(portaEntrada2AplicadorModelo);
Last line is throwing the exception...
Could somebody help me, please?
Thanks in advance!
Leonardo
0
Answers
Both output ports were being created from the same operator (leitorCSV).