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
How to change the output of loop label to write down the Excel files based on the name of the label
Dear All
I am running the following loop to go through multi-labels and write the outputs into Excel file each time. The macro I am using %{a}.xlsx just writes each Excel file name based on numbers (1.xlxs, 2.xlxs, ...). I want to change this macro to write down the name of each label. I mean the Excel outputs will be the name of first lable.xlxs, second label.xlxs, ...).
Thanks
I am running the following loop to go through multi-labels and write the outputs into Excel file each time. The macro I am using %{a}.xlsx just writes each Excel file name based on numbers (1.xlxs, 2.xlxs, ...). I want to change this macro to write down the name of each label. I mean the Excel outputs will be the name of first lable.xlxs, second label.xlxs, ...).
Thanks
<?xml version="1.0" encoding="UTF-8"?><process version="10.3.000">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="10.3.000" expanded="true" name="Process" origin="GENERATED_TUTORIAL">
<parameter key="logverbosity" value="init"/>
<parameter key="random_seed" value="2001"/>
<parameter key="send_mail" value="never"/>
<parameter key="notification_email" value=""/>
<parameter key="process_duration_for_mail" value="30"/>
<parameter key="encoding" value="SYSTEM"/>
<process expanded="true">
<operator activated="true" class="retrieve" compatibility="10.3.000" expanded="true" height="68" name="Retrieve Quartiled All data" width="90" x="45" y="85">
<parameter key="repository_entry" value="Quartiled All data"/>
</operator>
<operator activated="true" class="blending:set_role" compatibility="10.3.000" expanded="true" height="82" name="Set Role (2)" origin="GENERATED_TUTORIAL" width="90" x="179" y="85">
<list key="set_roles">
<parameter key="Hardness Bite 1 (N)" value="label"/>
<parameter key="Hardness Bite 2 (N)" value="label"/>
<parameter key="Adhesive Force (N)" value="label"/>
<parameter key="Cohesiveness" value="label"/>
<parameter key="Gumminess (N)" value="label"/>
<parameter key="Springiness (mm)" value="label"/>
<parameter key="Chewiness (N)" value="label"/>
<parameter key="Resilience" value="label"/>
<parameter key="gas amount (mol/g)" value="label"/>
<parameter key="baking loss" value="label"/>
<parameter key="Crust Colour a*" value="label"/>
<parameter key="Crust Colour b*" value="label"/>
<parameter key="Crust Colour L*" value="label"/>
<parameter key="Crust ^E*" value="label"/>
<parameter key="Crumb ^E*" value="label"/>
<parameter key="Crumb Colour a*" value="label"/>
<parameter key="Crumb Colour b*" value="label"/>
<parameter key="Crumb Colour L*" value="label"/>
<parameter key="void_fraction" value="label"/>
<parameter key="mean_area_mm2" value="label"/>
<parameter key="cell_density_cm2" value="label"/>
<parameter key="small_cell_density_cm2" value="label"/>
<parameter key="large_cell_density_cm2" value="label"/>
<parameter key="range" value="label"/>
<parameter key="mean_ecc" value="label"/>
</list>
</operator>
<operator activated="true" class="loop_labels" compatibility="10.3.000" expanded="true" height="82" name="Loop Labels" origin="GENERATED_TUTORIAL" width="90" x="313" y="85">
<process expanded="true">
<operator activated="true" class="replace_missing_values" compatibility="10.3.000" expanded="true" height="103" name="Replace Missing Values (4)" width="90" x="45" y="34">
<parameter key="return_preprocessing_model" value="false"/>
<parameter key="attribute_filter_type" value="all"/>
<parameter key="attribute" value=""/>
<parameter key="attributes" value=""/>
<parameter key="use_except_expression" value="false"/>
<parameter key="value_type" value="attribute_value"/>
<parameter key="use_value_type_exception" value="false"/>
<parameter key="except_value_type" value="time"/>
<parameter key="block_type" value="attribute_block"/>
<parameter key="use_block_type_exception" value="false"/>
<parameter key="except_block_type" value="value_matrix_row_start"/>
<parameter key="invert_selection" value="false"/>
<parameter key="include_special_attributes" value="true"/>
<parameter key="default" value="average"/>
<list key="columns"/>
</operator>
<operator activated="true" class="select_attributes" compatibility="10.3.000" expanded="true" height="82" name="Select Attributes" width="90" x="179" y="34">
<parameter key="attribute_filter_type" value="all"/>
<parameter key="attribute" value="SCC"/>
<parameter key="attributes" value="|au_scc|Vol|Prot|Peak_Flow|Milking_Time|Lact|Fat|EC|Date"/>
<parameter key="use_except_expression" value="false"/>
<parameter key="value_type" value="numeric"/>
<parameter key="use_value_type_exception" value="false"/>
<parameter key="except_value_type" value="time"/>
<parameter key="block_type" value="attribute_block"/>
<parameter key="use_block_type_exception" value="false"/>
<parameter key="except_block_type" value="value_matrix_row_start"/>
<parameter key="invert_selection" value="false"/>
<parameter key="include_special_attributes" value="false"/>
</operator>
<operator activated="true" class="weight_by_information_gain" compatibility="10.3.000" expanded="true" height="82" name="Weight by Information Gain" width="90" x="313" y="21">
<parameter key="normalize_weights" value="true"/>
<parameter key="sort_weights" value="true"/>
<parameter key="sort_direction" value="ascending"/>
</operator>
<operator activated="true" class="weights_to_data" compatibility="10.3.000" expanded="true" height="68" name="Weights to Data" width="90" x="447" y="34"/>
<operator activated="true" class="set_role" compatibility="5.3.013" expanded="true" height="82" name="Set Role" width="90" x="581" y="34">
<parameter key="attribute_name" value="Attribute"/>
<parameter key="target_role" value="id"/>
<list key="set_additional_roles"/>
</operator>
<operator activated="true" class="rename" compatibility="10.3.000" expanded="true" height="82" name="Rename" width="90" x="715" y="34">
<parameter key="old_name" value="Weight"/>
<parameter key="new_name" value="Weight_Info Gain"/>
<list key="rename_additional_attributes"/>
</operator>
<operator activated="true" class="write_excel" compatibility="10.3.000" expanded="true" height="103" name="Write Excel" width="90" x="849" y="34">
<parameter key="excel_file" value="/Users/Mansour/Downloads/Maman_Mona/%{a}.xlsx"/>
<parameter key="file_format" value="xlsx"/>
<enumeration key="sheet_names"/>
<parameter key="sheet_name" value="RapidMiner Data"/>
<parameter key="date_format" value="yyyy-MM-dd HH:mm:ss"/>
<parameter key="number_format" value="#.0"/>
<parameter key="encoding" value="SYSTEM"/>
</operator>
<connect from_port="example set" to_op="Replace Missing Values (4)" to_port="example set input"/>
<connect from_op="Replace Missing Values (4)" 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="Weight by Information Gain" to_port="example set"/>
<connect from_op="Weight by Information Gain" from_port="weights" to_op="Weights to Data" to_port="attribute weights"/>
<connect from_op="Weights to Data" from_port="example set" to_op="Set Role" to_port="example set input"/>
<connect from_op="Set Role" from_port="example set output" to_op="Rename" to_port="example set input"/>
<connect from_op="Rename" from_port="example set output" to_op="Write Excel" to_port="input"/>
<connect from_op="Write Excel" from_port="through" 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="Retrieve Quartiled All data" from_port="output" to_op="Set Role (2)" to_port="example set input"/>
<connect from_op="Set Role (2)" from_port="example set output" to_op="Loop Labels" to_port="example set"/>
<connect from_op="Loop Labels" from_port="out 1" to_port="result 1"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="sink_result 1" spacing="90"/>
<portSpacing port="sink_result 2" spacing="0"/>
</process>
</operator>
</process>
0
Answers
I have created an example process detailing how to extract that information. You will need an operator from the "Operator Toolbox" extension called "Extract Statistics".
https://marketplace.rapidminer.com/UpdateServer/faces/product_details.xhtml?productId=rmx_operator_toolbox
(You can find the Annotations in the Result view)
Many thanks. I want the output to be saved as an Excel file for further analysis
Best wishes
Mansour
I tried it but the label doesn't transfer to the next part and I receive an error of not label defined.
Regards.
mansoru