Comparing results of two classificators

Ola
Ola New Altair Community Member
edited November 5 in Community Q&A
I'm just beginning to use RM and find that I like it a lot.

Most of the time I use mining for classification. How do I run, say a Logistic Regression and an SVM on the same dataset and compare the results? I know there is an ROCComparator, but what would the chain need to look like?
Tagged:

Answers

  • haddock
    haddock New Altair Community Member
    HI, and welcome to the RapidMiner refuge!

    The answer to your question is like this ....
    <operator name="Root" class="Process" expanded="yes">
        <parameter key="logverbosity" value="warning"/>
        <parameter key="random_seed" value="2000"/>
        <operator name="ExampleSetGenerator" class="ExampleSetGenerator">
            <parameter key="target_function" value="random dots classification"/>
            <parameter key="number_examples" value="500"/>
            <parameter key="number_of_attributes" value="2"/>
            <parameter key="attributes_lower_bound" value="0.0"/>
            <parameter key="attributes_upper_bound" value="25.0"/>
        </operator>
        <operator name="ROCComparator" class="ROCComparator" expanded="yes">
            <operator name="LibSVMLearner" class="LibSVMLearner">
                <parameter key="gamma" value="1.0"/>
                <list key="class_weights">
                </list>
            </operator>
            <operator name="LinearRegression" class="LinearRegression">
            </operator>
        </operator>
    </operator>
    Pretty handy, so thanks for bringing it to our attention.

  • Ola
    Ola New Altair Community Member
    Thanks, that was brilliant.

    Now I just need to combine this with cross validation and I'm set to go. Any thoughts on that?  :)
  • haddock
    haddock New Altair Community Member
    Hi again,

    Here's some code to do that sort of stuff....
    <operator name="Root" class="Process" expanded="yes">
        <parameter key="logverbosity" value="warning"/>
        <parameter key="random_seed" value="2000"/>
        <operator name="ExampleSetGenerator" class="ExampleSetGenerator">
            <parameter key="target_function" value="random dots classification"/>
            <parameter key="number_examples" value="500"/>
            <parameter key="number_of_attributes" value="2"/>
            <parameter key="attributes_lower_bound" value="0.0"/>
            <parameter key="attributes_upper_bound" value="25.0"/>
        </operator>
        <operator name="XValidation" class="XValidation" expanded="no">
            <parameter key="keep_example_set" value="true"/>
            <parameter key="create_complete_model" value="true"/>
            <parameter key="sampling_type" value="shuffled sampling"/>
            <operator name="LibSVMLearner" class="LibSVMLearner">
                <parameter key="keep_example_set" value="true"/>
                <parameter key="gamma" value="1.0"/>
                <list key="class_weights">
                </list>
            </operator>
            <operator name="OperatorChain" class="OperatorChain" expanded="yes">
                <operator name="ModelApplier" class="ModelApplier">
                    <list key="application_parameters">
                    </list>
                </operator>
                <operator name="Performance" class="Performance">
                </operator>
            </operator>
        </operator>
        <operator name="ModelWriter" class="ModelWriter">
            <parameter key="model_file" value="SVM"/>
        </operator>
        <operator name="XValidation (2)" class="XValidation" expanded="no">
            <parameter key="keep_example_set" value="true"/>
            <parameter key="create_complete_model" value="true"/>
            <parameter key="sampling_type" value="shuffled sampling"/>
            <operator name="LinearRegression" class="LinearRegression">
            </operator>
            <operator name="OperatorChain (2)" class="OperatorChain" expanded="yes">
                <operator name="ModelApplier (2)" class="ModelApplier">
                    <list key="application_parameters">
                    </list>
                </operator>
                <operator name="Performance (2)" class="Performance">
                </operator>
            </operator>
        </operator>
        <operator name="ModelWriter (2)" class="ModelWriter">
            <parameter key="model_file" value="LR"/>
        </operator>
        <operator name="ROCComparator" class="ROCComparator" expanded="yes">
            <operator name="SVM" class="ModelLoader">
                <parameter key="model_file" value="SVM"/>
            </operator>
            <operator name="LR" class="ModelLoader">
                <parameter key="model_file" value="LR"/>
            </operator>
        </operator>
    </operator>

    I've just bashed this together rather swiftly ( a big plus for RM ), and wiser heads than mine can do it much better, but you get the idea.

    Have fun improving it!


  • Ola
    Ola New Altair Community Member
    Thank you! Very helpful.  :)