Fileiterator

pop
pop New Altair Community Member
edited November 5 in Community Q&A
Dear all,

I have a set of examples made of several arff file in a directory. I would like to load all those files. I have found the “FileIterator” Meta Operator but didn’t manage to have it work. Does anyone has examples of how to use it or how to do this kind of tasks?
Thank you
Tagged:

Answers

  • land
    land New Altair Community Member
    Hi,
    here it comes how it works. It's a little bit tricky, because you have to use some "dirty" operators like the ExceptionHandling, but nevertheless, it's quite easy if you know how to do it:
    <operator name="Root" class="Process" expanded="yes">
        <operator name="FileIterator" class="FileIterator" expanded="yes">
            <parameter key="directory" value="C:\Test"/>
            <parameter key="filter" value=".*arff"/>
            <operator name="ExceptionHandling" class="ExceptionHandling" expanded="yes">
                <operator name="IORetriever" class="IORetriever">
                    <parameter key="name" value="ES"/>
                    <parameter key="io_object" value="ExampleSet"/>
                </operator>
            </operator>
            <operator name="ArffExampleSource" class="ArffExampleSource">
                <parameter key="data_file" value="%{file_path}"/>
            </operator>
            <operator name="ExampleSetMerge" class="ExampleSetMerge">
            </operator>
            <operator name="IOStorer" class="IOStorer">
                <parameter key="name" value="ES"/>
                <parameter key="io_object" value="ExampleSet"/>
            </operator>
        </operator>
        <operator name="IORetriever (2)" class="IORetriever">
            <parameter key="name" value="ES"/>
            <parameter key="io_object" value="ExampleSet"/>
        </operator>
    </operator>
    And I assume, with RapidMiner 5.0 it will be much easier...

    Greetings,
      Sebastian
  • pop
    pop New Altair Community Member
    Thank you very much Sebastian, this is brilliant!!