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

[SOLVED] Java application

l__chinel__chine Member Posts: 12 Contributor II
edited April 2020 in Help
Hi,
I would like to ask you for help with some problem. I created a model in RapidMiner and now I need to create a java application that could use this model. So I need to write a code. But I don't know how should I start. I've noticed there is some possible to run a RapidMiner process in Eclipse but I haven't understood how it works yet. I begin to be desperate because days and days I searched the informations about how to do that but without any luck.
Could you please give me some advices or recommend me some documents for my work?
Tagged:

Answers

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

    I'm not sure what exactly your goal is, but using the forum search and searching for "java execute process" will for example turn up the following thread: click.

    Or alternatively, by just looking over the very first page of this development forum, I found this thread: click

    Regards,
    Marco
  • l__chinel__chine Member Posts: 12 Contributor II
    I think you didn't understand me quite good, so I try to express my ideas better. I searched the way how to write my own code. The problem is simple. I neither can use another person's code neither write my own one because I don't know what are these methods used for? Javadoc informations are to brief for me to understand.
    For example: I got a process result in a result perspective, so I click on an example set (Retrieve) and also click on Data View. That's there, where my result is displayed as a string under a prediction label box. After running the process by method myProcess.run, what method should I use to get this result's string?
    I'm sorry for my stupidity but there is something that I'm still missing.

    Moreover, the basic statement
    RapidMiner.setExecutionMode(ExecutionMode.COMMAND_LINE);
    RapidMiner.init();
    doesn't work. I get messages like '' syntax error on ".",...expected " or "identifier expected after this token" . I found somebody with similary problem, and tried his solutions (missing library maybe) but nothing happend. Do you have any idea?
    Thank for response
  • l__chinel__chine Member Posts: 12 Contributor II
    I found something in the forum and the problems with errors (rapidminer init()) are gone. But still there is my first question from my second message I sent to you.
  • Marco_BoeckMarco_Boeck Administrator, Moderator, Employee-RapidMiner, Member, University Professor Posts: 1,996 RM Engineering
    Hi,

    well the result of a process is always an IOContainer. So to find out what you get after a specific process, you could do something like this:

    [...]
    IOContainer resultContainer = process.run();
    for (IOObject r : resultContainer.asList()) {
    System.out.println(r.getClass());
    }
    Depending on the type of the result you can then continue from there.

    Regards,
    Marco
  • l__chinel__chine Member Posts: 12 Contributor II
    I've received a message reporting to a class SimpleExampleSet. But I cannot find any method for displaying results from DataTable showed in Data view. I tried this way for printing results:
    http://rapid-i.com/wiki/index.php?title=Integrating_RapidMiner_into_your_application
    despite of a few mistakes in the code ( the method getExampleReader is undefined for the type ExampleSet), using the method getPredictedLabel() I received this:
    #16 prediction(label) (binominal/single_value).
    The value of prediction label is not visible. Please how could I get this value?
  • l__chinel__chine Member Posts: 12 Contributor II
    I think I figured it out. My code now looks like this.

    IOContainer ioResult = myProcess.run(datasetfortesting);
    ExampleSet resultSet = ioResult.get(ExampleSet.class);

            for(Example example : resultSet){
        Attributes atriba = example.getAttributes();
                Attribute a = atriba.getPredictedLabel();
                predictedLabel = example.getValueAsString(a);
                System.out.println(predictedLabel);
            }
    So, this problem is solved.

    Have a nice day
Sign In or Register to comment.