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

"loop of a collection of performance vectors"

QingqiuQingqiu Member Posts: 8 Contributor II
edited May 2019 in Help
Hi,
I got loop problem again,hope someone can help me...
the code is here.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.0">
  <context>
    <input/>
    <output>
      <location>muta_des_weight_outlier1</location>
    </output>
    <macros/>
  </context>
  <operator activated="true" class="process" expanded="true" name="Process">
    <process expanded="true" height="386" width="614">
      <operator activated="true" class="loop" expanded="true" height="76" name="Loop" width="90" x="48" y="68">
        <parameter key="iterations" value="3"/>
        <process expanded="true" height="451" width="916">
          <operator activated="true" class="generate_data" expanded="true" height="60" name="Generate Data (3)" width="90" x="179" y="120">
            <parameter key="target_function" value="random classification"/>
            <parameter key="attributes_lower_bound" value="1.0"/>
            <parameter key="attributes_upper_bound" value="5.1"/>
            <parameter key="use_local_random_seed" value="true"/>
            <parameter key="datamanagement" value="int_array"/>
          </operator>
          <operator activated="true" class="numerical_to_polynominal" expanded="true" height="76" name="Numerical to Polynominal (2)" width="90" x="313" y="120">
            <parameter key="attribute_filter_type" value="single"/>
            <parameter key="attribute" value="att1"/>
          </operator>
          <operator activated="true" class="loop_values" expanded="true" height="76" name="Loop Values" width="90" x="447" y="120">
            <parameter key="attribute" value="att1"/>
            <process expanded="true" height="451" width="916">
              <operator activated="true" class="filter_examples" expanded="true" height="76" name="Filter Examples (3)" width="90" x="179" y="120">
                <parameter key="condition_class" value="attribute_value_filter"/>
                <parameter key="parameter_string" value="att1=%{loop_value}"/>
              </operator>
              <operator activated="true" class="generate_data" expanded="true" height="60" name="Generate Data (4)" width="90" x="179" y="30">
                <parameter key="target_function" value="random classification"/>
                <parameter key="attributes_lower_bound" value="1.0"/>
                <parameter key="attributes_upper_bound" value="5.1"/>
                <parameter key="use_local_random_seed" value="true"/>
                <parameter key="datamanagement" value="int_array"/>
              </operator>
              <operator activated="true" class="support_vector_machine_libsvm" expanded="true" height="76" name="SVM (2)" width="90" x="315" y="30">
                <parameter key="svm_type" value="nu-SVC"/>
                <list key="class_weights"/>
              </operator>
              <operator activated="true" class="apply_model" expanded="true" height="76" name="Apply Model (2)" width="90" x="447" y="120">
                <list key="application_parameters"/>
              </operator>
              <operator activated="true" class="performance_binominal_classification" expanded="true" height="76" name="Performance (2)" width="90" x="648" y="120">
                <parameter key="accuracy" value="false"/>
                <parameter key="AUC" value="true"/>
                <parameter key="sensitivity" value="true"/>
                <parameter key="specificity" value="true"/>
              </operator>
              <connect from_port="example set" to_op="Filter Examples (3)" to_port="example set input"/>
              <connect from_op="Filter Examples (3)" from_port="example set output" to_op="Apply Model (2)" to_port="unlabelled data"/>
              <connect from_op="Generate Data (4)" from_port="output" to_op="SVM (2)" to_port="training set"/>
              <connect from_op="SVM (2)" from_port="model" to_op="Apply Model (2)" to_port="model"/>
              <connect from_op="Apply Model (2)" from_port="labelled data" to_op="Performance (2)" to_port="labelled data"/>
              <connect from_op="Performance (2)" from_port="performance" 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 (3)" from_port="output" to_op="Numerical to Polynominal (2)" to_port="example set input"/>
          <connect from_op="Numerical to Polynominal (2)" from_port="example set output" to_op="Loop Values" to_port="example set"/>
          <connect from_op="Loop Values" from_port="out 1" to_port="output 1"/>
          <portSpacing port="source_input 1" spacing="0"/>
          <portSpacing port="sink_output 1" spacing="0"/>
          <portSpacing port="sink_output 2" spacing="0"/>
        </process>
      </operator>
      <connect from_op="Loop" from_port="output 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>
Basically I used "loop value" operator to divide my data set  into 5 subsets according to a specific attribute (integer with value 1 to 5), then constructed a model on each subset and obtained the performance vector for each group.

Now I want to run the whole process for 3 times and I will have results like the following:
IOObjectCollection:
performance vector(loop_value 1)
performance vector(loop_value 2)
performance vector(loop_value 3)
performance vector(loop_value 4)
performance vector(loop_value 5)
IOObjectCollection:
performance vector(loop_value 1)
performance vector(loop_value 2)
performance vector(loop_value 3)
performance vector(loop_value 4)
performance vector(loop_value 5)
IOObjectCollection:
performance vector(loop_value 1)
performance vector(loop_value 2)
performance vector(loop_value 3)
performance vector(loop_value 4)
performance vector(loop_value 5)
================
I want to obtain the average performance vector for the 3 runs for each loop value,how can i achieve that using the existing operators?I tried to use "flatten collection" or "average" but did not work, and cannot find any loop operator to loop over performance vectors with a parameter.

Thank you for any help! :)
Sign In or Register to comment.