LG01:Take and copy the value of a cell of an attribute

LG01
New Altair Community Member
Hello, is it possible with RapidMiner to take a single value in a cell of a column and generate an attribute that contains this value on all lines to make comparisons later with cells of another attribute?
Tagged:
0
Best Answers
-
Yes, based on your explanation it sounds like what you want to do can be done using Extract Macro or Generate Macro and then Generate Attributes. But if you post a sample process and dataset it would be easier to tell for sure.3
-
Hi @LG01,
You can find here a process which performs what you want to do :<?xml version="1.0" encoding="UTF-8"?><process version="9.2.001"> <context> <input/> <output/> <macros/> </context> <operator activated="true" class="process" compatibility="9.2.001" expanded="true" name="Process"> <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="read_excel" compatibility="9.2.001" expanded="true" height="68" name="Read Excel" width="90" x="112" y="85"> <parameter key="excel_file" value="C:\Users\Lionel\Documents\Formations_DataScience\Rapidminer\Tests_Rapidminer\Extract_macro_compare\data.xlsx"/> <parameter key="sheet_selection" value="sheet number"/> <parameter key="sheet_number" value="1"/> <parameter key="imported_cell_range" value="A1"/> <parameter key="encoding" value="SYSTEM"/> <parameter key="first_row_as_names" value="true"/> <list key="annotations"/> <parameter key="date_format" value=""/> <parameter key="time_zone" value="SYSTEM"/> <parameter key="locale" value="English (United States)"/> <parameter key="read_all_values_as_polynominal" value="false"/> <list key="data_set_meta_data_information"> <parameter key="0" value="A.true.polynominal.attribute"/> <parameter key="1" value=" Temperature .true.real.attribute"/> <parameter key="2" value="C.true.polynominal.attribute"/> </list> <parameter key="read_not_matching_values_as_missings" value="false"/> <parameter key="datamanagement" value="double_array"/> <parameter key="data_management" value="auto"/> </operator> <operator activated="true" class="read_excel" compatibility="9.2.001" expanded="true" height="68" name="Read Excel (2)" width="90" x="112" y="187"> <parameter key="excel_file" value="C:\Users\Lionel\Documents\Formations_DataScience\Rapidminer\Tests_Rapidminer\Extract_macro_compare\order.xlsx"/> <parameter key="sheet_selection" value="sheet number"/> <parameter key="sheet_number" value="1"/> <parameter key="imported_cell_range" value="A1"/> <parameter key="encoding" value="SYSTEM"/> <parameter key="first_row_as_names" value="true"/> <list key="annotations"/> <parameter key="date_format" value=""/> <parameter key="time_zone" value="SYSTEM"/> <parameter key="locale" value="English (United States)"/> <parameter key="read_all_values_as_polynominal" value="false"/> <list key="data_set_meta_data_information"> <parameter key="0" value="A.true.polynominal.attribute"/> <parameter key="1" value="B.true.polynominal.attribute"/> <parameter key="2" value="C.true.polynominal.attribute"/> <parameter key="3" value="D.true.polynominal.attribute"/> <parameter key="4" value="E.true.polynominal.attribute"/> <parameter key="5" value="F.true.polynominal.attribute"/> </list> <parameter key="read_not_matching_values_as_missings" value="false"/> <parameter key="datamanagement" value="double_array"/> <parameter key="data_management" value="auto"/> </operator> <operator activated="true" class="extract_macro" compatibility="9.2.001" expanded="true" height="68" name="Extract Macro" width="90" x="246" y="187"> <parameter key="macro" value="maxTemperature"/> <parameter key="macro_type" value="data_value"/> <parameter key="statistics" value="average"/> <parameter key="attribute_name" value="D"/> <parameter key="example_index" value="1"/> <list key="additional_macros"/> </operator> <operator activated="true" class="generate_attributes" compatibility="9.2.001" expanded="true" height="82" name="Generate Attributes" width="90" x="246" y="85"> <list key="function_descriptions"> <parameter key="test_statut" value="if(Temperature<eval(%{maxTemperature}),"True","False")"/> </list> <parameter key="keep_all" value="true"/> </operator> <operator activated="true" class="filter_examples" compatibility="9.2.001" expanded="true" height="103" name="Filter Examples" width="90" x="380" y="85"> <parameter key="parameter_expression" value=""/> <parameter key="condition_class" value="custom_filters"/> <parameter key="invert_filter" value="false"/> <list key="filters_list"> <parameter key="filters_entry_key" value="test_statut.equals.False"/> </list> <parameter key="filters_logic_and" value="true"/> <parameter key="filters_check_metadata" value="true"/> </operator> <connect from_op="Read Excel" from_port="output" to_op="Generate Attributes" to_port="example set input"/> <connect from_op="Read Excel (2)" from_port="output" to_op="Extract Macro" to_port="example set"/> <connect from_op="Extract Macro" from_port="example set" to_port="result 2"/> <connect from_op="Generate Attributes" from_port="example set output" to_op="Filter Examples" to_port="example set input"/> <connect from_op="Filter Examples" 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"/> <portSpacing port="sink_result 3" spacing="0"/> </process> </operator> </process>
Hope this helps,
Regards,
Lionel
1 -
Hello @LG01
You need to open a new process in RM. Then Copy and paste this process in XML window. You can find XML window by choosing View --> Show Panel --> XML. Once you copy and paste this entire XML code, you need to click on green tick mark available on XML window. It will show you the process, then you need to connect your data in the process.1
Answers
-
Yes, based on your explanation it sounds like what you want to do can be done using Extract Macro or Generate Macro and then Generate Attributes. But if you post a sample process and dataset it would be easier to tell for sure.3
-
Thank you Telcontar 120 for your answer. Actually, I would like to take the first condition of the file order (<29), create an attribute that contains the value 29 on all its lines then join the data table in order to compare row by row the condition <29 and display the lines for which the condition is false
0 -
Hi @LG01,
You can find here a process which performs what you want to do :<?xml version="1.0" encoding="UTF-8"?><process version="9.2.001"> <context> <input/> <output/> <macros/> </context> <operator activated="true" class="process" compatibility="9.2.001" expanded="true" name="Process"> <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="read_excel" compatibility="9.2.001" expanded="true" height="68" name="Read Excel" width="90" x="112" y="85"> <parameter key="excel_file" value="C:\Users\Lionel\Documents\Formations_DataScience\Rapidminer\Tests_Rapidminer\Extract_macro_compare\data.xlsx"/> <parameter key="sheet_selection" value="sheet number"/> <parameter key="sheet_number" value="1"/> <parameter key="imported_cell_range" value="A1"/> <parameter key="encoding" value="SYSTEM"/> <parameter key="first_row_as_names" value="true"/> <list key="annotations"/> <parameter key="date_format" value=""/> <parameter key="time_zone" value="SYSTEM"/> <parameter key="locale" value="English (United States)"/> <parameter key="read_all_values_as_polynominal" value="false"/> <list key="data_set_meta_data_information"> <parameter key="0" value="A.true.polynominal.attribute"/> <parameter key="1" value=" Temperature .true.real.attribute"/> <parameter key="2" value="C.true.polynominal.attribute"/> </list> <parameter key="read_not_matching_values_as_missings" value="false"/> <parameter key="datamanagement" value="double_array"/> <parameter key="data_management" value="auto"/> </operator> <operator activated="true" class="read_excel" compatibility="9.2.001" expanded="true" height="68" name="Read Excel (2)" width="90" x="112" y="187"> <parameter key="excel_file" value="C:\Users\Lionel\Documents\Formations_DataScience\Rapidminer\Tests_Rapidminer\Extract_macro_compare\order.xlsx"/> <parameter key="sheet_selection" value="sheet number"/> <parameter key="sheet_number" value="1"/> <parameter key="imported_cell_range" value="A1"/> <parameter key="encoding" value="SYSTEM"/> <parameter key="first_row_as_names" value="true"/> <list key="annotations"/> <parameter key="date_format" value=""/> <parameter key="time_zone" value="SYSTEM"/> <parameter key="locale" value="English (United States)"/> <parameter key="read_all_values_as_polynominal" value="false"/> <list key="data_set_meta_data_information"> <parameter key="0" value="A.true.polynominal.attribute"/> <parameter key="1" value="B.true.polynominal.attribute"/> <parameter key="2" value="C.true.polynominal.attribute"/> <parameter key="3" value="D.true.polynominal.attribute"/> <parameter key="4" value="E.true.polynominal.attribute"/> <parameter key="5" value="F.true.polynominal.attribute"/> </list> <parameter key="read_not_matching_values_as_missings" value="false"/> <parameter key="datamanagement" value="double_array"/> <parameter key="data_management" value="auto"/> </operator> <operator activated="true" class="extract_macro" compatibility="9.2.001" expanded="true" height="68" name="Extract Macro" width="90" x="246" y="187"> <parameter key="macro" value="maxTemperature"/> <parameter key="macro_type" value="data_value"/> <parameter key="statistics" value="average"/> <parameter key="attribute_name" value="D"/> <parameter key="example_index" value="1"/> <list key="additional_macros"/> </operator> <operator activated="true" class="generate_attributes" compatibility="9.2.001" expanded="true" height="82" name="Generate Attributes" width="90" x="246" y="85"> <list key="function_descriptions"> <parameter key="test_statut" value="if(Temperature<eval(%{maxTemperature}),"True","False")"/> </list> <parameter key="keep_all" value="true"/> </operator> <operator activated="true" class="filter_examples" compatibility="9.2.001" expanded="true" height="103" name="Filter Examples" width="90" x="380" y="85"> <parameter key="parameter_expression" value=""/> <parameter key="condition_class" value="custom_filters"/> <parameter key="invert_filter" value="false"/> <list key="filters_list"> <parameter key="filters_entry_key" value="test_statut.equals.False"/> </list> <parameter key="filters_logic_and" value="true"/> <parameter key="filters_check_metadata" value="true"/> </operator> <connect from_op="Read Excel" from_port="output" to_op="Generate Attributes" to_port="example set input"/> <connect from_op="Read Excel (2)" from_port="output" to_op="Extract Macro" to_port="example set"/> <connect from_op="Extract Macro" from_port="example set" to_port="result 2"/> <connect from_op="Generate Attributes" from_port="example set output" to_op="Filter Examples" to_port="example set input"/> <connect from_op="Filter Examples" 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"/> <portSpacing port="sink_result 3" spacing="0"/> </process> </operator> </process>
Hope this helps,
Regards,
Lionel
1 -
Hello Lionel,
Thank you for this process. Could you tell me what is the procedure to recover this process and run it on my computer? Best Regards0 -
Hello @LG01
You need to open a new process in RM. Then Copy and paste this process in XML window. You can find XML window by choosing View --> Show Panel --> XML. Once you copy and paste this entire XML code, you need to click on green tick mark available on XML window. It will show you the process, then you need to connect your data in the process.1 -
Hello Varunm 1
Thank you very much
0 -
Hello, now I would like (always using a table of datas and a table of conditions) to know if rapidminer is able to go to read each condition in each exemple of the file "order" and to generate a number of macro equal to the number of conditions (exemples). Then it would be to go read all the datas in the "datas" file and to display a table that only displays the rows with false conditions. Thanks for your help.
0