"Macro(Macro)?"

New Altair Community Member
Updated by Jocelyn
Hi everybody,
I am wondering, if it is possible to change parameter values of an operator which is processed in a loop according to the current iteration number.
I want to change the "convergence epsilon" parameter of the SVM-Operator during a binary2multiclass chain, to have different values at different iterations.
I had the idea to define macros outside the chain for every iteration: epsilon0, epsilon1, epsilon2, ...
And now I tried to access the macros inside the chain via %{epsilon%{a}}. Unfortunately, this is does not work.
Do you have any ideas how I could manage this.
Perhaps there is another way to create a process which works in the way I described here?!
Best,
Felix
I am wondering, if it is possible to change parameter values of an operator which is processed in a loop according to the current iteration number.
I want to change the "convergence epsilon" parameter of the SVM-Operator during a binary2multiclass chain, to have different values at different iterations.
I had the idea to define macros outside the chain for every iteration: epsilon0, epsilon1, epsilon2, ...
And now I tried to access the macros inside the chain via %{epsilon%{a}}. Unfortunately, this is does not work.
Do you have any ideas how I could manage this.
Perhaps there is another way to create a process which works in the way I described here?!
Best,
Felix
Sort by:
1 - 8 of
81
Hola!
Putting a macro inside a macro is where the problem lies, because a macro is just shorthand for the string it represents. Make a macro at each level of your nested loops, and then join them together.. so "epsilon%{xx}%{yy}" rather than "epsilon%{xx%{yy}}".
%{H}" "%{T}" "%{h}!
Putting a macro inside a macro is where the problem lies, because a macro is just shorthand for the string it represents. Make a macro at each level of your nested loops, and then join them together.. so "epsilon%{xx}%{yy}" rather than "epsilon%{xx%{yy}}".
%{H}" "%{T}" "%{h}!
Hello and thanks again,
I think that won't help me.
I have a problem to access a macro dynamically.
The macros are containing double values, and they are called:
epsilon0
epsilon1
Can I access the values of the macros in a (for this case) twofold crossvalidation for instance?
If nested macros would be possible, I would do something like setting a new macro inside the crossvalidation:
valueMacro = %{epsilon%{a}}
and use %{valueMacro} as a parameter inside the crossValidation.
How can I do so by not using nested macros?
Best,
Felix
I think that won't help me.
I have a problem to access a macro dynamically.
The macros are containing double values, and they are called:
epsilon0
epsilon1
Can I access the values of the macros in a (for this case) twofold crossvalidation for instance?
If nested macros would be possible, I would do something like setting a new macro inside the crossvalidation:
valueMacro = %{epsilon%{a}}
and use %{valueMacro} as a parameter inside the crossValidation.
How can I do so by not using nested macros?
Best,
Felix
Hi there,
You can access macros, and generate new ones from them like this..
You can access macros, and generate new ones from them like this..
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.0">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="5.0.11" expanded="true" name="Process">
<process expanded="true" height="190" width="346">
<operator activated="true" class="loop" compatibility="5.0.11" expanded="true" height="60" name="Loop" width="90" x="246" y="75">
<parameter key="iterations" value="10"/>
<process expanded="true" height="298" width="811">
<operator activated="true" class="set_macro" compatibility="5.0.11" expanded="true" height="76" name="Set Macro" width="90" x="71" y="45">
<parameter key="macro" value="epsilon1"/>
<parameter key="value" value="%{a}"/>
</operator>
<operator activated="true" class="loop" compatibility="5.0.11" expanded="true" height="76" name="Loop (2)" width="90" x="313" y="75">
<process expanded="true" height="298" width="811">
<operator activated="true" class="set_macro" compatibility="5.0.11" expanded="true" height="76" name="Set Macro (2)" width="90" x="45" y="75">
<parameter key="macro" value="epsilon2"/>
<parameter key="value" value="%{epsilon1}"/>
</operator>
<operator activated="true" class="generate_macro" compatibility="5.0.11" expanded="true" height="76" name="Generate Macro" width="90" x="179" y="75">
<list key="function_descriptions">
<parameter key="epsilon3" value="%{epsilon1}*%{epsilon2}+%{b}"/>
</list>
</operator>
<operator activated="true" class="provide_macro_as_log_value" compatibility="5.0.11" expanded="true" height="76" name="Provide Macro as Log Value" width="90" x="313" y="75">
<parameter key="macro_name" value="epsilon3"/>
</operator>
<operator activated="true" class="log" compatibility="5.0.11" expanded="true" height="76" name="Log" width="90" x="447" y="75">
<list key="log">
<parameter key="like this" value="operator.Provide Macro as Log Value.value.macro_value"/>
</list>
</operator>
<connect from_op="Set Macro (2)" from_port="through 1" to_op="Generate Macro" to_port="through 1"/>
<connect from_op="Generate Macro" from_port="through 1" to_op="Provide Macro as Log Value" to_port="through 1"/>
<connect from_op="Provide Macro as Log Value" from_port="through 1" to_op="Log" to_port="through 1"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="source_input 2" spacing="0"/>
<portSpacing port="sink_output 1" spacing="0"/>
</process>
</operator>
<connect from_op="Set Macro" from_port="through 1" to_op="Loop (2)" to_port="input 1"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="sink_output 1" spacing="0"/>
</process>
</operator>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="sink_result 1" spacing="0"/>
</process>
</operator>
</process>
Hey, thank you,
that's very interesting but still won't help me with my current problem.
I don't want to multiply or add the 'iteration number' to some other macro.
I want to use the 'iteration number' to select (switch/case or if/else) a special macro value out of a number of predefined macros. In my experiment there is one macro for every iteration number - which are defined outside the macro.
Best,
Felix
that's very interesting but still won't help me with my current problem.
I don't want to multiply or add the 'iteration number' to some other macro.
I want to use the 'iteration number' to select (switch/case or if/else) a special macro value out of a number of predefined macros. In my experiment there is one macro for every iteration number - which are defined outside the macro.
Best,
Felix
Hi Felix,
you can use the approach haddock outlined and incorporate nested if conditions to select the macro. I don't think there's another solution unless you use a second data table storing the different values. You could then extract the macro from the second data table (possible loaded by a recall operator) on a row defined by another macro.
Greetings,
Sebastian
you can use the approach haddock outlined and incorporate nested if conditions to select the macro. I don't think there's another solution unless you use a second data table storing the different values. You could then extract the macro from the second data table (possible loaded by a recall operator) on a row defined by another macro.
Greetings,
Sebastian
In the past I have concatenated macros within loops, so if %{H}=="hope" and %{T}=="that" and %{h} =="helps" I could make this message...
%{H}" "%{T}" "%{h}
Which I do ;D