public static IOContainer createInput() { // create a wrapper that implements the ExampleSet interface and // encapsulates your data // ... return new IOContainer(new IOObject[] { myExampleSet }); } public static void main(String[] argv) throws Exception { // MUST BE INVOKED BEFORE ANYTHING ELSE !!! RapidMiner.init(); // create the process from the command line argument file Process process = new Process(new File(argv[0])); // create some input from your application, e.g. an example set IOContainer input = createInput(); // run the process on the input process.run(input); }
Process process = new Process(new File("Là, il faut que tu mettes le path du fichier de données"));
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); } } }
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionRapidMiner.setExecutionMode(com.rapidminer.RapidMiner.ExecutionMode.COMMAND_LINE);
Process myProcess = new Process(processXML);
IOContainer ioResult = myProcess.run(ioInput);
import com.rapidminer.Process;
import java.lang.Process;
ProcessEntry pEntry = (ProcessEntry) pLoc.locateEntry();
RepositoryLocation pLoc = new RepositoryLocation("//MyRepository//MyData//kmeansProcess");