"filter examples having values from an interval"

Unknown
edited November 5 in Community Q&A
HI there

how (if possible) can I filter only examples taht take on values from an interval?
e.g. att1=[1...9]

in the Filter examples>attribute_value_filter  I managed to do only this e.g. att1=5  but not an interval......
???

Answers

  • Marco_Boeck
    Marco_Boeck New Altair Community Member
    Hi,

    you can use this process:

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.1.008">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="5.1.008" expanded="true" name="Process">
        <process expanded="true" height="649" width="950">
          <operator activated="true" class="retrieve" compatibility="5.1.008" expanded="true" height="60" name="Retrieve" width="90" x="45" y="30">
            <parameter key="repository_entry" value="//LocalRepository/Processes/Forum/Data/FilterInterval"/>
          </operator>
          <operator activated="true" class="generate_attributes" compatibility="5.1.008" expanded="true" height="76" name="Generate Attributes" width="90" x="179" y="30">
            <list key="function_descriptions">
              <parameter key="to_remove" value="if (Test&lt;1 || Test&gt;4, true, false)"/>
            </list>
          </operator>
          <operator activated="true" class="filter_examples" compatibility="5.1.008" expanded="true" height="76" name="Filter Examples" width="90" x="313" y="30">
            <parameter key="condition_class" value="attribute_value_filter"/>
            <parameter key="parameter_string" value="to_remove=false"/>
          </operator>
          <operator activated="true" class="select_attributes" compatibility="5.1.008" expanded="true" height="76" name="Select Attributes" width="90" x="447" y="30">
            <parameter key="attribute_filter_type" value="single"/>
            <parameter key="attribute" value="to_remove"/>
            <parameter key="invert_selection" value="true"/>
          </operator>
          <connect from_op="Retrieve" from_port="output" to_op="Generate Attributes" to_port="example set input"/>
          <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_op="Select Attributes" to_port="example set input"/>
          <connect from_op="Select Attributes" 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"/>
        </process>
      </operator>
    </process>
    You just need to specify the range in the Generate Attribute operator, rename the column from "Test" to whatever you need and you're good to go :)

    Regards,
    Marco
  • thank you Marco,

    it works, BUT I had to convert nominal label of interest into numerical and after filtering back into nominal. This is really clumsy way to do something like value range
    selection. :-\

    Hope this will be implemented as part of a single operator e.g. filter examples including nominal list filtering or perl like script selection.
    cheers
  • Marco_Boeck
    Marco_Boeck New Altair Community Member
    Hi,

    well it's always helpful to have a numerical value if you want to do range filtering ;)
    If you don't like the above process, you can do the same thing with the Execute Script operator, you will just need to write your own groovy script.

    Regards,
    Marco
  • groovy!  ;D