Options

Converting numerical label to binomial ??

AxelAxel Member Posts: 19 Maven
edited September 2019 in Help
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
Tagged:

Answers

  • Options
    haddockhaddock Member Posts: 849 Maven
    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>
  • Options
    AxelAxel Member Posts: 19 Maven
    Ah yes.
    Many thanks.

    Axel
  • Options
    keithkeith Member Posts: 157 Maven
    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.
Sign In or Register to comment.