[SOLVED] Process loader and Operator attributes
zis
New Altair Community Member
Hi everyone,
I am new in rapidminer and I am interested in how can I load a Process defined in xml file (<operator name="Global" class="Process"> ....) in the RAPID GUI.
Moreover, if exists any documentation about operators parameters from RAPID API? I read a wiki a pdf tutorial (for 4.6) and there is no description of these parameters.
For example, I dont know, what parameters in the AggregateOperator (http://rapid-i.com/api/rapidminer-5.1/com/rapidminer/operator/preprocessing/transformation/AggregationOperator.html) are.
I created a simple example code, where I tried read simple csv, create SUM aggregation and write data to file. The name of SUM column is number.
Same for output and input ports for Operators.
Thanks for any ideas.
I am new in rapidminer and I am interested in how can I load a Process defined in xml file (<operator name="Global" class="Process"> ....) in the RAPID GUI.
Moreover, if exists any documentation about operators parameters from RAPID API? I read a wiki a pdf tutorial (for 4.6) and there is no description of these parameters.
For example, I dont know, what parameters in the AggregateOperator (http://rapid-i.com/api/rapidminer-5.1/com/rapidminer/operator/preprocessing/transformation/AggregationOperator.html) are.
I created a simple example code, where I tried read simple csv, create SUM aggregation and write data to file. The name of SUM column is number.
And I dont know if the aggregatiom parametrs are right.
RapidMiner.init();
try {
/* Reading Data */
Operator trainingDataReader = OperatorService.createOperator(CSVExampleSource.class);
trainingDataReader.setParameter("csv_file", RapidMinerTest.projectPWD + "report1.csv");
trainingDataReader.setParameter("column_separators", ";");
/* Classifier */
Operator aggregation = OperatorService.createOperator(AggregationOperator.class);
//aggregation.setParameter("keep_example_set", "true");
//aggregation.setParameter("aggregation_attributes", "sum");
aggregation.setParameter("aggregation_function", "sum");
aggregation.setParameter("aggregation_name", "number");
/* Save model */
Operator csvWriter = OperatorService.createOperator(CSVExampleSetWriter.class);
csvWriter.setParameter("csv_file", RapidMinerTest.projectPWD + "report_OUT.csv");
csvWriter.setParameter("column_separator", ";");
Process process = new Process();
process.getRootOperator().getSubprocess(0).addOperator(trainingDataReader);
process.getRootOperator().getSubprocess(0).addOperator(aggregation);
process.getRootOperator().getSubprocess(0).addOperator(csvWriter);
trainingDataReader.getOutputPorts().getPortByName("output").connectTo(aggregation.getInputPorts().getPortByName("example set input"));
aggregation.getOutputPorts().getPortByName("original").connectTo(csvWriter.getInputPorts().getPortByName("input"));
System.out.println(process.getRootOperator().createProcessTree(0));
process.run();
Output csv data is same such as in input.
aggregation.setParameter("aggregation_function", "sum");
aggregation.setParameter("aggregation_name", "number");
Same for output and input ports for Operators.
Thanks for any ideas.
0
Answers
-
Ok, it´s time for some explanation. I am using RapidMiner v 5.1.
It occurred to me that I can create a process in GUI and then export him to the xml file. Finally I found lots of attributes names and values in xml, but it is not directly for class AggregationOperator, but for Aggregation. Maybe it is a some kind of wrapper of AO class.
So I used the attributes and it´s working fine.
A Process in GUI you can import by File -> Import Process.0