The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here

How to use RapidMiner process ( Classification Model ) inside my Application

alismartalismart Member Posts: 3 Contributor I
edited November 2018 in Help
Hello,
First of all i read the FAQ and many posts in the forum asking similar questions to mine, but my problem is a bit different

I have designed a process in RapidMiner to Train a Classifier ( SVM ) which will end up with a classification model.
before understanding RapidMiner Philosophy i was thinking that the only way to utilize the Model in my application is to get the ( real-valued weights ) of the mathematical model from somewhere and hard-coding them in my application

my first question here, is previous idea a bad one?

my next question is, i understand that the best practice is to design the process in RapidMiner and then supply its .xml file path from inside my code. BUT , my need is a SVM Classification Model, to which i pass unlabelled vector , and it will return me the predicted label. this is not a parameter to set. i imagine it like this:
svmModel.predict ( [ 1 , 2 , 3 , 4 ] );

i need a help in What to do to end up with the Model being usable from inside my code

thanks in advance :)
Tagged:

Answers

  • Marco_BoeckMarco_Boeck Administrator, Moderator, Employee-RapidMiner, Member, University Professor Posts: 1,996 RM Engineering
    Hi,

    you probably still want to do the process approach. I'm going to outline how it should work for you:

    1. Design the process which takes the input data directly from the top left data input port(s).
    2. Create the process object in Java from the process you created in step 1.
    3. Create an ExampleSet from the data you want to pass to the model. How that is done can be seen in the FAQ, question 8.
    4. Call the process and pass your ExampleSet to it as a parameter. See the FAQ, question 5.
    5. You can then execute your process and use the result(s), see FAQ, question 9

    Regards,
    Marco
  • alismartalismart Member Posts: 3 Contributor I
    Nice to see your reply Mr. Marco,

    Honestly speaking i was waiting for your reply with patience, checking for it everyday
    Thanks for the detailed steps, i understand them well but let me describe my main problem in details

    I am doing a graduation project thus i need to use RapidMiner for the great Visualization abilites as well as numerous ways of results shows.

    BUT, the application part of my graduation project is going to an ASP.NET website coded in C#
    i know both C# and JAVA , i was planning to convert rapidminer.jar library to rapidminer.dll to invoke it in my application but it didn't work because of dependencies on classes from other libraries in RapidMiner project.

    The last thing i ended up with is the PMML extension in RapidMiner which allows to write the model in standarized PMML (XML-based) form and thus the model can be used in any application.

    I installed the extension from RapidMiner market place, in the help they said:
    This operator supports the following models:
    Decision Tree Models
    Rule Models
    Naive Bayes models for nominal attributes
    Linear Regression Models
    Logistic Regression Models
    Centroid based Cluster models like models of k-means and k-medoids
    I need SVM , is it included in ( Logistic Regression Models ) Category ?
    if no, can you suggest any workaround solution to my problem ?
  • Marco_BoeckMarco_Boeck Administrator, Moderator, Employee-RapidMiner, Member, University Professor Posts: 1,996 RM Engineering
    Hi,

    if you want RapidMiner for the visualization, you will have to use RapidMiner processes, no way around it.
    I see at least three possibilities here. In no particular order:

    1. Use the "Reporting Extension" to generate static HTML pages containing images of the results you want. The extension is configured via operators, so all in all you'd only have to run a process and it would generate HTML wherever you said. You can execute the process by invoking the command line (batch) mode of RapidMiner Studio. That way, you don't need to actually call Java classes from within your C# code.
    To feed data to the process, you could prepare it in C# and store it e.g. in .csv format. The RM process would read it and produce the results you want.
    2. Use some sort of C# -> Java Bridge. I have no experience with that. However that would allow to you to customize the results and paint them directly to images from within your Java code.
    3. Use exported services in RapidMiner Server. These can basically output either HTML 5 charts or native plots available in Studio based in arbitrary RapidMiner processes directly exposed as a web service. Your website could fetch the resources from the web service of RM Server and process/display it.

    Regards,
    Marco
  • alismartalismart Member Posts: 3 Contributor I
    Thanks alot, all are great possibilites

    but i am now stuck on how to use the Classification model from the C# code.

    from my perspective, since i need my application to run offline so i can't profit rapidminer server, so the only way is to make a bridge between java and C#.

    is there a better approach for my situation? i mean , why they said the following in the documentation of rapidminer?
    The Write Model operator writes the input model into the file specified by the model file parameter. Since models are often written into files and then loaded for applying them in other processes or applications.
    then how to load these saved models for applying in applications
    i think there is no tool to parse the content of the xml model file outside RapidMinder :(
  • Marco_BoeckMarco_Boeck Administrator, Moderator, Employee-RapidMiner, Member, University Professor Posts: 1,996 RM Engineering
    Hi,

    you can set "Write Model" to write XML. You could parse that yourself and do whatever you need with it. However that obviously requires that you apply the model yourself by hand.

    Regards,
    Marco
Sign In or Register to comment.