[SOLVED] Series prediction with multiple labels / predictions in one process

qwertzqwertz Member Posts: 130 Contributor II
edited November 2018 in Help

Dear community,

I built a model for series forecasting (according to Thomas Ott's tutorial) which works pretty good.
However, now I'm struggling to forecast more than one value and I was wondering if someone is outthere who can advise...

A few words to my setup: My raw data are multiple stock close prices. The current process (the windowing operator) only allows for setting one label to train the model. Hence, I can only forecast a single stock value.
However, my aim is to have forecast for several of these stocks in the raw data in one single process.

In the end I would like to compare the predictions to see for which of the stocks I can expect the most significant change + its direction.



Kind regards
Sachs

Answers

  • wesselwessel Member Posts: 537 Maven
    Hey,

    In theory it is possible to use a single model to forecast multiple labels.
    A good example, is nearest neighbors, which can do so without any additional effort.
    Multi-label forecasting is a special branch of machine learning, and requires modified algorithms.

    For stock market prediction, it is very unlikely, that multi-label forecasting will outperform multiple single-label forecasts.
    This is because, a model that is well suited for forecast stock A, can be very different from a model that is well suited for forecasting stock B.

    My advise would be to simply use a loop operator, to run your process for multiple stocks.

    Best regards,

    Wessel
  • qwertzqwertz Member Posts: 130 Contributor II

    Hi Wessel,

    I guess you are absolutely right. The process needs to be run again and again for each prediction as every single prediction requires its own model.

    However, I was not able to sucessfully implement the loop operator in combination with windowing. This is because the windowing operator has an own property called "create label". As far as I know the "loop label" operator is only able to change the label in the raw data but it cannot change the windowing property for each iteration.

    Any ideas ???


    Best regards
    Sachs
  • wesselwessel Member Posts: 537 Maven
    Option 1:
    Use the iteration macro: so set inside Windowing, label=%{my_iteration_macro}

    Option 2:
    Use the "Loop parameters" operator
  • wesselwessel Member Posts: 537 Maven
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.2.006">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="5.2.006" expanded="true" name="Process">
        <process expanded="true" height="392" width="300">
          <operator activated="true" class="generate_data" compatibility="5.2.006" expanded="true" height="60" name="Generate Data" width="90" x="45" y="30"/>
          <operator activated="true" class="loop_attributes" compatibility="5.2.006" expanded="true" height="60" name="Loop Attributes" width="90" x="180" y="30">
            <parameter key="iteration_macro" value="label"/>
            <process expanded="true" height="392" width="300">
              <operator activated="true" class="series:windowing" compatibility="5.1.002" expanded="true" height="76" name="Windowing" width="90" x="180" y="30">
                <parameter key="window_size" value="10"/>
                <parameter key="create_label" value="true"/>
                <parameter key="label_attribute" value="%{label}"/>
              </operator>
              <connect from_port="example set" to_op="Windowing" to_port="example set input"/>
              <connect from_op="Windowing" from_port="original" to_port="example set"/>
              <portSpacing port="source_example set" spacing="0"/>
              <portSpacing port="sink_example set" spacing="0"/>
            </process>
          </operator>
          <connect from_op="Generate Data" from_port="output" to_op="Loop Attributes" to_port="example set"/>
          <portSpacing port="source_input 1" spacing="0"/>
          <portSpacing port="sink_result 1" spacing="0"/>
          <portSpacing port="sink_result 2" spacing="0"/>
        </process>
      </operator>
    </process>
  • wesselwessel Member Posts: 537 Maven
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.2.006">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="5.2.006" expanded="true" name="Process">
        <process expanded="true" height="392" width="300">
          <operator activated="true" class="generate_data" compatibility="5.2.006" expanded="true" height="60" name="Generate Data" width="90" x="45" y="30"/>
          <operator activated="true" class="loop_parameters" compatibility="5.2.006" expanded="true" height="76" name="Loop Parameters" width="90" x="180" y="30">
            <list key="parameters">
              <parameter key="Windowing.label_attribute" value="att1,att2"/>
            </list>
            <process expanded="true" height="392" width="893">
              <operator activated="true" breakpoints="after" class="series:windowing" compatibility="5.1.002" expanded="true" height="76" name="Windowing" width="90" x="112" y="120">
                <parameter key="window_size" value="10"/>
                <parameter key="create_label" value="true"/>
                <parameter key="label_attribute" value="att2"/>
              </operator>
              <connect from_port="input 1" to_op="Windowing" to_port="example set input"/>
              <connect from_op="Windowing" from_port="example set output" to_port="result 1"/>
              <portSpacing port="source_input 1" spacing="0"/>
              <portSpacing port="source_input 2" spacing="0"/>
              <portSpacing port="sink_performance" spacing="0"/>
              <portSpacing port="sink_result 1" spacing="0"/>
              <portSpacing port="sink_result 2" spacing="0"/>
            </process>
          </operator>
          <connect from_op="Generate Data" from_port="output" to_op="Loop Parameters" to_port="input 1"/>
          <connect from_op="Loop Parameters" from_port="result 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>
  • qwertzqwertz Member Posts: 130 Contributor II

    Hi wessel,

    Thanks a lot! Now everything works fine!

    By the way: My next step was looking for a possibility to combine the resulting collection in one table. A solution can be found in this thread "Combining Example Set Attributes"


    Cheers
    Sachs
  • alishsoffiyaalishsoffiya Member Posts: 3 Contributor I

    Hey A very good day to all. I  was trying to do the same but I do not understand how to use either macro or loop parameters.  Will you help telling me the steps to do it ? thanks in advance

Sign In or Register to comment.