[SOLVED] W-BayesNet

Marc
Marc New Altair Community Member
edited November 5 in Community Q&A
Hello dear members
I would like to ask you some question.
I try to integrate rapidminer as a library in my java application and in my process I use W-BayesNet operator for learning. When I run my application, I get a message: "The dummy operator W-BayesNet replacing W-BayesNet cannot be executed". Because I don't want to use rapidminer executable, Can I use this operator without installing weka plugin (use only its library or something like that)? Where Can I find something about its use?
I will be gratefull for the answer

Answers

  • Marco_Boeck
    Marco_Boeck New Altair Community Member
    Hi,

    if you want to use weka operators in your application, you will need to add the weka extension to your libraries just as you added RapidMiner to your libraries.

    Regards,
    Marco
  • Marc
    Marc New Altair Community Member
    Hello Marco
    thank for your answer. Somewhere I found a weka-extension.jar and rapidminer-weka-5.0.jar, added them correctly to my library folder, but nothing happened.
    I also tried

    Operator BayesNet = secondSubProcess.getOperator("W-BayesNet");
    BayesNet.execute();
    I got a message: "Process stopped at W-BayesNet"
    XML of process of this operator:

    <?xml version="1.0"encoding="UTF-8" standalone="no">
    <process version="5.2.000">
    <context>
    <input/>
    <output/>
    <macros/>
    </context>
    <operator activated="true" class="dummy" compatibility="5.2.000" expanded="true" name="W-BayesNet">
    </process>
    What does it mean?  ???
  • Marco_Boeck
    Marco_Boeck New Altair Community Member
    Hi,

    I'm sorry but I really think you should carefully read the forum posts I linked in your various threads and follow the advice there and then look around the forum on your own and find code fragments which are interesting to you - because what you are trying to do here makes no sense I'm afraid. And sadly we don't have the time to give a detailed how to for everyone here in the forums. What we do is sometimes to provide answers to specific questions and you can find many code fragments which you can use and build upon in this development forum.
    Oh and please don't do someting like "oh I found some outdated .jar somewhere and used it!" ;). Check out the RapidMiner sourcecode (which is publically available) and use it to build your own, up to date .jar files for RM and Weka extension via the provided build.xml ant scripts.
    For example, Weka extension sourcecode and RM sourcecode can be found here.

    Regards,
    Marco
  • Marc
    Marc New Altair Community Member
    I understand that you have lot of work so I ask you only one simple question. If Weka extension is integrated in rapidminer5.1(or 5.2) automatically, how can I use it as a library? I try to use rmx_weka-5.1.1.jar (.Rapidminer5/management/) the same way as any other libraries but still get message:"The dummy operator cannot be executed.".
  • Marco_Boeck
    Marco_Boeck New Altair Community Member
    Hi,

    did you call

    RapidMiner.setExecutionMode(ExecutionMode.EMBEDDED_WITHOUT_UI);
    // try ExecutionMode.COMMAND_LINE if that does not work
    RapidMiner.init();
    Regards,
    Marco


    Edit: added comment
  • Marc
    Marc New Altair Community Member
    Yes I did.
    I also called

    System.setProperty("Rapidminer.init.weka","true")
    How did you create a BayesNet operator? I failed with call OperatorService.createOperator(BayesNet.class) when I tried to build this part of process manually.
    I know it must be difficult to advise if you know so few things. Please try once again.
    Thank you
  • Marco_Boeck
    Marco_Boeck New Altair Community Member
    Hi,

    please use the RapidMiner GUI to design your processes (including the WEKA operators) and then just execute the process via java. So no need for OperatorService.createOperator(), I would not advise using that as a beginner at all.
    In regards to not finding the library, try setting the ExecutionMode to COMMAND_LINE instead before calling RapidMiner.init(). I'm not 100% sure myself but otherwise loading plugins might actually be skipped.

    Regards,
    Marco
  • Marc
    Marc New Altair Community Member
    Hello members and readers
    Finally I solved the problem. In my case problem was solved by this way:

    RapidMiner.setExecutionMode(ExecutionMode.EMBEDDED_WITHOUT_UI);
    RapidMiner.init();
          ClassLoader loader= weka.classifiers.bayes.BayesNet.class.getClassLoader();
          WekaOperatorFactory factory = new WekaOperatorFactory();
    File wekaFile = new File(pathToWekaJarFile);
            Plugin plugin = null;
    try{
        plugin = new Plugin(wekaFile); }
    catch (Exception e){
    System.out.Println("error");
    }
    factory.registerOperators(loader, plugin);
    now the process is running  :)