Options

SVM

c1borgc1borg Member Posts: 17 Maven
edited November 2018 in Help
I have a Support Vector Machine process and have 2 questions. I have a nominal label 1,-1 which I am trying to predict with a horizon of 1. I am sure data pre processing is vital to obtain the best results, and have therefore added a Normalize operator in the process to transform the inputs into the 1,-1 range.

Is this the best way to prepare the inputs?

I would like to show the hyperplane graphically with the suport vectors and data seperation, am I able to do this?

The process is attached

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.0">
  <context>
    <input/>
    <output/>
    <macros/>
  </context>
  <operator activated="true" class="process" expanded="true" name="Process">
    <process expanded="true" height="449" width="1016">
      <operator activated="true" class="read_excel" expanded="true" height="60" name="Training Data" width="90" x="45" y="30">
        <parameter key="excel_file" value="C:\Documents and Settings\User\My Documents\My Dropbox\Public\Reference Data.xls"/>
        <list key="annotations"/>
      </operator>
      <operator activated="true" class="normalize" expanded="true" height="94" name="Normalize" width="90" x="45" y="120">
        <parameter key="method" value="range transformation"/>
        <parameter key="min" value="-1.0"/>
      </operator>
      <operator activated="true" class="set_role" expanded="true" height="76" name="Date" width="90" x="179" y="30">
        <parameter key="name" value="Date"/>
        <parameter key="target_role" value="id"/>
      </operator>
      <operator activated="true" class="set_role" expanded="true" height="76" name="Label" width="90" x="313" y="30">
        <parameter key="name" value="Label"/>
        <parameter key="target_role" value="label"/>
      </operator>
      <operator activated="true" class="read_model" expanded="true" height="60" name="Read Model" width="90" x="581" y="165">
        <parameter key="model_file" value="C:\Projects\RM5\Forex\v4\data\model.mod"/>
      </operator>
      <operator activated="true" class="read_excel" expanded="true" height="60" name="Test Data" width="90" x="45" y="255">
        <parameter key="excel_file" value="C:\Documents and Settings\User\My Documents\My Dropbox\Public\Reference Data.xls"/>
        <parameter key="sheet_number" value="2"/>
        <list key="annotations"/>
      </operator>
      <operator activated="true" class="normalize" expanded="true" height="94" name="Normalize (2)" width="90" x="45" y="345">
        <parameter key="method" value="range transformation"/>
        <parameter key="min" value="-1.0"/>
      </operator>
      <operator activated="true" class="set_role" expanded="true" height="76" name="Date (2)" width="90" x="179" y="255">
        <parameter key="name" value="Date"/>
        <parameter key="target_role" value="id"/>
      </operator>
      <operator activated="true" class="optimize_weights_evolutionary" expanded="true" height="94" name="Optimize Weights (Evolutionary)" width="90" x="447" y="30">
        <parameter key="use_early_stopping" value="true"/>
        <parameter key="selection_scheme" value="roulette wheel"/>
        <process expanded="true" height="388" width="501">
          <operator activated="true" class="series:sliding_window_validation" expanded="true" height="112" name="Validation" width="90" x="179" y="30">
            <parameter key="training_window_width" value="10"/>
            <parameter key="training_window_step_size" value="1"/>
            <parameter key="test_window_width" value="10"/>
            <parameter key="cumulative_training" value="true"/>
            <process expanded="true" height="406" width="234">
              <operator activated="true" class="classification_by_regression" expanded="true" height="76" name="Classification by Regression" width="90" x="72" y="30">
                <process expanded="true" height="406" width="519">
                  <operator activated="true" class="support_vector_machine" expanded="true" height="112" name="SVM" width="90" x="214" y="30"/>
                  <connect from_port="training set" to_op="SVM" to_port="training set"/>
                  <connect from_op="SVM" from_port="model" to_port="model"/>
                  <portSpacing port="source_training set" spacing="0"/>
                  <portSpacing port="sink_model" spacing="0"/>
                </process>
              </operator>
              <connect from_port="training" to_op="Classification by Regression" to_port="training set"/>
              <connect from_op="Classification by Regression" 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" height="406" width="234">
              <operator activated="true" class="apply_model" expanded="true" height="76" name="Apply Model" width="90" x="45" y="30">
                <list key="application_parameters"/>
              </operator>
              <operator activated="true" class="performance" expanded="true" height="76" name="Performance (3)" width="90" x="179" y="30"/>
              <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 (3)" to_port="labelled data"/>
              <connect from_op="Performance (3)" 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>
          <operator activated="true" class="write_model" expanded="true" height="60" name="Write Model" width="90" x="313" y="30">
            <parameter key="model_file" value="C:\Projects\RM5\Forex\v4\data\model.mod"/>
          </operator>
          <connect from_port="example set" to_op="Validation" to_port="training"/>
          <connect from_op="Validation" from_port="model" to_op="Write Model" to_port="input"/>
          <connect from_op="Validation" from_port="averagable 1" to_port="performance"/>
          <portSpacing port="source_example set" spacing="0"/>
          <portSpacing port="source_through 1" spacing="0"/>
          <portSpacing port="sink_performance" spacing="0"/>
        </process>
      </operator>
      <operator activated="true" class="set_role" expanded="true" height="76" name="Label (2)" width="90" x="313" y="255">
        <parameter key="name" value="Label"/>
        <parameter key="target_role" value="label"/>
      </operator>
      <operator activated="true" class="set_role" expanded="true" height="76" name="Prediction" width="90" x="447" y="255">
        <parameter key="name" value="Prediction"/>
        <parameter key="target_role" value="prediction"/>
      </operator>
      <operator activated="true" class="select_by_weights" expanded="true" height="94" name="Select by Weights" width="90" x="581" y="255">
        <parameter key="weight_relation" value="top p%"/>
        <parameter key="weight" value="0.9"/>
      </operator>
      <operator activated="true" class="apply_model" expanded="true" height="76" name="Apply Model (2)" width="90" x="715" y="255">
        <list key="application_parameters"/>
      </operator>
      <operator activated="true" class="performance" expanded="true" height="76" name="Performance (2)" width="90" x="849" y="255"/>
      <connect from_op="Training Data" from_port="output" to_op="Normalize" to_port="example set input"/>
      <connect from_op="Normalize" from_port="example set output" to_op="Date" to_port="example set input"/>
      <connect from_op="Date" from_port="example set output" to_op="Label" to_port="example set input"/>
      <connect from_op="Label" from_port="example set output" to_op="Optimize Weights (Evolutionary)" to_port="example set in"/>
      <connect from_op="Read Model" from_port="output" to_op="Apply Model (2)" to_port="model"/>
      <connect from_op="Test Data" from_port="output" to_op="Normalize (2)" to_port="example set input"/>
      <connect from_op="Normalize (2)" from_port="example set output" to_op="Date (2)" to_port="example set input"/>
      <connect from_op="Date (2)" from_port="example set output" to_op="Label (2)" to_port="example set input"/>
      <connect from_op="Optimize Weights (Evolutionary)" from_port="example set out" to_port="result 1"/>
      <connect from_op="Optimize Weights (Evolutionary)" from_port="weights" to_op="Select by Weights" to_port="weights"/>
      <connect from_op="Label (2)" from_port="example set output" to_op="Prediction" to_port="example set input"/>
      <connect from_op="Prediction" from_port="example set output" to_op="Select by Weights" to_port="example set input"/>
      <connect from_op="Select by Weights" from_port="example set output" to_op="Apply Model (2)" to_port="unlabelled data"/>
      <connect from_op="Apply Model (2)" from_port="labelled data" to_op="Performance (2)" to_port="labelled data"/>
      <connect from_op="Performance (2)" from_port="performance" to_port="result 2"/>
      <connect from_op="Performance (2)" from_port="example set" to_port="result 3"/>
      <portSpacing port="source_input 1" spacing="0"/>
      <portSpacing port="sink_result 1" spacing="0"/>
      <portSpacing port="sink_result 2" spacing="0"/>
      <portSpacing port="sink_result 3" spacing="0"/>
      <portSpacing port="sink_result 4" spacing="0"/>
    </process>
  </operator>
</process>

Thanks
C1borg

Answers

  • Options
    TobiasMalbrechtTobiasMalbrecht Moderator, Employee, Member Posts: 295 RM Product Management
    Hi,

    I think you would not need a normalization to scale the inputs, as the SVM does this itself internally. A graphical display of the hyperplane is not possible out-of-the-box, as far as I know. If your data is more than two dimensions this would be tedious, though.

    Best regards,
    Tobias

Sign In or Register to comment.