Due to recent updates, all users are required to create an Altair One account to login to the RapidMiner community. Click the Register button to create your account using the same email that you have previously used to login to the RapidMiner community. This will ensure that any previously created content will be synced to your Altair One account. Once you login, you will be asked to provide a username that identifies you to other Community users. Email us at Community with questions.
Problem with loop modelling output saving
sebastian_gonza
RapidMiner Certified Analyst, Member Posts: 52 Guru
Hi
I have a Data set with Client ID | Order ID | Quantity | Price, what I want to do is a regression per client ID like Quantity = Beta + alpha*Price and save the output in a collection, I got to the collection but it keeps printing the same value over and over again, also I would like to append the Client ID to their respective model but I dont know how, could someone help me please?
Thanks
Attached: Sample data and process
<?xml version="1.0" encoding="UTF-8"?><process version="9.0.002">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="9.0.002" expanded="true" name="Process">
<process expanded="true">
<operator activated="true" class="retrieve" compatibility="9.0.002" expanded="true" height="68" name="Retrieve pedidos_con_cliente_importe" width="90" x="45" y="340">
<parameter key="repository_entry" value="pedidos_con_cliente_importe"/>
</operator>
<operator activated="true" class="select_attributes" compatibility="9.0.002" expanded="true" height="82" name="Select Attributes (5)" width="90" x="179" y="340">
<parameter key="attribute_filter_type" value="subset"/>
<parameter key="attributes" value="Cantidad|IdCliente|IdPedido|Importe|Precio calculado"/>
</operator>
<operator activated="true" class="set_role" compatibility="9.0.002" expanded="true" height="82" name="Set Role" width="90" x="313" y="340">
<parameter key="attribute_name" value="Cantidad"/>
<parameter key="target_role" value="label"/>
<list key="set_additional_roles"/>
</operator>
<operator activated="true" class="remove_duplicates" compatibility="9.0.002" expanded="true" height="103" name="Remove Duplicates" width="90" x="447" y="340">
<parameter key="attribute_filter_type" value="subset"/>
<parameter key="attributes" value="IdCliente|IdPedido|Importe|Cantidad"/>
</operator>
<operator activated="true" class="concurrency:loop_values" compatibility="9.0.002" expanded="true" height="82" name="Loop Values" width="90" x="581" y="340">
<parameter key="attribute" value="IdCliente"/>
<process expanded="true">
<operator activated="true" class="select_attributes" compatibility="9.0.002" expanded="true" height="82" name="Select Attributes (6)" width="90" x="112" y="34">
<parameter key="attribute_filter_type" value="subset"/>
<parameter key="attributes" value="Cantidad|Precio calculado"/>
</operator>
<operator activated="true" class="linear_regression" compatibility="9.0.002" expanded="true" height="103" name="Linear Regression" width="90" x="246" y="34">
<parameter key="eliminate_colinear_features" value="false"/>
<parameter key="use_bias" value="false"/>
</operator>
<connect from_port="input 1" to_op="Select Attributes (6)" to_port="example set input"/>
<connect from_op="Select Attributes (6)" from_port="example set output" to_op="Linear Regression" to_port="training set"/>
<connect from_op="Linear Regression" from_port="model" to_port="output 1"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="source_input 2" spacing="0"/>
<portSpacing port="sink_output 1" spacing="0"/>
<portSpacing port="sink_output 2" spacing="0"/>
</process>
</operator>
<operator activated="true" class="collect" compatibility="9.0.002" expanded="true" height="82" name="Collect" width="90" x="715" y="340"/>
<connect from_op="Retrieve pedidos_con_cliente_importe" from_port="output" to_op="Select Attributes (5)" to_port="example set input"/>
<connect from_op="Select Attributes (5)" from_port="example set output" to_op="Set Role" to_port="example set input"/>
<connect from_op="Set Role" from_port="example set output" to_op="Remove Duplicates" to_port="example set input"/>
<connect from_op="Remove Duplicates" from_port="example set output" to_op="Loop Values" to_port="input 1"/>
<connect from_op="Loop Values" from_port="output 1" to_op="Collect" to_port="input 1"/>
<connect from_op="Collect" from_port="collection" 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>
Tagged:
0
Best Answers
-
MartinLiebig Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, University Professor Posts: 3,531 RM Data Scientist
Hi,
attached is a solution. You need Operator Toolbox extension to run this.
Best,
Martin
<?xml version="1.0" encoding="UTF-8"?><process version="9.0.002">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="9.0.002" expanded="true" name="Process">
<process expanded="true">
<operator activated="true" class="retrieve" compatibility="9.0.002" expanded="true" height="68" name="Retrieve pedidos_con_cliente_importe" width="90" x="45" y="340">
<parameter key="repository_entry" value="pedidos_con_cliente_importe"/>
</operator>
<operator activated="true" class="select_attributes" compatibility="9.0.002" expanded="true" height="82" name="Select Attributes (5)" width="90" x="179" y="340">
<parameter key="attribute_filter_type" value="subset"/>
<parameter key="attributes" value="Cantidad|IdCliente|IdPedido|Importe|Precio calculado"/>
</operator>
<operator activated="true" class="set_role" compatibility="9.0.002" expanded="true" height="82" name="Set Role" width="90" x="313" y="340">
<parameter key="attribute_name" value="Cantidad"/>
<parameter key="target_role" value="label"/>
<list key="set_additional_roles"/>
</operator>
<operator activated="true" class="remove_duplicates" compatibility="9.0.002" expanded="true" height="103" name="Remove Duplicates" width="90" x="447" y="340">
<parameter key="attribute_filter_type" value="subset"/>
<parameter key="attributes" value="IdCliente|IdPedido|Importe|Cantidad"/>
</operator>
<operator activated="false" class="concurrency:loop_values" compatibility="9.0.002" expanded="true" height="68" name="Loop Values" width="90" x="782" y="238">
<parameter key="attribute" value="IdCliente"/>
<process expanded="true">
<operator activated="true" class="select_attributes" compatibility="9.0.002" expanded="true" height="82" name="Select Attributes (6)" width="90" x="581" y="136">
<parameter key="attribute_filter_type" value="subset"/>
<parameter key="attributes" value="Cantidad|Precio calculado"/>
</operator>
<operator activated="true" class="linear_regression" compatibility="9.0.002" expanded="true" height="103" name="Linear Regression" width="90" x="715" y="136">
<parameter key="eliminate_colinear_features" value="false"/>
<parameter key="use_bias" value="false"/>
</operator>
<connect from_op="Select Attributes (6)" from_port="example set output" to_op="Linear Regression" to_port="training set"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="sink_output 1" spacing="0"/>
</process>
</operator>
<operator activated="true" class="collect" compatibility="9.0.002" expanded="true" height="82" name="Collect" width="90" x="983" y="340"/>
<operator activated="true" class="operator_toolbox:group_into_collection" compatibility="1.5.000-SNAPSHOT" expanded="true" height="82" name="Group Into Collection" width="90" x="581" y="340">
<parameter key="group_by_attribute" value="IdCliente"/>
</operator>
<operator activated="true" class="loop_collection" compatibility="9.0.002" expanded="true" height="82" name="Loop Collection" width="90" x="782" y="340">
<process expanded="true">
<operator activated="true" class="select_attributes" compatibility="9.0.002" expanded="true" height="82" name="Select Attributes (2)" width="90" x="179" y="85">
<parameter key="attribute_filter_type" value="subset"/>
<parameter key="attributes" value="Cantidad|Precio calculado"/>
</operator>
<operator activated="true" class="linear_regression" compatibility="9.0.002" expanded="true" height="103" name="Linear Regression (2)" width="90" x="313" y="85">
<parameter key="eliminate_colinear_features" value="false"/>
<parameter key="use_bias" value="false"/>
</operator>
<connect from_port="single" to_op="Select Attributes (2)" to_port="example set input"/>
<connect from_op="Select Attributes (2)" from_port="example set output" to_op="Linear Regression (2)" to_port="training set"/>
<connect from_op="Linear Regression (2)" from_port="model" to_port="output 1"/>
<portSpacing port="source_single" spacing="0"/>
<portSpacing port="sink_output 1" spacing="0"/>
<portSpacing port="sink_output 2" spacing="0"/>
</process>
</operator>
<connect from_op="Retrieve pedidos_con_cliente_importe" from_port="output" to_op="Select Attributes (5)" to_port="example set input"/>
<connect from_op="Select Attributes (5)" from_port="example set output" to_op="Set Role" to_port="example set input"/>
<connect from_op="Set Role" from_port="example set output" to_op="Remove Duplicates" to_port="example set input"/>
<connect from_op="Remove Duplicates" from_port="example set output" to_op="Collect" to_port="input 1"/>
<connect from_op="Collect" from_port="collection" 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>- Sr. Director Data Solutions, Altair RapidMiner -
Dortmund, Germany2 -
MartinLiebig Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, University Professor Posts: 3,531 RM Data Scientist
did you use macros? Attached a version with annotate.
Cheers,
Martin
<?xml version="1.0" encoding="UTF-8"?><process version="9.0.002">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="9.0.002" expanded="true" name="Process">
<process expanded="true">
<operator activated="true" class="retrieve" compatibility="9.0.002" expanded="true" height="68" name="Retrieve pedidos_con_cliente_importe" width="90" x="45" y="340">
<parameter key="repository_entry" value="pedidos_con_cliente_importe"/>
</operator>
<operator activated="true" class="select_attributes" compatibility="9.0.002" expanded="true" height="82" name="Select Attributes (5)" width="90" x="179" y="340">
<parameter key="attribute_filter_type" value="subset"/>
<parameter key="attributes" value="Cantidad|IdCliente|IdPedido|Importe|Precio calculado"/>
</operator>
<operator activated="true" class="set_role" compatibility="9.0.002" expanded="true" height="82" name="Set Role" width="90" x="313" y="340">
<parameter key="attribute_name" value="Cantidad"/>
<parameter key="target_role" value="label"/>
<list key="set_additional_roles"/>
</operator>
<operator activated="true" class="remove_duplicates" compatibility="9.0.002" expanded="true" height="103" name="Remove Duplicates" width="90" x="447" y="340">
<parameter key="attribute_filter_type" value="subset"/>
<parameter key="attributes" value="IdCliente|IdPedido|Importe|Cantidad"/>
</operator>
<operator activated="false" class="concurrency:loop_values" compatibility="9.0.002" expanded="true" height="68" name="Loop Values" width="90" x="782" y="238">
<parameter key="attribute" value="IdCliente"/>
<process expanded="true">
<operator activated="true" class="select_attributes" compatibility="9.0.002" expanded="true" height="82" name="Select Attributes (6)" width="90" x="581" y="136">
<parameter key="attribute_filter_type" value="subset"/>
<parameter key="attributes" value="Cantidad|Precio calculado"/>
</operator>
<operator activated="true" class="linear_regression" compatibility="9.0.002" expanded="true" height="103" name="Linear Regression" width="90" x="715" y="136">
<parameter key="eliminate_colinear_features" value="false"/>
<parameter key="use_bias" value="false"/>
</operator>
<connect from_op="Select Attributes (6)" from_port="example set output" to_op="Linear Regression" to_port="training set"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="sink_output 1" spacing="0"/>
</process>
</operator>
<operator activated="true" class="collect" compatibility="9.0.002" expanded="true" height="82" name="Collect" width="90" x="983" y="340"/>
<operator activated="true" class="operator_toolbox:group_into_collection" compatibility="1.5.000-SNAPSHOT" expanded="true" height="82" name="Group Into Collection" width="90" x="581" y="340">
<parameter key="group_by_attribute" value="IdCliente"/>
</operator>
<operator activated="true" class="loop_collection" compatibility="9.0.002" expanded="true" height="82" name="Loop Collection" width="90" x="782" y="340">
<process expanded="true">
<operator activated="true" class="extract_macro" compatibility="9.0.002" expanded="true" height="68" name="Extract Macro" width="90" x="45" y="34">
<parameter key="macro" value="IdCliente"/>
<parameter key="macro_type" value="data_value"/>
<parameter key="attribute_name" value="IdCliente"/>
<parameter key="example_index" value="1"/>
<list key="additional_macros"/>
</operator>
<operator activated="true" class="select_attributes" compatibility="9.0.002" expanded="true" height="82" name="Select Attributes (2)" width="90" x="179" y="85">
<parameter key="attribute_filter_type" value="subset"/>
<parameter key="attributes" value="Cantidad|Precio calculado"/>
</operator>
<operator activated="true" class="linear_regression" compatibility="9.0.002" expanded="true" height="103" name="Linear Regression (2)" width="90" x="313" y="85">
<parameter key="eliminate_colinear_features" value="false"/>
<parameter key="use_bias" value="false"/>
</operator>
<operator activated="true" class="annotate" compatibility="9.0.002" expanded="true" height="68" name="Annotate" width="90" x="514" y="85">
<list key="annotations">
<parameter key="Comment" value="%{IdCliente}"/>
</list>
</operator>
<connect from_port="single" to_op="Extract Macro" to_port="example set"/>
<connect from_op="Extract Macro" from_port="example set" to_op="Select Attributes (2)" to_port="example set input"/>
<connect from_op="Select Attributes (2)" from_port="example set output" to_op="Linear Regression (2)" to_port="training set"/>
<connect from_op="Linear Regression (2)" from_port="model" to_op="Annotate" to_port="input"/>
<connect from_op="Annotate" from_port="output" to_port="output 1"/>
<portSpacing port="source_single" spacing="0"/>
<portSpacing port="sink_output 1" spacing="0"/>
<portSpacing port="sink_output 2" spacing="0"/>
</process>
</operator>
<connect from_op="Retrieve pedidos_con_cliente_importe" from_port="output" to_op="Select Attributes (5)" to_port="example set input"/>
<connect from_op="Select Attributes (5)" from_port="example set output" to_op="Set Role" to_port="example set input"/>
<connect from_op="Set Role" from_port="example set output" to_op="Remove Duplicates" to_port="example set input"/>
<connect from_op="Remove Duplicates" from_port="example set output" to_op="Collect" to_port="input 1"/>
<connect from_op="Collect" from_port="collection" 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>- Sr. Director Data Solutions, Altair RapidMiner -
Dortmund, Germany1
Answers
Sample Data
Hi @sebastian_gonza,
Can you check your XML file : It seems to be broken (it can not be loaded in RapidMiner)
Regards,
Lionel
<?xml version="1.0" encoding="UTF-8"?><process version="9.0.002">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="9.0.002" expanded="true" name="Process">
<process expanded="true">
<operator activated="true" class="retrieve" compatibility="9.0.002" expanded="true" height="68" name="Retrieve pedidos_con_cliente_importe" width="90" x="45" y="340">
<parameter key="repository_entry" value="pedidos_con_cliente_importe"/>
</operator>
<operator activated="true" class="select_attributes" compatibility="9.0.002" expanded="true" height="82" name="Select Attributes (5)" width="90" x="179" y="340">
<parameter key="attribute_filter_type" value="subset"/>
<parameter key="attributes" value="Cantidad|IdCliente|IdPedido|Importe|Precio calculado"/>
</operator>
<operator activated="true" class="set_role" compatibility="9.0.002" expanded="true" height="82" name="Set Role" width="90" x="313" y="340">
<parameter key="attribute_name" value="Cantidad"/>
<parameter key="target_role" value="label"/>
<list key="set_additional_roles"/>
</operator>
<operator activated="true" class="remove_duplicates" compatibility="9.0.002" expanded="true" height="103" name="Remove Duplicates" width="90" x="447" y="340">
<parameter key="attribute_filter_type" value="subset"/>
<parameter key="attributes" value="IdCliente|IdPedido|Importe|Cantidad"/>
</operator>
<operator activated="true" class="concurrency:loop_values" compatibility="9.0.002" expanded="true" height="82" name="Loop Values" width="90" x="581" y="340">
<parameter key="attribute" value="IdCliente"/>
<process expanded="true">
<operator activated="true" class="select_attributes" compatibility="9.0.002" expanded="true" height="82" name="Select Attributes (6)" width="90" x="112" y="34">
<parameter key="attribute_filter_type" value="subset"/>
<parameter key="attributes" value="Cantidad|Precio calculado"/>
</operator>
<operator activated="true" class="linear_regression" compatibility="9.0.002" expanded="true" height="103" name="Linear Regression" width="90" x="246" y="34">
<parameter key="eliminate_colinear_features" value="false"/>
<parameter key="use_bias" value="false"/>
</operator>
<connect from_port="input 1" to_op="Select Attributes (6)" to_port="example set input"/>
<connect from_op="Select Attributes (6)" from_port="example set output" to_op="Linear Regression" to_port="training set"/>
<connect from_op="Linear Regression" from_port="model" to_port="output 1"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="source_input 2" spacing="0"/>
<portSpacing port="sink_output 1" spacing="0"/>
<portSpacing port="sink_output 2" spacing="0"/>
</process>
</operator>
<operator activated="true" class="collect" compatibility="9.0.002" expanded="true" height="82" name="Collect" width="90" x="715" y="340"/>
<connect from_op="Retrieve pedidos_con_cliente_importe" from_port="output" to_op="Select Attributes (5)" to_port="example set input"/>
<connect from_op="Select Attributes (5)" from_port="example set output" to_op="Set Role" to_port="example set input"/>
<connect from_op="Set Role" from_port="example set output" to_op="Remove Duplicates" to_port="example set input"/>
<connect from_op="Remove Duplicates" from_port="example set output" to_op="Loop Values" to_port="input 1"/>
<connect from_op="Loop Values" from_port="output 1" to_op="Collect" to_port="input 1"/>
<connect from_op="Collect" from_port="collection" 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>
Thank you Martin
Sorry one last thing, I tried using "Append" operator to join all the model results in a table but it only allows a table to be joined, also I cant append the IDclient to each model, could you help me please?
Thank you
Hi,
i think Annotate is the way to go here.
BR,
Martin
Dortmund, Germany
Sorry, I could not ad the IdCliente to each model with annotate, I set the parameters
Annotation name = Comment
Annotation value = IdCliente
But no specific model has the IdClient append to the IOObject
Should it be another annotation name?