"Process Run problem with Input and with Performance"

lenoleno Member Posts: 13 Contributor II
edited May 2019 in Help
Hi i have build a process that read two model that i have prebuilded and apply this to an input set.
This process is run at every loop of a while cycle.
The performance are very poor and then i think of eliminate the read of the two model at every loop and i want to pass they with the input port.
What can i give to the process three input?


Every idea for have more  performance?

Thank you
Tagged:

Answers

  • radoneradone RapidMiner Certified Expert, Member Posts: 74 Guru
    Are models read in every loop?
    I believe Store and Retrieve operators migh help you with  computational time demands.
  • lenoleno Member Posts: 13 Contributor II
    I think the problem is that i use the process class indeed using only an Operator everyone can help me?
    I want only know how :
    load a model (out of a loop)
    apply same model (at every loop)

    Thank you very  much
  • lenoleno Member Posts: 13 Contributor II
    Ps i don't find it is possible store a model.
  • Marco_BoeckMarco_Boeck Administrator, Moderator, Employee, Member, University Professor Posts: 1,993 RM Engineering
    Hi,

    I must admit that I'm not quite sure what you want, however I suggest what I already suggested in the last dozen of threads or so about that topic in this forum:
    Build your processes in RapidMiner so you can execute them from RapidMiner without any errors, then you can execute easily via java. Trying to create a process directly via java code requires extensive knowledge of the RapidMiner API and is a bit tedious. But if you're using the method I suggested above, it will work with very little effort :)

    Regards,
    Marco
  • lenoleno Member Posts: 13 Contributor II
    Ok Marco i respect you my problem is that i don't want load model at every loop because the execution time is critical for my application.
    Do you know how do?

    Thank you
  • radoneradone RapidMiner Certified Expert, Member Posts: 74 Guru
    The Marco's advice would definitely solve your problem in the most effective way.

    Another way would be to create your own iterating operator, and add model input to the operator.

    Best,
    radone
  • Marco_BoeckMarco_Boeck Administrator, Moderator, Employee, Member, University Professor Posts: 1,993 RM Engineering
    Hi,

    if performance is key I suggest to create a simple process that does nothing than read a model and deliver it to an output port:

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.0">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="5.0.10" expanded="true" name="Process">
        <process expanded="true" height="206" width="346">
          <operator activated="true" class="read_model" compatibility="5.0.10" expanded="true" height="60" name="Read Model" width="90" x="45" y="30"/>
          <connect from_op="Read Model" from_port="output" to_port="result 1"/>
          <portSpacing port="source_input 1" spacing="0"/>
          <portSpacing port="sink_result 1" spacing="0"/>
          <portSpacing port="sink_result 2" spacing="0"/>
        </process>
      </operator>
    </process>
    You can then run this process, and collect the resulting ioobject:

    RapidMiner.setExecutionMode(ExecutionMode.COMMAND_LINE);
    RapidMiner.init();
    InputStream is;
    // setup your input stream to your process file here
    String xml = com.rapidminer.tools.Tools.readTextFile(is);
    Process modelLoaderProcess = new Process(xml);
    IOContainer ioResult = modelLoaderProcess .run();
    if (ioResult.getElementAt(0) instanceof AbstractModel) {
    AbstractModel model = (AbstractModel)ioResult.getElementAt(0);
    }
    Then have your other processes use a model delivered via input port, so you can start you processes with the previously loaded model:

    IOContainer ioInput = new IOContainer(new IOObject[]{ model });
    Process otherProcess = new Process(otherXML);
    IOContainer ioResult = otherProcess.run(ioInput);
    That way, you will load your model once and then use it for all your other processes.

    Regards,
    Marco
Sign In or Register to comment.