Options

Automatically apply learned classifier

Legacy UserLegacy User Member Posts: 0 Newbie
edited November 2018 in Help
Hi,

I've generated a classifier based on the learner decision trees and would
like to use this learned model for future examples to predict their classes.

How can this be accomplished? My future examples are generated by
another application that writes them into a CSV file which was also
used as IO module during the learning phase. Now, I'm wondering how
this new example can be passed to RapidMiner which automatically
applies the learned model on that example and somehow outputs the
predicted class which I could further use in another application.

Generating the example, invoking RapidMiner's JAR file and reading
the predicted class from a file should be not a problem. But I don't
know how to apply the model to the read example and how to dump
the predicted class.

Any ideas?

Regards,
Martin

Answers

  • Options
    steffensteffen Member Posts: 347 Maven
    Hello

    I am afraid I got you wrong...
    Generating the example, invoking RapidMiner's JAR file and reading
    the predicted class from a file should be not a problem. But I don't
    know how to apply the model to the read example and how to dump
    the predicted class.
    Run a process like this one (e.g. using rapidminer without gui):
    <operator name="Root" class="Process" expanded="yes">
        <operator name="read_new_data" class="SimpleExampleSource">
        </operator>
        <operator name="load_model" class="ModelLoader">
        </operator>
        <operator name="apply_model" class="ModelApplier">
            <list key="application_parameters">
            </list>
        </operator>
        <operator name="skip_everything_but_id_prediction" class="FeatureNameFilter">
            <parameter key="except_features_with_name" value="id||prediction.*"/>
            <parameter key="filter_special_features" value="true"/>
            <parameter key="skip_features_with_name" value=".*"/>
        </operator>
        <operator name="write_results" class="CSVExampleSetWriter">
        </operator>
    </operator>
    ...assuming that you have saved the created model before...

    hope this was helpful,

    Steffen
  • Options
    Legacy UserLegacy User Member Posts: 0 Newbie
    Hi,

    yes, this was exactly what I was looking for. :-)
    After some slight modifications, the classification
    of new examples works fine.

    One more questions on that. Currently, I'm using the
    script "rapidminer" from the scripts directory by invoking
    it with "sh scripts/rapidminer/mymodel.xml". Most of the
    time is spent for "Loading operators from 'operators.xml'.",
    about 8 seconds for the model you have posted previously
    on a Pentium4 2,66GHz. Can the application of the rapdiminer
    model be somehow accelerated? Maybe rapidminer and its
    operators can remain in memory when a classification must
    be done multiple times.

    And is this the typical way of using a previously learned rapdiminer
    models by invoking the script with a process file and generate
    an output in a file? Or can rapidminer be used more efficiently
    in a framework where most modules are written in C++?

    Regards,
    Martin

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

    And is this the typical way of using a previously learned rapdiminer
    models by invoking the script with a process file and generate
    an output in a file? Or can rapidminer be used more efficiently
    in a framework where most modules are written in C++?
    Invoking the script is ok but as you have mentioned it takes a lot init time. You can strip the file "operators.xml" down to an absolute minimum amount (keep only the operators of your apply process as entries in this file) and you will notice a big speed up.

    Another alternative would be to invoke Java from C++ and call the RapidMiner.init() method once (taking all the time) and then just run the process from an API call - this is described in detail in the last chapter of the RapidMiner tutorial. This should also be much faster.

    Cheers,
    Ingo
  • Options
    Legacy UserLegacy User Member Posts: 0 Newbie
    Which file exactly should be modified? I've removed a large number of
    entries in operators.xml in directory resources but could not see
    any speedup. Also the removed operators were still available in
    the GUI in "New Operator". I can even remove operators.xml completely
    and RapidMiner still works fine. So, do I modify the right file?
  • Options
    TobiasMalbrechtTobiasMalbrecht Moderator, Employee, Member Posts: 295 RM Product Management
    Hi Martin,

    you might have to run ant with target "copy-ressources" so that your changes to the operator.xml will take effect.

    Regards,
    Tobias
Sign In or Register to comment.