finding minimum/maximum value of the attribute

aekster
aekster New Altair Community Member
edited November 5 in Community Q&A
After the model is generated and operator "apply model" is used which operators to use to determine minimum or maximum of one attribute under constrained conditions of other attributes.
Tagged:

Answers

  • DavidRaju
    DavidRaju New Altair Community Member
    I think, you can save and use the meta data( in results window) which contains the min and max for numeric attributes. , if i found i will let you know

    David
  • aekster
    aekster New Altair Community Member
    Thank you, David
    I am not sure that I understand your idea.

    I am just trying to use the model developed by the rapidminer for optimization. For example, if one attribute is cost, then I am trying to find a combination of values of other attributes at which cost will be minimal. I am surprised that the rapidminer does not an operator for that. Or maybe it does but I just do not know it.
  • MariusHelf
    MariusHelf New Altair Community Member
    Hi,

    can you please post a small sample of your data, and your process setup?

    Best regards,
    Marius
  • d_hofmann84
    d_hofmann84 New Altair Community Member
    Hi,

    I have a simular task. I calculated weights for all values of 5 different attributes (polynomial) with a linear regression. No I like to generate the top value combinations based on the generated weights. E.G.

    ID COMBINATION                                                                                                                      SCORE
    1. attribute1Value3, attribute2Value1, attribute3Value2, attribute4Value5, attribute5Value2    SUM(Weights)
    2. attribute1Value2, attribute2Value2, attribute3Value2, attribute4Value5, attribute5Value2    SUM(Weights)

    Right now I try to do it with Loop Value, LoopAttributeSubset and Log Operator, but have still no real solution.

    I really appreciate every help.
  • d_hofmann84
    d_hofmann84 New Altair Community Member
    I found a way to do it by using the Loop Value Operator, DataMacroDefinition Operator and Append Operator. This Example used 3 different nominal variables, which are transformed with the Nominal to Numeric operator.
    A List of all Value Combinations inbetween the 3 variables is generated and there respective calculated weights. Maybe there is a easier and faster way to do this.

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.3.013">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="5.3.013" expanded="true" name="Process">
        <process expanded="true">
          <operator activated="true" class="read_excel" compatibility="5.3.013" expanded="true" height="60" name="Read Excel" width="90" x="45" y="75">
            <list key="annotations"/>
            <list key="data_set_meta_data_information"/>
          </operator>
          <operator activated="true" class="replace" compatibility="5.3.013" expanded="true" height="76" name="Replace" width="90" x="179" y="75">
            <parameter key="attribute_filter_type" value="single"/>
            <parameter key="attribute" value="Sender"/>
            <parameter key="value_type" value="polynominal"/>
            <parameter key="replace_what" value="SAT..*1"/>
            <parameter key="replace_by" value="Sat.1"/>
          </operator>
          <operator activated="true" breakpoints="after" class="nominal_to_numerical" compatibility="5.3.013" expanded="true" height="94" name="Nominal to Numerical" width="90" x="313" y="75">
            <parameter key="attribute_filter_type" value="subset"/>
            <parameter key="attributes" value="Sender|Wochentag|Zeitschiene|Motiv|Genre"/>
            <list key="comparison_groups"/>
          </operator>
          <operator activated="true" class="linear_regression" compatibility="5.3.013" expanded="true" height="94" name="Linear Regression" width="90" x="447" y="75"/>
          <operator activated="true" class="weights_to_data" compatibility="5.3.013" expanded="true" height="60" name="Weights to Data" width="90" x="581" y="75"/>
          <operator activated="true" class="generate_attributes" compatibility="5.3.013" expanded="true" height="76" name="Generate Attributes (2)" width="90" x="45" y="345">
            <list key="function_descriptions">
              <parameter key="Variable" value="cut(Attribute, 0, (index(Attribute,&quot;=&quot;)-1))"/>
            </list>
          </operator>
          <operator activated="true" breakpoints="after" class="write_excel" compatibility="5.3.013" expanded="true" height="76" name="Write Excel" width="90" x="179" y="345">
            <parameter key="excel_file" value="D:\Users\Weights.xls"/>
          </operator>
          <operator activated="true" class="filter_examples" compatibility="5.3.013" expanded="true" height="76" name="Filter Examples (3)" width="90" x="313" y="345">
            <parameter key="condition_class" value="attribute_value_filter"/>
            <parameter key="parameter_string" value="Variable=Sender"/>
          </operator>
          <operator activated="true" class="extract_macro" compatibility="5.3.013" expanded="true" height="60" name="DataMacroDefinition" width="90" x="447" y="345">
            <parameter key="macro" value="weight0"/>
            <parameter key="macro_type" value="data_value"/>
            <parameter key="attribute_name" value="Weight"/>
            <parameter key="example_index" value="1"/>
            <list key="additional_macros"/>
          </operator>
          <operator activated="true" class="loop_values" compatibility="5.3.013" expanded="true" height="76" name="Loop Values" width="90" x="581" y="345">
            <parameter key="attribute" value="Attribute"/>
            <process expanded="true">
              <operator activated="true" class="read_excel" compatibility="5.3.013" expanded="true" height="60" name="Read Excel (2)" width="90" x="45" y="30">
                <parameter key="excel_file" value="D:\Users\Weights.xls"/>
                <parameter key="imported_cell_range" value="A1:C52"/>
                <parameter key="first_row_as_names" value="false"/>
                <list key="annotations">
                  <parameter key="0" value="Name"/>
                </list>
                <list key="data_set_meta_data_information">
                  <parameter key="0" value="Attribute.true.polynominal.attribute"/>
                  <parameter key="1" value="Weight.true.numeric.attribute"/>
                  <parameter key="2" value="Variable.true.polynominal.attribute"/>
                </list>
              </operator>
              <operator activated="true" class="filter_examples" compatibility="5.3.013" expanded="true" height="76" name="Filter Examples (4)" width="90" x="179" y="30">
                <parameter key="condition_class" value="attribute_value_filter"/>
                <parameter key="parameter_string" value="Variable=Wochentag"/>
              </operator>
              <operator activated="true" class="extract_macro" compatibility="5.3.013" expanded="true" height="60" name="DataMacroDefinition (2)" width="90" x="380" y="30">
                <parameter key="macro" value="weight1"/>
                <parameter key="macro_type" value="data_value"/>
                <parameter key="attribute_name" value="Weight"/>
                <parameter key="example_index" value="1"/>
                <list key="additional_macros"/>
              </operator>
              <operator activated="true" class="loop_values" compatibility="5.3.013" expanded="true" height="76" name="Loop Value" width="90" x="514" y="30">
                <parameter key="attribute" value="Attribute"/>
                <parameter key="iteration_macro" value="loop_value1"/>
                <process expanded="true">
                  <operator activated="true" class="read_excel" compatibility="5.3.013" expanded="true" height="60" name="Read Excel (6)" width="90" x="246" y="30">
                    <parameter key="excel_file" value="D:\Users\Weights.xls"/>
                    <parameter key="imported_cell_range" value="A1:C52"/>
                    <parameter key="first_row_as_names" value="false"/>
                    <list key="annotations">
                      <parameter key="0" value="Name"/>
                    </list>
                    <list key="data_set_meta_data_information">
                      <parameter key="0" value="Attribute.true.polynominal.attribute"/>
                      <parameter key="1" value="Weight.true.numeric.attribute"/>
                      <parameter key="2" value="Variable.true.polynominal.attribute"/>
                    </list>
                  </operator>
                  <operator activated="true" class="filter_examples" compatibility="5.3.013" expanded="true" height="76" name="Filter Examples (7)" width="90" x="447" y="30">
                    <parameter key="condition_class" value="attribute_value_filter"/>
                    <parameter key="parameter_string" value="Variable=Motiv"/>
                  </operator>
                  <operator activated="true" class="generate_attributes" compatibility="5.3.013" expanded="true" height="76" name="Generate Attributes (3)" width="90" x="648" y="30">
                    <list key="function_descriptions">
                      <parameter key="Kombination1" value="&quot;%{loop_value}&quot;"/>
                      <parameter key="Kombination2" value="&quot;%{loop_value1}&quot;"/>
                      <parameter key="Kombination5" value="Attribute"/>
                      <parameter key="SumWeight" value="%{weight0}+%{weight1}+Weight"/>
                    </list>
                  </operator>
                  <connect from_op="Read Excel (6)" from_port="output" to_op="Filter Examples (7)" to_port="example set input"/>
                  <connect from_op="Filter Examples (7)" from_port="example set output" to_op="Generate Attributes (3)" to_port="example set input"/>
                  <connect from_op="Generate Attributes (3)" from_port="example set output" 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>
              <operator activated="true" class="append" compatibility="5.3.013" expanded="true" height="76" name="Append" width="90" x="715" y="30"/>
              <connect from_op="Read Excel (2)" from_port="output" to_op="Filter Examples (4)" to_port="example set input"/>
              <connect from_op="Filter Examples (4)" from_port="example set output" to_op="DataMacroDefinition (2)" to_port="example set"/>
              <connect from_op="DataMacroDefinition (2)" from_port="example set" to_op="Loop Value" to_port="example set"/>
              <connect from_op="Loop Value" from_port="out 1" to_op="Append" to_port="example set 1"/>
              <connect from_op="Append" from_port="merged set" 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>
          <operator activated="true" class="append" compatibility="5.3.013" expanded="true" height="76" name="Append (2)" width="90" x="715" y="345"/>
          <connect from_op="Read Excel" from_port="output" to_op="Replace" to_port="example set input"/>
          <connect from_op="Replace" from_port="example set output" to_op="Nominal to Numerical" to_port="example set input"/>
          <connect from_op="Nominal to Numerical" from_port="example set output" to_op="Linear Regression" to_port="training set"/>
          <connect from_op="Linear Regression" from_port="weights" to_op="Weights to Data" to_port="attribute weights"/>
          <connect from_op="Weights to Data" from_port="example set" to_op="Generate Attributes (2)" to_port="example set input"/>
          <connect from_op="Generate Attributes (2)" from_port="example set output" to_op="Write Excel" to_port="input"/>
          <connect from_op="Write Excel" from_port="through" to_op="Filter Examples (3)" to_port="example set input"/>
          <connect from_op="Filter Examples (3)" from_port="example set output" to_op="DataMacroDefinition" to_port="example set"/>
          <connect from_op="DataMacroDefinition" from_port="example set" to_op="Loop Values" to_port="example set"/>
          <connect from_op="Loop Values" from_port="out 1" to_op="Append (2)" to_port="example set 1"/>
          <connect from_op="Append (2)" from_port="merged set" 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>