The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
[SOLVED] Series prediction with multiple labels / predictions in one process
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
0
Answers
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
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
Use the iteration macro: so set inside Windowing, label=%{my_iteration_macro}
Option 2:
Use the "Loop parameters" operator
<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>
<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>
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
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