A program to recognize and reward our most engaged community members
public class NaiveClassifier { public static void main (String args[]) { try { RapidMiner.setExecutionMode(RapidMiner.ExecutionMode.COMMAND_LINE); RapidMiner.init(); Process process = new Process(new File("C:\\Users\\nelze\\.RapidMiner5\\repositories\\WalkingRepo\\NaiveClassify.rmp")); Operator op = process.getOperator("Read CSV"); op.setParameter(CSVExampleSource.PARAMETER_FILENAME, "C:\\Users\\nelze\\unlabeled.csv"); RepositoryLocation loc = new RepositoryLocation("C:\\Users\\nelze\\unlabeled.csv"); IOObjectEntry entry = (IOObjectEntry) loc.locateEntry(); IOObject myIOObject = entry.retrieveData(null); IOContainer ioInput = new IOContainer(new IOObject[] {myIOObject}); IOContainer ioResult = process.run(ioInput); ExampleSet resultSet1 = (ExampleSet)ioResult.getElementAt(0); System.out.println(resultSet1); } catch (IOException | XMLException | OperatorException ex) { ex.printStackTrace(); } catch (RepositoryException e) { // TODO Auto-generated catch block e.printStackTrace(); } }}
RapidMiner.setExecutionMode(RapidMiner.ExecutionMode.COMMAND_LINE); RapidMiner.init(); Process process = new Process(new File("C:\\Users\\nelze\\.RapidMiner5\\repositories\\WalkingRepo\\NaiveClassify.rmp")); Operator op = process.getOperator("Read CSV"); op.setParameter(CSVExampleSource.PARAMETER_FILENAME, "C:\\Users\\nelze\\unlabeled.csv"); IOContainer ioResult = process.run(); ExampleSet resultSet1 = (ExampleSet)ioResult.getElementAt(0); System.out.println(resultSet1);
ExampleSet exampleSet = null;Iterator<Attribute> allAttributes = exampleSet.getAttributes().allAttributes();while (allAttributes.hasNext()) { Attribute att = allAttributes.next(); for (Example example : exampleSet) { if (att.isNominal()) { System.out.println(example.getNominalValue(att)); } else if (att.isDateTime()) { System.out.println(example.getDateValue(att)); } else { System.out.println(example.getValue(att)); } }}