Due to recent updates, all users are required to create an Altair One account to login to the RapidMiner community. Click the Register button to create your account using the same email that you have previously used to login to the RapidMiner community. This will ensure that any previously created content will be synced to your Altair One account. Once you login, you will be asked to provide a username that identifies you to other Community users. Email us at Community with questions.

Branching on Prediction

cliftonarmscliftonarms Member Posts: 32 Contributor II
edited November 2018 in Help
I cannot seem to solve this design problem with the standard set of Rapidminer Processes and wonder if there is anyone more creative out there  ;)

The problem : I have a single binominal classification prediction example that I pass through Apply Model. I now need Rapidminer to select an external script depending on the prediction. I have tried the branch operator on the results from apply model then the external program process , but no success.

Anyone have any ideas - as I am a bit stuck.




Answers

  • Nils_WoehlerNils_Woehler Member Posts: 463 Maven
    Hi,

    you can use the branch operator for this purpose:

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.3.006">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="5.3.006" expanded="true" name="Process">
        <process expanded="true">
          <operator activated="true" class="retrieve" compatibility="5.3.006" expanded="true" height="60" name="Retrieve Golf" width="90" x="112" y="120">
            <parameter key="repository_entry" value="//Samples/data/Golf"/>
          </operator>
          <operator activated="true" class="naive_bayes" compatibility="5.3.006" expanded="true" height="76" name="Naive Bayes" width="90" x="246" y="120"/>
          <operator activated="true" class="sample_stratified" compatibility="5.3.006" expanded="true" height="76" name="Sample (Stratified)" width="90" x="313" y="255">
            <parameter key="sample_size" value="1"/>
          </operator>
          <operator activated="true" class="apply_model" compatibility="5.3.006" expanded="true" height="76" name="Apply Model" width="90" x="514" y="210">
            <list key="application_parameters"/>
          </operator>
          <operator activated="true" class="branch" compatibility="5.3.006" expanded="true" height="76" name="Branch" width="90" x="715" y="210">
            <parameter key="condition_type" value="attribute_value_filter"/>
            <parameter key="condition_value" value="prediction(Play)=yes"/>
            <process expanded="true">
              <operator activated="true" class="print_to_console" compatibility="5.3.006" expanded="true" height="76" name="Print to Console" width="90" x="179" y="30">
                <parameter key="log_value" value="Yes!"/>
              </operator>
              <connect from_port="condition" to_op="Print to Console" to_port="through 1"/>
              <connect from_op="Print to Console" from_port="through 1" to_port="input 1"/>
              <portSpacing port="source_condition" spacing="0"/>
              <portSpacing port="source_input 1" spacing="0"/>
              <portSpacing port="sink_input 1" spacing="0"/>
              <portSpacing port="sink_input 2" spacing="0"/>
            </process>
            <process expanded="true">
              <operator activated="true" class="print_to_console" compatibility="5.3.006" expanded="true" height="76" name="Print to Console (2)" width="90" x="179" y="30">
                <parameter key="log_value" value="No!"/>
              </operator>
              <connect from_port="condition" to_op="Print to Console (2)" to_port="through 1"/>
              <connect from_op="Print to Console (2)" from_port="through 1" to_port="input 1"/>
              <portSpacing port="source_condition" spacing="0"/>
              <portSpacing port="source_input 1" spacing="0"/>
              <portSpacing port="sink_input 1" spacing="0"/>
              <portSpacing port="sink_input 2" spacing="0"/>
            </process>
          </operator>
          <connect from_op="Retrieve Golf" from_port="output" to_op="Naive Bayes" to_port="training set"/>
          <connect from_op="Naive Bayes" from_port="model" to_op="Apply Model" to_port="model"/>
          <connect from_op="Naive Bayes" from_port="exampleSet" to_op="Sample (Stratified)" to_port="example set input"/>
          <connect from_op="Sample (Stratified)" from_port="example set output" to_op="Apply Model" to_port="unlabelled data"/>
          <connect from_op="Apply Model" from_port="labelled data" to_op="Branch" to_port="condition"/>
          <connect from_op="Branch" from_port="input 1" 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>
    Best,
    Nils
  • cliftonarmscliftonarms Member Posts: 32 Contributor II
    100% perfect - thank you

    I like Rapidminer more and more each day...Thanks team.
Sign In or Register to comment.