Options

How make Hybrid Model in Rapid-miner ?

MunchCrunch19MunchCrunch19 Member Posts: 23 Contributor I
Suppose I want to Combine or make a hybrid model of KNN and Decision Tree model together, Could anyone tell me how to do this?

Regards

Answers

  • Options
    BalazsBaranyBalazsBarany Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert Posts: 955 Unicorn
    Hi,

    you can use one of the ensemble model algorithms, available in Modeling/Predictive/Ensembles.
    Some algorithms use the same model type, some allow you to define different algorithms, by putting them into the operator.

    You could experiment with Vote and Stacking, these do what you describe.

    Regards,

    Balázs
  • Options
    MunchCrunch19MunchCrunch19 Member Posts: 23 Contributor I
    Could you show the process photo of the SVM and Neural Net Hybrid model?
  • Options
    lionelderkrikorlionelderkrikor Moderator, RapidMiner Certified Analyst, Member Posts: 1,195 Unicorn
    Hi @MunchCrunch19,

    You can find here a process which implements a Vote operator with both SVM and Neural Net models : 

    <?xml version="1.0" encoding="UTF-8"?><process version="9.5.000">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="9.4.000" expanded="true" name="Process" origin="GENERATED_TUTORIAL">
        <parameter key="logverbosity" value="init"/>
        <parameter key="random_seed" value="2001"/>
        <parameter key="send_mail" value="never"/>
        <parameter key="notification_email" value=""/>
        <parameter key="process_duration_for_mail" value="30"/>
        <parameter key="encoding" value="SYSTEM"/>
        <process expanded="true">
          <operator activated="true" class="retrieve" compatibility="9.5.000" expanded="true" height="68" name="Sonar" origin="GENERATED_TUTORIAL" width="90" x="45" y="34">
            <parameter key="repository_entry" value="//Samples/data/Sonar"/>
          </operator>
          <operator activated="true" class="split_validation" compatibility="9.5.000" expanded="true" height="124" name="Validation" origin="GENERATED_TUTORIAL" width="90" x="246" y="34">
            <parameter key="create_complete_model" value="false"/>
            <parameter key="split" value="relative"/>
            <parameter key="split_ratio" value="0.7"/>
            <parameter key="training_set_size" value="100"/>
            <parameter key="test_set_size" value="-1"/>
            <parameter key="sampling_type" value="automatic"/>
            <parameter key="use_local_random_seed" value="false"/>
            <parameter key="local_random_seed" value="1992"/>
            <process expanded="true">
              <operator activated="true" class="vote" compatibility="9.5.000" expanded="true" height="68" name="Vote" origin="GENERATED_TUTORIAL" width="90" x="112" y="34">
                <process expanded="true">
                  <operator activated="true" class="neural_net" compatibility="9.5.000" expanded="true" height="82" name="Neural Net" origin="GENERATED_TUTORIAL" width="90" x="313" y="187">
                    <list key="hidden_layers"/>
                    <parameter key="training_cycles" value="500"/>
                    <parameter key="learning_rate" value="0.3"/>
                    <parameter key="momentum" value="0.2"/>
                    <parameter key="decay" value="false"/>
                    <parameter key="shuffle" value="true"/>
                    <parameter key="normalize" value="true"/>
                    <parameter key="error_epsilon" value="1.0E-5"/>
                    <parameter key="use_local_random_seed" value="false"/>
                    <parameter key="local_random_seed" value="1992"/>
                  </operator>
                  <operator activated="true" class="support_vector_machine" compatibility="9.5.000" expanded="true" height="124" name="SVM" origin="GENERATED_TUTORIAL" width="90" x="313" y="289">
                    <parameter key="kernel_type" value="dot"/>
                    <parameter key="kernel_gamma" value="1.0"/>
                    <parameter key="kernel_sigma1" value="1.0"/>
                    <parameter key="kernel_sigma2" value="0.0"/>
                    <parameter key="kernel_sigma3" value="2.0"/>
                    <parameter key="kernel_shift" value="1.0"/>
                    <parameter key="kernel_degree" value="2.0"/>
                    <parameter key="kernel_a" value="1.0"/>
                    <parameter key="kernel_b" value="0.0"/>
                    <parameter key="kernel_cache" value="200"/>
                    <parameter key="C" value="0.0"/>
                    <parameter key="convergence_epsilon" value="0.001"/>
                    <parameter key="max_iterations" value="100000"/>
                    <parameter key="scale" value="true"/>
                    <parameter key="calculate_weights" value="true"/>
                    <parameter key="return_optimization_performance" value="true"/>
                    <parameter key="L_pos" value="1.0"/>
                    <parameter key="L_neg" value="1.0"/>
                    <parameter key="epsilon" value="0.0"/>
                    <parameter key="epsilon_plus" value="0.0"/>
                    <parameter key="epsilon_minus" value="0.0"/>
                    <parameter key="balance_cost" value="false"/>
                    <parameter key="quadratic_loss_pos" value="false"/>
                    <parameter key="quadratic_loss_neg" value="false"/>
                    <parameter key="estimate_performance" value="false"/>
                  </operator>
                  <connect from_port="training set 1" to_op="Neural Net" to_port="training set"/>
                  <connect from_port="training set 2" to_op="SVM" to_port="training set"/>
                  <connect from_op="Neural Net" from_port="model" to_port="base model 1"/>
                  <connect from_op="SVM" from_port="model" to_port="base model 2"/>
                  <portSpacing port="source_training set 1" spacing="72"/>
                  <portSpacing port="source_training set 2" spacing="72"/>
                  <portSpacing port="source_training set 3" spacing="0"/>
                  <portSpacing port="sink_base model 1" spacing="72"/>
                  <portSpacing port="sink_base model 2" spacing="72"/>
                  <portSpacing port="sink_base model 3" spacing="0"/>
                </process>
              </operator>
              <connect from_port="training" to_op="Vote" to_port="training set"/>
              <connect from_op="Vote" from_port="model" to_port="model"/>
              <portSpacing port="source_training" spacing="0"/>
              <portSpacing port="sink_model" spacing="0"/>
              <portSpacing port="sink_through 1" spacing="0"/>
            </process>
            <process expanded="true">
              <operator activated="true" class="apply_model" compatibility="9.5.000" expanded="true" height="82" name="Apply Model" origin="GENERATED_TUTORIAL" width="90" x="45" y="34">
                <list key="application_parameters"/>
                <parameter key="create_view" value="false"/>
              </operator>
              <operator activated="true" class="performance" compatibility="9.5.000" expanded="true" height="82" name="Performance" origin="GENERATED_TUTORIAL" width="90" x="179" y="34">
                <parameter key="use_example_weights" value="true"/>
              </operator>
              <connect from_port="model" to_op="Apply Model" to_port="model"/>
              <connect from_port="test set" to_op="Apply Model" to_port="unlabelled data"/>
              <connect from_op="Apply Model" from_port="labelled data" to_op="Performance" to_port="labelled data"/>
              <connect from_op="Performance" from_port="performance" to_port="averagable 1"/>
              <portSpacing port="source_model" spacing="0"/>
              <portSpacing port="source_test set" spacing="0"/>
              <portSpacing port="source_through 1" spacing="0"/>
              <portSpacing port="sink_averagable 1" spacing="0"/>
              <portSpacing port="sink_averagable 2" spacing="0"/>
            </process>
          </operator>
          <connect from_op="Sonar" from_port="output" to_op="Validation" to_port="training"/>
          <connect from_op="Validation" from_port="model" to_port="result 1"/>
          <connect from_op="Validation" from_port="averagable 1" to_port="result 2"/>
          <portSpacing port="source_input 1" spacing="0"/>
          <portSpacing port="sink_result 1" spacing="0"/>
          <portSpacing port="sink_result 2" spacing="42"/>
          <portSpacing port="sink_result 3" spacing="66"/>
        </process>
      </operator>
    </process>
    

    Regards,

    Lionel

  • Options
    MunchCrunch19MunchCrunch19 Member Posts: 23 Contributor I
    lionelderkrikor  Sorry, should i copy the above code and paste it in Rapidminer? I am Beginner don't know about the process you shared.

    Regards ,
  • Options
    varunm1varunm1 Moderator, Member Posts: 1,207 Unicorn
    Sorry, should i copy the above code and paste it in Rapidminer?
    Open new process in RapidMiner, copy the above code and paste it in XML Window and click the green tick mark on XML window. If you don't find XML window, goto View --> Show Panel -- XML.

    Regards,
    Varun
    https://www.varunmandalapu.com/

    Be Safe. Follow precautions and Maintain Social Distancing

Sign In or Register to comment.