run rapid miner process as web-based
jinxing
New Altair Community Member
Answers
-
Hi,
please note that to be allowed to use RapidMiner for your project, it needs to be published under the same license as RapidMiner, which is the AGPL.
However if you intend to sell your project, you need to obtain an OEM license. How much this will cost depends on a variety of factors, namely the scope of your tool, etc. If you are interested in obtaining such a license, you should send a short mail to sales@rapid-i.com and let us know how we can contact you. We will then contact you as soon as we can.
In regards to your question, yes this is possible.
Regards,
// set the execution mode to whatever fits your needs
RapidMiner.setExecutionMode(ExecutionMode.APPLET);
RapidMiner.init();
InputStream is;
// setup your input stream to your process file here
String xml = com.rapidminer.tools.Tools.readTextFile(is);
Process process = new Process(xml);
IOContainer ioResult = process.run();
if (ioResult.getElementAt(0) instanceof ExampleSet) {
resultSet = (ExampleSet)ioResult.getElementAt(0);
}
Marco0 -
Hi jinxing,
It is possible but it is not that simple. First we would need more information on your type of problem.
If it is going to be in a webapp you must ask the following questions:
1) Is the process going to change or is it static?
2) Is the input data coming from another process or is it available on disk?
3) Assuming that the input data is not on disk. Do you know the input Attributes in order to build the ExampleSet.
I will assume that the process will be static and that you will keep it on disk. If not, you can still use the process I describe below and just change the type of Reader to read from whatever input you are supplying.
I will also assume that the input data is supplied by an external client that wants to apply the process to the data.
If this is true then it is not as simple a use case as the first response.
That example is not passing in any data, it is assuming the it's in the process context declaration and you have access to the repository. In my experience, if you are in APPSERVER or SERVLET mode, you don't have access to the repository. I still haven't found a way to add a repository once RapidMiner has started, and I don't think it's possible.
So now you have to create an ExampleSet, to do this you must know the Attributes of the data you and their types.
Having this information you can build the ExampleSet to pass into the process.
I will skip the step of creating the ExampleSet, which is not trivial.
Here is an simple example of creating a process and running it with input data.
Let me know if it works.
Reader reader = getReaderWithCharset("UTF-8") // Supply Charset to avoid painful errors later on
ExampleSet examples = createExampleSet() // Create Attributes, DataRows, ExampleTable, and finally ExampleSet
Process process = new Process(reader)
IOContainer input = new IOContainer(examples) // Set you ExampleSet as the process input
process.setContext(new ProcessContext()) // Clear context to avoid silly errors.
IOContainer output = process.run(input) // Run the process with your ExampleSet data
ExampleSet result = output.get(ExampleSet.class) // Get the first IOObject of type ExampleSet in the output.
cheers,
Danieljinxing wrote:
I create a classfication process in the GUI mode, is it possible that I write the process in java, and can run that this rapidminer process on a web,cause we want to provide a web-based app to our project sponsor0 -
Hi,dacamo76 wrote:
That example is not passing in any data, it is assuming the it's in the process context declaration and you have access to the repository. In my experience, if you are in APPSERVER or SERVLET mode, you don't have access to the repository. I still haven't found a way to add a repository once RapidMiner has started, and I don't think it's possible.
you can always add repositories during runtime. For example, one of our webservices (which runs in ExecutionMode.APPSERVER) uses this code to dynamically reload processes/IOObjects from a RapidAnalytics repository:
Regards,
RepositoryManager.getInstance(null).addRepository(new RemoteRepository("http://YourRapidAnalyticsServer:8080", "RapidAnalytics", "username", "password", false));
RepositoryLocation dloc = new RepositoryLocation("//RapidAnalytics/your/folder/structure/IOObject"));
IOObjectEntry dataEntry = (IOObjectEntry) dloc.locateEntry();
dataObject = dataEntry.retrieveData(null);
Marco0 -
Great, good to know.Marco Boeck wrote:
Hi,
you can always add repositories during runtime. For example, one of our webservices (which runs in ExecutionMode.APPSERVER) uses this code to dynamically reload processes/IOObjects from a RapidAnalytics repository:
Regards,
RepositoryManager.getInstance(null).addRepository(new RemoteRepository("http://YourRapidAnalyticsServer:8080", "RapidAnalytics", "username", "password", false));
RepositoryLocation dloc = new RepositoryLocation("//RapidAnalytics/your/folder/structure/IOObject"));
IOObjectEntry dataEntry = (IOObjectEntry) dloc.locateEntry();
dataObject = dataEntry.retrieveData(null);
Marco
I've been trying to figure this out for some time.
I will try this out in our next project.
Daniel0