Options

"ModelWriter: XML file"

nicugeorgiannicugeorgian Member Posts: 31 Maven
edited May 2019 in Help
Hi,

Within the training chain of a cross validation process, I have inserted a ModelWriter operator after a learner operator (in my case, W-M5P). The corresponding part of the code looks as follows:

<operator name="XValidation" class="XValidation" expanded="yes">
        <operator name="TrainingChain" class="OperatorChain" expanded="yes">
            <operator name="W-M5P" class="W-M5P">
                <parameter key="M" value="10.0"/>
                <parameter key="R" value="true"/>
                <parameter key="keep_example_set" value="true"/>
            </operator>
            <operator name="ModelWriter" class="ModelWriter">
                <parameter key="model_file" value="model_%{a}.mod"/>
            </operator>
        </operator>
As the cross validation has 10 number_of_validations, the final output consists of 10 file models: model_i.mod, where i = 1,10.

My question is: why I don't get also 10 XML zipped files correspoding to the 10 models? I think that the default value of the parameter output_type of the operator ModelWriter is XML Zipped, right? How can I get the models in the XML (or XML zipped) format?

Thanks,
Geo
Tagged:

Answers

  • Options
    IngoRMIngoRM Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, Community Manager, RMResearcher, Member, University Professor Posts: 1,751 RM Founder
    Hi,

    ahem, I am not sure if I get your point. The created models "model_i.mod" actually are zipped XML files. Just rename them to model_i.zip and you will be able to unzip them.

    Cheers,
    Ingo
  • Options
    nicugeorgiannicugeorgian Member Posts: 31 Maven
    Hi Ingo,

    many thanks for the answer.

    I have renamed the mod files to zip files, but I was not able to unzip them. Anyway, I ran again the process, this time asking the ModelWriter to yield xml files as opposed to zipped xml files. And yes, I was I able to open them as xml files.

    They, however, do not looas as I expected  :) In my case, the learner, W-M5P, yields a regression tree. I was expecting to see only the regression tree in the file returned by ModelWriter. There is, however, a plenty of other information in this model file  :(

    Is there a way to get an xml file with the detail of the regression tree only?

    Thanks,
    Geo
  • Options
    IngoRMIngoRM Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, Community Manager, RMResearcher, Member, University Professor Posts: 1,751 RM Founder
    Hi again,

    the reason why it did not work with the zip files probably is that the files are actually zipped using gzip, so renaming them to "gz" and using a unzipper which is able to unzip them should work.

    Is there a way to get an xml file with the detail of the regression tree only?
    Try a ResultWriter:

    <operator name="Root" class="Process" expanded="yes">
        <operator name="ExampleSetGenerator" class="ExampleSetGenerator">
            <parameter key="target_function" value="sum"/>
        </operator>
        <operator name="BinDiscretization" class="BinDiscretization">
            <parameter key="number_of_bins" value="3"/>
        </operator>
        <operator name="XValidation" class="XValidation" expanded="yes">
            <operator name="OperatorChain (2)" class="OperatorChain" expanded="yes">
                <operator name="W-M5P" class="W-M5P">
                    <parameter key="N" value="true"/>
                </operator>
                <operator name="ResultWriter" class="ResultWriter">
                    <parameter key="result_file" value="model_%{a}.txt"/>
                </operator>
            </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>
    This will produce files with exactly the same output as the text view.

    Cheers,
    Ingo
  • Options
    nicugeorgiannicugeorgian Member Posts: 31 Maven
    mierswa wrote:

    This will produce files with exactly the same output as the text view.
    Yes, it worked :) Thank you!

    I now have to find a way to parse such a file / or to convert it to an XML file.

    Cheers,
    Geo
Sign In or Register to comment.