Saving predicted labels

jacoblyles
jacoblyles New Altair Community Member
edited November 5 in Community Q&A
I am using logistic regression with cross validation and I would like to save the predicted label probability and true label for each data point in the set at the end of the process. Is it possible to do this with rapidminer?

Edit: I figured out how to do this by using the XVPrediction operator. My code is below in case anyone runs into the same issue:
<operator name="Root" class="Process" expanded="yes">>
    <operator name="ExampleSource" class="ExampleSource">
        <parameter key="attributes" value="/home/user/rm_workspace/data.aml"/>
    </operator>
    <operator name="XVPrediction" class="XVPrediction" expanded="yes">
        <parameter key="number_of_validations" value="2"/>
        <operator name="LogisticRegression" class="LogisticRegression">
            <parameter key="keep_example_set" value="true"/>
            <parameter key="return_model_performance" value="true"/>
        </operator>
        <operator name="OperatorChain" class="OperatorChain" expanded="yes">
            <operator name="ModelApplier" class="ModelApplier">
                <parameter key="keep_model" value="true"/>
                <list key="application_parameters">
                </list>
            </operator>
        </operator>
    </operator>
    <operator name="ExcelExampleSetWriter" class="ExcelExampleSetWriter">
        <parameter key="excel_file" value="/home/user/rm_workspace/log.xls"/>
    </operator>
        </list>
    </operator>
</operator>
Tagged:

Answers

  • haddock
    haddock New Altair Community Member
    Nay probs, as the model applier adds this stuff to the example set, all you have to do is write the examples out, like this.
    <operator name="Root" class="Process" expanded="yes">
        <operator name="ExampleSetGenerator" class="ExampleSetGenerator">
            <parameter key="target_function" value="polynomial classification"/>
        </operator>
        <operator name="XValidation" class="XValidation" expanded="yes">
            <operator name="KernelLogisticRegression" class="KernelLogisticRegression">
            </operator>
            <operator name="OperatorChain" class="OperatorChain" expanded="yes">
                <operator name="ModelApplier" class="ModelApplier">
                    <list key="application_parameters">
                    </list>
                </operator>
                <operator name="ClassificationPerformance" class="ClassificationPerformance">
                    <parameter key="keep_example_set" value="true"/>
                    <parameter key="accuracy" value="true"/>
                    <list key="class_weights">
                    </list>
                </operator>
                <operator name="ExampleSetWriter" class="ExampleSetWriter">
                    <parameter key="example_set_file" value="bla"/>
                    <parameter key="format" value="special_format"/>
                    <parameter key="special_format" value="$a"/>
                </operator>
            </operator>
        </operator>
    </operator>
    By the way, I couldn't get your code to parse.