Options

deletion of rows

DavidRajuDavidRaju Member Posts: 18 Contributor II
edited November 2018 in Help
Is there any operator - to delete rows in which at least one of the value indicated as ?(question mark) or what is the option to delete the row( not attribute) which contain missing values


David

Answers

  • Options
    Nils_WoehlerNils_Woehler Member Posts: 463 Maven
    HI David,

    unfortunately this is not as easy as it sounds. Here is a process that iterates over all of your attributes and removes examples with missing values.

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.3.005">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="5.3.005" expanded="true" name="Process">
        <process expanded="true">
          <operator activated="true" class="retrieve" compatibility="5.3.005" expanded="true" height="60" name="Retrieve Labor-Negotiations" width="90" x="45" y="30">
            <parameter key="repository_entry" value="//Samples/data/Labor-Negotiations"/>
          </operator>
          <operator activated="true" class="rename_by_replacing" compatibility="5.3.005" expanded="true" height="76" name="Rename by Replacing" width="90" x="180" y="30">
            <parameter key="include_special_attributes" value="true"/>
            <parameter key="replace_what" value="-"/>
            <parameter key="replace_by" value="_"/>
          </operator>
          <operator activated="true" class="loop_attributes" compatibility="5.3.005" expanded="true" height="76" name="Loop Attributes" width="90" x="315" y="30">
            <process expanded="true">
              <operator activated="true" class="generate_attributes" compatibility="5.3.005" expanded="true" height="76" name="Generate Attributes" width="90" x="179" y="30">
                <list key="function_descriptions">
                  <parameter key="missing" value="if(missing(%{loop_attribute}), true, false)"/>
                </list>
              </operator>
              <operator activated="true" class="filter_examples" compatibility="5.3.005" expanded="true" height="76" name="Filter Examples" width="90" x="315" y="30">
                <parameter key="condition_class" value="attribute_value_filter"/>
                <parameter key="parameter_string" value="missing = false"/>
              </operator>
              <operator activated="true" class="select_attributes" compatibility="5.3.005" expanded="true" height="76" name="Select Attributes" width="90" x="447" y="30">
                <parameter key="attribute_filter_type" value="single"/>
                <parameter key="attribute" value="missing"/>
                <parameter key="invert_selection" value="true"/>
              </operator>
              <connect from_port="example set" 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="example set"/>
              <portSpacing port="source_example set" spacing="0"/>
              <portSpacing port="sink_example set" spacing="0"/>
              <portSpacing port="sink_result 1" spacing="0"/>
            </process>
          </operator>
          <connect from_op="Retrieve Labor-Negotiations" from_port="output" to_op="Rename by Replacing" to_port="example set input"/>
          <connect from_op="Rename by Replacing" from_port="example set output" to_op="Loop Attributes" to_port="example set"/>
          <connect from_op="Loop Attributes" from_port="example 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>
    Best,
    Nils
  • Options
    MariusHelfMariusHelf RapidMiner Certified Expert, Member Posts: 1,869 Unicorn
    ...or you use the Filter Examples operator with the no_missing_attributes condition.

    Good luck!
Sign In or Register to comment.