Pages: [1]
  Print  
Author Topic: [SOLVED] Process loader and Operator attributes  (Read 287 times)
zis
Newbie
*
Posts: 22


« on: February 07, 2012, 04:57:47 PM »

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.

Code:
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();


And I dont know if the aggregatiom parametrs are right.

Code:
aggregation.setParameter("aggregation_function", "sum");
aggregation.setParameter("aggregation_name", "number");

Output csv data is same such as in input.

Same for output and input ports for Operators.

Thanks for any ideas.
« Last Edit: February 08, 2012, 03:09:40 PM by zis » Logged
zis
Newbie
*
Posts: 22


« Reply #1 on: February 08, 2012, 03:05:02 PM »

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.
Logged
Pages: [1]
  Print  
 
Jump to: