Using "Loop cluster" operator.
shoonya
New Altair Community Member
Use case is,
Example set:
id, field1, field2, ... fieldn, xx
now, I need to cluster example set based on xx and then do linear regression on field1 .. fieldn (field1 being label) with each cluster having it's separate model.
Not getting how to use loop operator.
Tried adding regression operator inside it and "Collect" operator to collect all the outcomes, but not able to see different models for each cluster
Any link/example about how to use this loop cluster operator will be helpful.
- Shoonya
Example set:
id, field1, field2, ... fieldn, xx
now, I need to cluster example set based on xx and then do linear regression on field1 .. fieldn (field1 being label) with each cluster having it's separate model.
Not getting how to use loop operator.
Tried adding regression operator inside it and "Collect" operator to collect all the outcomes, but not able to see different models for each cluster
Any link/example about how to use this loop cluster operator will be helpful.
- Shoonya
Tagged:
0
Answers
-
Hi, for the looping you could also use Loop Values in combination with Filter Examples. Please have a look at the attached process. The loop operator outputs a collection of regression models. To access one of them, you can use Select.
Best, Marius<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.2.003">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="5.2.003" expanded="true" name="Process">
<process expanded="true" height="482" width="950">
<operator activated="true" class="generate_data" compatibility="5.2.003" expanded="true" height="60" name="Generate Data" width="90" x="45" y="30"/>
<operator activated="true" class="k_means" compatibility="5.2.003" expanded="true" height="76" name="Clustering" width="90" x="179" y="30"/>
<operator activated="true" class="loop_values" compatibility="5.2.003" expanded="true" height="76" name="Loop Values" width="90" x="380" y="30">
<parameter key="attribute" value="cluster"/>
<parameter key="iteration_macro" value="cluster"/>
<process expanded="true" height="500" width="950">
<operator activated="true" class="filter_examples" compatibility="5.2.003" expanded="true" height="76" name="Filter Examples" width="90" x="45" y="30">
<parameter key="condition_class" value="attribute_value_filter"/>
<parameter key="parameter_string" value="cluster = %{cluster}"/>
</operator>
<operator activated="true" class="linear_regression" compatibility="5.2.003" expanded="true" height="94" name="Linear Regression (2)" width="90" x="246" y="30"/>
<connect from_port="example set" to_op="Filter Examples" to_port="example set input"/>
<connect from_op="Filter Examples" 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="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" from_port="output" to_op="Clustering" to_port="example set"/>
<connect from_op="Clustering" from_port="clustered set" to_op="Loop Values" to_port="example set"/>
<connect from_op="Loop Values" from_port="out 1" 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