The Altair Community is migrating to a new platform to provide a better experience for you. The RapidMiner Community will merge with the Altair Community at the same time. In preparation for the migration, both communities are on read-only mode from July 15th - July 24th, 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.
Options

"Connecting ports between CSV Data Reader and Apply Model operators in Java"

leonardormachadleonardormachad Member Posts: 3 Contributor I
edited May 2019 in Help
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
Tagged:

Answers

  • Options
    leonardormachadleonardormachad Member Posts: 3 Contributor I
    Solved.

    Both output ports were being created from the same operator (leitorCSV).
Sign In or Register to comment.