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
multiply problem
Dear Sir,
I would like to scramble label value of all data.
As I use the code as follows, I found changed a1 value compared with the original.
If I replace 'multiply' by using copyed 'Retrieve' item, it is correct.
please help me.
regard,
SK
<?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.10" expanded="true" name="Process">
<process expanded="true" height="669" width="953">
<operator activated="true" class="retrieve" compatibility="5.0.10" expanded="true" height="60" name="Retrieve" width="90" x="45" y="30">
<parameter key="repository_entry" value="//Samples/data/Polynomial"/>
</operator>
<operator activated="true" class="multiply" compatibility="5.0.10" expanded="true" height="94" name="Multiply" width="90" x="112" y="75"/>
<operator activated="true" class="set_role" compatibility="5.0.10" expanded="true" height="76" name="Set Role" width="90" x="246" y="75">
<parameter key="name" value="label"/>
</operator>
<operator activated="true" class="select_attributes" compatibility="5.0.10" expanded="true" height="76" name="Select Attributes" width="90" x="380" y="75">
<parameter key="attribute_filter_type" value="subset"/>
<parameter key="attributes" value="a1|a2|a3|a4|a5"/>
</operator>
<operator activated="true" class="generate_id" compatibility="5.0.10" expanded="true" height="76" name="Generate ID" width="90" x="514" y="75"/>
<operator activated="true" class="set_macro" compatibility="5.0.10" expanded="true" height="76" name="Set Macro" width="90" x="112" y="210">
<parameter key="macro" value="seed"/>
<parameter key="value" value="2000"/>
</operator>
<operator activated="true" class="select_attributes" compatibility="5.0.10" expanded="true" height="76" name="Select Attributes (2)" width="90" x="246" y="165">
<parameter key="attribute_filter_type" value="subset"/>
<parameter key="attributes" value="label"/>
</operator>
<operator activated="true" class="shuffle" compatibility="5.0.10" expanded="true" height="76" name="Shuffle" width="90" x="380" y="165">
<parameter key="use_local_random_seed" value="true"/>
</operator>
<operator activated="true" class="generate_id" compatibility="5.0.10" expanded="true" height="76" name="Generate ID (2)" width="90" x="514" y="165"/>
<operator activated="true" class="join" compatibility="5.0.10" expanded="true" height="76" name="Join" width="90" x="648" y="75">
<parameter key="remove_double_attributes" value="false"/>
</operator>
<operator activated="true" class="select_attributes" compatibility="5.0.10" expanded="true" height="76" name="Select Attributes (3)" width="90" x="715" y="165">
<parameter key="attribute_filter_type" value="subset"/>
<parameter key="attributes" value="a1|a2|a3|a4|a5|label"/>
</operator>
<operator activated="true" class="set_role" compatibility="5.0.10" expanded="true" height="76" name="Set Role (2)" width="90" x="849" y="75">
<parameter key="name" value="label"/>
<parameter key="target_role" value="label"/>
</operator>
<connect from_op="Retrieve" from_port="output" to_op="Multiply" to_port="input"/>
<connect from_op="Multiply" from_port="output 1" to_op="Set Role" to_port="example set input"/>
<connect from_op="Multiply" from_port="output 2" to_op="Set Macro" to_port="through 1"/>
<connect from_op="Set Role" from_port="example set output" to_op="Select Attributes" to_port="example set input"/>
<connect from_op="Select Attributes" from_port="example set output" to_op="Generate ID" to_port="example set input"/>
<connect from_op="Generate ID" from_port="example set output" to_op="Join" to_port="left"/>
<connect from_op="Set Macro" from_port="through 1" to_op="Select Attributes (2)" to_port="example set input"/>
<connect from_op="Select Attributes (2)" from_port="example set output" to_op="Shuffle" to_port="example set input"/>
<connect from_op="Shuffle" from_port="example set output" to_op="Generate ID (2)" to_port="example set input"/>
<connect from_op="Generate ID (2)" from_port="example set output" to_op="Join" to_port="right"/>
<connect from_op="Join" from_port="join" to_op="Select Attributes (3)" to_port="example set input"/>
<connect from_op="Select Attributes (3)" from_port="example set output" to_op="Set Role (2)" to_port="example set input"/>
<connect from_op="Set Role (2)" from_port="example set output" 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>
I would like to scramble label value of all data.
As I use the code as follows, I found changed a1 value compared with the original.
If I replace 'multiply' by using copyed 'Retrieve' item, it is correct.
please help me.
regard,
SK
<?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.10" expanded="true" name="Process">
<process expanded="true" height="669" width="953">
<operator activated="true" class="retrieve" compatibility="5.0.10" expanded="true" height="60" name="Retrieve" width="90" x="45" y="30">
<parameter key="repository_entry" value="//Samples/data/Polynomial"/>
</operator>
<operator activated="true" class="multiply" compatibility="5.0.10" expanded="true" height="94" name="Multiply" width="90" x="112" y="75"/>
<operator activated="true" class="set_role" compatibility="5.0.10" expanded="true" height="76" name="Set Role" width="90" x="246" y="75">
<parameter key="name" value="label"/>
</operator>
<operator activated="true" class="select_attributes" compatibility="5.0.10" expanded="true" height="76" name="Select Attributes" width="90" x="380" y="75">
<parameter key="attribute_filter_type" value="subset"/>
<parameter key="attributes" value="a1|a2|a3|a4|a5"/>
</operator>
<operator activated="true" class="generate_id" compatibility="5.0.10" expanded="true" height="76" name="Generate ID" width="90" x="514" y="75"/>
<operator activated="true" class="set_macro" compatibility="5.0.10" expanded="true" height="76" name="Set Macro" width="90" x="112" y="210">
<parameter key="macro" value="seed"/>
<parameter key="value" value="2000"/>
</operator>
<operator activated="true" class="select_attributes" compatibility="5.0.10" expanded="true" height="76" name="Select Attributes (2)" width="90" x="246" y="165">
<parameter key="attribute_filter_type" value="subset"/>
<parameter key="attributes" value="label"/>
</operator>
<operator activated="true" class="shuffle" compatibility="5.0.10" expanded="true" height="76" name="Shuffle" width="90" x="380" y="165">
<parameter key="use_local_random_seed" value="true"/>
</operator>
<operator activated="true" class="generate_id" compatibility="5.0.10" expanded="true" height="76" name="Generate ID (2)" width="90" x="514" y="165"/>
<operator activated="true" class="join" compatibility="5.0.10" expanded="true" height="76" name="Join" width="90" x="648" y="75">
<parameter key="remove_double_attributes" value="false"/>
</operator>
<operator activated="true" class="select_attributes" compatibility="5.0.10" expanded="true" height="76" name="Select Attributes (3)" width="90" x="715" y="165">
<parameter key="attribute_filter_type" value="subset"/>
<parameter key="attributes" value="a1|a2|a3|a4|a5|label"/>
</operator>
<operator activated="true" class="set_role" compatibility="5.0.10" expanded="true" height="76" name="Set Role (2)" width="90" x="849" y="75">
<parameter key="name" value="label"/>
<parameter key="target_role" value="label"/>
</operator>
<connect from_op="Retrieve" from_port="output" to_op="Multiply" to_port="input"/>
<connect from_op="Multiply" from_port="output 1" to_op="Set Role" to_port="example set input"/>
<connect from_op="Multiply" from_port="output 2" to_op="Set Macro" to_port="through 1"/>
<connect from_op="Set Role" from_port="example set output" to_op="Select Attributes" to_port="example set input"/>
<connect from_op="Select Attributes" from_port="example set output" to_op="Generate ID" to_port="example set input"/>
<connect from_op="Generate ID" from_port="example set output" to_op="Join" to_port="left"/>
<connect from_op="Set Macro" from_port="through 1" to_op="Select Attributes (2)" to_port="example set input"/>
<connect from_op="Select Attributes (2)" from_port="example set output" to_op="Shuffle" to_port="example set input"/>
<connect from_op="Shuffle" from_port="example set output" to_op="Generate ID (2)" to_port="example set input"/>
<connect from_op="Generate ID (2)" from_port="example set output" to_op="Join" to_port="right"/>
<connect from_op="Join" from_port="join" to_op="Select Attributes (3)" to_port="example set input"/>
<connect from_op="Select Attributes (3)" from_port="example set output" to_op="Set Role (2)" to_port="example set input"/>
<connect from_op="Set Role (2)" from_port="example set output" 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>
0
Answers
actually a Multiply does not really copy the data, but the view on the data. If you change the data values, they are changed in the underlying memory and hence changed in both views.
A solution is as you wrote loading it twice or using a Materialize to write the data of a view into memory.
Greetings,
Sebastian