Java

Moderators: zibadian
Number of threads: 7818
Number of posts: 18218

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
rapidminer and java Posted by samfaith on 7 Nov 2012 at 12:33 PM
Hi,
I want to create a new model of clustering, I want to start applying an algorithm (kmeans algorithm) from RapidMiner then retrieve the results (clusters and their contents) in my java program and apply other programming technique. I have the following code:

import com.rapidminer.RapidMiner;
import com.rapidminer.example.ExampleSet;
import com.rapidminer.operator.ExecutionMode;
import com.rapidminer.operator.IOContainer;
import com.rapidminer.operator.IOObject;
import com.rapidminer.repository.IOObjectEntry;
import com.rapidminer.repository.ProcessEntry;
import com.rapidminer.repository.RepositoryLocation;
import java.lang.String;





public class Model {

	 public static void main(String args[]) throws Exception {
		 
	// this initializes RapidMiner with your repositories available
	 
	RapidMiner.setExecutionMode(ExecutionMode.COMMAND_LINE);
	 
	RapidMiner.init();
	// loads the process from the repository
	RepositoryLocation pLoc = new RepositoryLocation("//C:/Users/faith/Desktop/MyRepository/MyData/kmeansProcess");
	ProcessEntry pEntry = (ProcessEntry) pLoc.locateEntry();
	String processXML = pEntry.retrieveXML();
	Process myProcess = new Process(processXML);
	// if need be, you can give the process IOObjects as parameter (this would be the case if you used the process input ports)
	RepositoryLocation loc = new RepositoryLocation("//C:/Users/faith/Desktop/MyRepository/MyData/cars");
	IOObjectEntry entry = (IOObjectEntry) loc.locateEntry();
	IOObject myIOObject= entry.retrieveData(null);

	// execute the process and get the resulting objects
	IOContainer ioInput = new IOContainer(new IOObject[] {myIOObject});
	// just use myProcess.run() if you don't use the input ports for your process
	IOContainer ioResult = myProcess.run(ioInput);

	// use the result(s) as needed, for example if your process just returns one ExampleSet, use this:
	if (ioResult.getElementAt(0) instanceof ExampleSet) {
		ExampleSet resultSet = (ExampleSet)ioResult.getElementAt(0);
	}	
   }
}


But I have encountered three errors :
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
COMMAND_LINE cannot be resolved or is not a field
Cannot instantiate the type Process
The method run(IOContainer) is undefined for the type Process
at Model.main(Model.java:82)

I don't know how to solve these problems. Help me please, I really need help.
Thank you in advance



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.