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
All values of attributes on one example set, problem with memory
Hello
I want to concatenate some attributes and then, put all the values of this attribute in other atrribute in one example set. Something like this:
att1 - att 2 - att 3
1 casa - perro - carro
2 avion- teja - amigo
3 mujer - bonita - leal
And then create:
att4
1. casa perro carro avion teja avion teja amigo mujer bonita leal
I did the below process:
Please, Could you give some advice about this topic? How can I reduce the memory used for the above process
I want to concatenate some attributes and then, put all the values of this attribute in other atrribute in one example set. Something like this:
att1 - att 2 - att 3
1 casa - perro - carro
2 avion- teja - amigo
3 mujer - bonita - leal
And then create:
att4
1. casa perro carro avion teja avion teja amigo mujer bonita leal
I did the below process:
I have, in average, 9800 exampleset, and I concatenate five or six attributes. My problem is about memory. This preprocess only use more than 1,5gb of RAM. My objetive is make a sql query whit this attribute, but the query is a little big so the process crash for memory.
<?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="370" width="614">
<operator activated="true" class="generate_data_user_specification" compatibility="5.2.006" expanded="true" height="60" name="Generate Data by User Specification" width="90" x="179" y="300">
<list key="attribute_values">
<parameter key="recortar" value="cut("%{valor}",0,length("%{valor}")-3)"/>
</list>
<list key="set_additional_roles"/>
</operator>
<operator activated="true" class="extract_macro" compatibility="5.2.006" expanded="true" height="60" name="Extract Macro" width="90" x="380" y="300">
<parameter key="macro" value="valor"/>
<parameter key="macro_type" value="data_value"/>
<parameter key="attribute_name" value="recortar"/>
<parameter key="example_index" value="1"/>
</operator>
<operator activated="true" class="read_excel" compatibility="5.2.006" expanded="true" height="60" name="Read Excel (2)" width="90" x="45" y="120">
<list key="annotations"/>
<list key="data_set_meta_data_information">
<parameter key="1" value="a.true.nominal.regular"/>
<parameter key="2" value="b.true.nominal.regular"/>
<parameter key="3" value="c.true.nominal.regular"/>
<parameter key="4" value="d.true.nominal.regular"/>
<parameter key="5" value="e.true.nominal.regular"/>
<parameter key="6" value="f.true.nominal.regular"/>
</list>
</operator>
<operator activated="true" class="generate_attributes" compatibility="5.2.006" expanded="true" height="76" name="Generate Attributes (2)" width="90" x="179" y="120">
<list key="function_descriptions">
<parameter key="nuevo" value="concat(a,b,c,d,e,f)"/>
</list>
</operator>
<operator activated="true" class="select_attributes" compatibility="5.2.006" expanded="true" height="76" name="Select Attributes (2)" width="90" x="313" y="120">
<parameter key="attribute_filter_type" value="single"/>
<parameter key="attribute" value="nuevo"/>
</operator>
<operator activated="true" class="loop_values" compatibility="5.2.006" expanded="true" height="76" name="Loop Values" width="90" x="447" y="120">
<parameter key="attribute" value="nuevo"/>
<process expanded="true" height="383" width="611">
<operator activated="true" class="set_macro" compatibility="5.2.006" expanded="true" height="76" name="Set Macro (3)" width="90" x="246" y="30">
<parameter key="macro" value="valor"/>
<parameter key="value" value="%{valor} %{loop_value} or"/>
</operator>
<connect from_port="example set" to_op="Set Macro (3)" to_port="through 1"/>
<connect from_op="Set Macro (3)" from_port="through 1" to_port="out 1"/>
<portSpacing port="source_example set" spacing="0"/>
<portSpacing port="sink_out 1" spacing="0"/>
<portSpacing port="sink_out 2" spacing="0"/>
</process>
</operator>
<connect from_op="Generate Data by User Specification" from_port="output" to_op="Extract Macro" to_port="example set"/>
<connect from_op="Extract Macro" from_port="example set" to_port="result 1"/>
<connect from_op="Read Excel (2)" from_port="output" to_op="Generate Attributes (2)" to_port="example set input"/>
<connect from_op="Generate Attributes (2)" from_port="example set output" to_op="Select Attributes (2)" to_port="example set input"/>
<connect from_op="Select Attributes (2)" from_port="example set output" to_op="Loop Values" to_port="example set"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="sink_result 1" spacing="234"/>
<portSpacing port="sink_result 2" spacing="18"/>
</process>
</operator>
</process>
Please, Could you give some advice about this topic? How can I reduce the memory used for the above process
0
Answers
You could use the following trick, which avoids loops and macros by looking for column separators which are not present in the data. No column separators means only one column is possible. That should ease your memory problems a bit.
Good weekend
Best
H
I'm a little suppruised about the use of write and read csv operator. How do you disapper the "csv file" parameter that normally is mandatory? Why do you do that?? Does the second port(fil) of the write csv operator has the same data than the first port(thr)?
I have other issue. I want put all the rows in one row. If I have this
row att1
1 a
2 b
3 c
4 d
I would like have this
row att2
1 abcd
I really appreciate your help , have a good day Haddock
Check out the "Pivot" operator, and apply that before the trick I showed you ( yes , fil==file as you spotted !)
Have a good one!
Best
H
I have other question. How do you hide the "excel file" parameter from the read csv operator? I was reading the xml that you sent me and I don't understand how make this change.
I really appreciate your help. Thanks a lot haddock.
If your data is in Excel you will need to load it and write it out as a CSV, like this Best
H