rapidminer and java - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

rapidminer and java

samfaithsamfaith Posts: 1Member
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:

[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);
}
}
}
[/code]

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
Sign In or Register to comment.