Numerical2Binominal converts to nominal and not to binominal

radone
radone New Altair Community Member
edited November 5 in Community Q&A
Hello,
I have an attribute with values -1 and 1 and I need to convert it to binominal value type.  Unfortunatelly, the Numerical2Binominal converts the value type not to binominal, but to nominal. When I use additional "Nominal2Binominal" to fix this (as shown below) the attribute is split to two separate attributes.

Is there any elegant way how to convert integer values [-1,1] to binominal?

Any help would be really appreciated.
Thanks in advance.
<operator name="Profit" class="AttributeSubsetPreprocessing" expanded="yes">
        <parameter key="condition_class" value="attribute_name_filter"/>
        <parameter key="attribute_name_regex" value="PROFIT"/>
        <operator name="Numerical2Binominal (3)" class="Numerical2Binominal">
            <parameter key="min" value="-2.0"/>
        </operator>
        <operator name="Nominal2Binominal" class="Nominal2Binominal" breakpoints="after">
        </operator>
    </operator>
RESULT
id	ID	integer	avg = 1395 +/- 782.598	[40.000 ; 2,750.000]	0.0
regular PROFIT = true binominal mode = true (1387), least = false (1324) false (1324), true (1387) 0.0
regular PROFIT = false binominal mode = false (1387), least = true (1324) false (1387), true (1324) 0.0

Answers

  • steffen
    steffen New Altair Community Member
    Hello Radone

    A nominal attribute with two unique values only is binominal. So this is not a bug. See for example the process below. Compare the transformed exampleset to the golfset whose label is clearly binominal.

    @rapidminer-team
    But I guess there is another bug / missing feature:
    Although Numerical2Binominal requires the specification which parameters shall be mapped to false, the mapping itself does not reflect this regarding the positive or negative class (see also example below).  

    @radone
    Simply add the operator "InternalBinominalRemapping" as workaround.

    regards,

    Steffen

    <operator name="Root" class="Process" expanded="yes">
       <operator name="load_golf" class="ExampleSource">
           <parameter key="attributes" value="rm_workspace\sample\data\golf.aml"/>
       </operator>
       <operator name="ExampleSetGenerator" class="ExampleSetGenerator">
           <parameter key="target_function" value="random"/>
           <parameter key="number_of_attributes" value="1"/>
           <parameter key="attributes_lower_bound" value="-1.0"/>
           <parameter key="attributes_upper_bound" value="1.0"/>
       </operator>
       <operator name="remove_label" class="FeatureNameFilter">
           <parameter key="filter_special_features" value="true"/>
           <parameter key="skip_features_with_name" value="label"/>
       </operator>
       <operator name="AttributeConstruction" class="AttributeConstruction">
           <list key="function_descriptions">
             <parameter key="attr1" value="if(att1 &lt;0, -1,1)"/>
           </list>
           <parameter key="keep_all" value="false"/>
       </operator>
       <operator name="Numerical2Binominal" class="Numerical2Binominal">
           <parameter key="min" value="-1.0"/>
           <parameter key="max" value="-1.0"/>
       </operator>
    </operator>
  • fischer
    fischer New Altair Community Member
    Thanks to both of you for pointing this out.

    I changed Numerical2Binominal so it actually creates binominal attributes.

    Regarding the true/false mapping: Don't confuse true/false (which are just strings) with positive/negative classes that are relevant, e.g., for the computation of precision etc. Nevertheless, I have modified the operator such that now, false is always negative and true is always positive.

    Both changes will be in bugfix-releases of the 4.5 series as well as in 5.0.

    Best,
    Simon