Converting numerical label to binomial ??

Axel
Axel New Altair Community Member
edited November 5 in Community Q&A
Hello everybody,

I'm just getting into RapidMiner and have a question about the label type of examples.
Some learners need nominal labels, but my data file has +1 & -1, which is recognized by CVSExampleSource as numerical.
I tried Numerical2Binomial, but that converts all attributs and not only my label attribute.
Finally, I used the AttributeDescriptionFileWizard to specify the type of my label attribute.

That works, but  I wonder if I could also solve this problem using an operator ??

Many thanks,

Axel

Answers

  • haddock
    haddock New Altair Community Member
    Hola!

    The BinDiscretization operator does the trick, like this...
    <operator name="Root" class="Process" expanded="yes">
        <operator name="ExampleSetGenerator" class="ExampleSetGenerator">
            <parameter key="target_function" value="random"/>
        </operator>
        <operator name="ChangeAttributeRole" class="ChangeAttributeRole">
            <parameter key="name" value="att1"/>
            <parameter key="target_role" value="label"/>
        </operator>
        <operator name="AttributeSubsetPreprocessing" class="AttributeSubsetPreprocessing" expanded="yes">
            <parameter key="condition_class" value="attribute_name_filter"/>
            <parameter key="attribute_name_regex" value="att1"/>
            <parameter key="process_special_attributes" value="true"/>
            <operator name="BinDiscretization" class="BinDiscretization">
                <parameter key="range_name_type" value="short"/>
            </operator>
        </operator>
    </operator>
  • Axel
    Axel New Altair Community Member
    Ah yes.
    Many thanks.

    Axel
  • keith
    keith New Altair Community Member
    Some learners need nominal labels, but my data file has +1 & -1, which is recognized by CVSExampleSource as numerical.
    I tried Numerical2Binomial, but that converts all attributs and not only my label attribute.
    Just to clarify, you could use either Numerical2Binominal or BinDiscretization to accomplish the task. 

    The stated problem that all attributes were converted rather than just the label was addressed by using the AttributeSubsetPreprocessing operator in haddock's process.  It allows you to select just the attributes you want to convert, and leaves the others intact. 

    You could swap the BinDiscretization operator for a Numerical2Binominal operator inside AttributeSubsetPreprocessing and end up with a very similar result in this particular example.