An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
// set the execution mode to whatever fits your needsRapidMiner.setExecutionMode(ExecutionMode.APPLET);RapidMiner.init();InputStream is;// setup your input stream to your process file hereString 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);}
Reader reader = getReaderWithCharset("UTF-8") // Supply Charset to avoid painful errors later onExampleSet examples = createExampleSet() // Create Attributes, DataRows, ExampleTable, and finally ExampleSetProcess process = new Process(reader)IOContainer input = new IOContainer(examples) // Set you ExampleSet as the process inputprocess.setContext(new ProcessContext()) // Clear context to avoid silly errors.IOContainer output = process.run(input) // Run the process with your ExampleSet dataExampleSet result = output.get(ExampleSet.class) // Get the first IOObject of type ExampleSet in the output.
jinxing 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 sponsor
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.
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 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: 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); Regards,Marco