🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

How to read the output?

User: "Hans"
New Altair Community Member
Updated by Jocelyn
Hei..
I`ve try the APi, but i still dont know how to see the output on my process..
here the console says:

Jan 17, 2012 9:53:17 AM com.rapidminer.tools.WrapperLoggingHandler log
INFO: No filename given for result file, using stdout for logging results!
Jan 17, 2012 9:53:17 AM com.rapidminer.Process run
INFO: Process starts
Jan 17, 2012 9:53:18 AM com.rapidminer.Process run
INFO: Process finished successfully after 0 s
Jan 17, 2012 9:53:18 AM com.rapidminer.tools.WrapperLoggingHandler log
INFO: No filename given for result file, using stdout for logging results!
Jan 17, 2012 9:53:18 AM com.rapidminer.Process run
INFO: Process starts
Jan 17, 2012 9:53:18 AM com.rapidminer.Process run
INFO: Process finished successfully after 0 s
and here is the code

import com.rapidminer.repository.RepositoryLocation;
import com.rapidminer.repository.RepositoryManager;
import com.rapidminer.tools.OperatorService;
import com.rapidminer.Process;
import com.rapidminer.*;
import com.rapidminer.RapidMiner.ExecutionMode;
import com.rapidminer.example.Attribute;
import com.rapidminer.example.Example;
import com.rapidminer.operator.IOContainer;
import com.rapidminer.operator.IOObject;
//import com.rapidminer.operator.ExecutionUnit;
import com.rapidminer.operator.Operator;
import com.rapidminer.operator.ExecutionMode.*;
import com.rapidminer.example.ExampleSet;
import com.rapidminer.gui.*;
import java.io.*;

//import com.rapidminer.operator.OperatorException;
//import com.rapidminer.operator.IOContainer;
//import java.io.IOException;
import java.io.File;
import java.util.Iterator;
public class Main {
static String line;
static String x="C:\\Documents and Settings\\user\\My Documents\\RapidMiner\\model1.rmp";
private static String readFileAsString(String filePath)
    throws java.io.IOException{
        StringBuffer fileData = new StringBuffer(1000);
        BufferedReader reader = new BufferedReader(
                new FileReader(filePath));
        char[] buf = new char[1024];
        int numRead=0;
        while((numRead=reader.read(buf)) != -1){
            String readData = String.valueOf(buf, 0, numRead);
            fileData.append(readData);
            buf = new char[1024];
        }
        reader.close();
        return fileData.toString();
    }
public static void main(String[] argv) throws Exception {
  // MUST BE INVOKED BEFORE ANYTHING ELSE !!!

  RapidMiner.setExecutionMode(ExecutionMode.COMMAND_LINE);
  RapidMiner.init();
  Process process=new Process(readFileAsString(x));
  IOContainer ioResult = process.run();
  if (ioResult.getElementAt(0) instanceof ExampleSet) {
  ExampleSet resultSet = (ExampleSet)ioResult.getElementAt(0);
              RepositoryLocation resloc = new RepositoryLocation("//MyRepository/contohg");
              RepositoryManager.getInstance(null).store(resultSet, resloc, null);
  }

  process.run();
}

}
so what should i do next, if i want to see the output?

Find more posts tagged with

Sort by:
1 - 6 of 61
    User: "StaryVena"
    New Altair Community Member
    Hi,
    you can just use:

    IOContainer c = process.run();
    ExampleSet es = c.get(ExampleSet.class);
    Best,
    Vaclav
    User: "Hans"
    New Altair Community Member
    OP
    Hi staryvena,
    thx for your reply..

    I`ve add the code, but its appeared error

    Exception in thread "main" com.rapidminer.operator.MissingIOObjectException: The operator needs some input of type com.rapidminer.example.ExampleSet which is not provided.

    so how i can provided the input??
    I want to use data source from excel type...
    User: "StaryVena"
    New Altair Community Member
    Hi,

    IOConatine in = ....
    IOContainer c = process.run(in);
    Check Process API http://rapid-i.com/api/rapidminer-5.1/com/rapidminer/Process.html and I think if you search this forum, there are some examples.

    Best,
    Vaclav
    User: "Marco_Boeck"
    New Altair Community Member
    Hi,

    if your process requires some kind of input data, you can check this post to see how it can be done: click
    A way to get the output example set has been provided by Vaclav :)

    Regards,
    Marco
    User: "Hans"
    New Altair Community Member
    OP
    ok, somehow i can read the output...
    here is my code:

    public class Main {
    static String line;
    static String x="C:\\Documents and Settings\\user\\My Documents\\RapidMiner\\model1.rmp";
    private static String readFileAsString(String filePath)
        throws java.io.IOException{
            StringBuffer fileData = new StringBuffer(1000);
            BufferedReader reader = new BufferedReader(
                    new FileReader(filePath));
            char[] buf = new char[1024];
            int numRead=0;
            while((numRead=reader.read(buf)) != -1){
                String readData = String.valueOf(buf, 0, numRead);
                fileData.append(readData);
                buf = new char[1024];
            }
            reader.close();
            return fileData.toString();
        }
    public static void main(String[] argv) throws Exception {
      // MUST BE INVOKED BEFORE ANYTHING ELSE !!!

      RapidMiner.setExecutionMode(ExecutionMode.COMMAND_LINE);
      RapidMiner.init();
      Process process=new Process(readFileAsString(x));
      IOContainer ioResult = process.run();
              System.out.print(ioResult.getElementAt(0));
              ExampleSet resultSet = null;
              if(ioResult.getElementAt(0) instanceof ExampleSet)
                  {
                  resultSet = (ExampleSet) ioResult.getElementAt(0);
                  RepositoryLocation resloc = new RepositoryLocation("//MyRepository/coba2");
                  RepositoryManager.getInstance(null).store(resultSet, resloc, null);
                  }
              for(Example example: resultSet){
                  Iterator<Attribute> allAtts = example.getAttributes().allAttributes();
                 
                  //System.out.print(name);
                  while(allAtts.hasNext()){
                      for(int i=0;i<=8;i++){
                          Attribute a = allAtts.next();
                      if(a.isNumerical()){
                          double value = example.getValue(a);
                          System.out.print(value);
                          }
                      else{
                          String value = example.getValueAsString(a);
                          System.out.print(value);
                      }
                      }System.out.print("\n");
                  }
    }
              }
    }
    and the output i get is:

    RemappedExampleSet:
    32 examples,
    8 regular attributes,
    special attributes = {
        id = #8: Nama Provinsi (polynominal/single_value)/values=[Aceh, Sumatra Utara, Sumatera Barat, R i a u, Jambi, Sumatera Selatan, Bengkulu, Lampung, Kep Bangka Belitung, Kepulauan Riau, DKI Jakarta, Jawa Barat, Jawa Tengah, DI Yogyakarta, Jawa Timur, Banten, B a l i, Nusa Tenggara Barat, Nusa Tenggara Timur, Kalimantan Barat, Kalimantan Tengah, Kalimantan Selatan, Kalimantan Timur, Sulawesi Utara, Sulawesi Tengah, Sulawesi Selatan, Sulawesi Tenggara, Gorontalo, M a l u k u, Maluku Utara, Papua Barat, P a p u a]
    }range1 [-? - 87.500]range2 [60 - ?]range1 [-? - 19270.500]range1 [-? - 21907077]range2 [18 - ?]range2 [70.500 - ?]range1 [-? - 29076]range1 [-? - 2410000]Aceh
    range1 [-? - 87.500]range2 [60 - ?]range1 [-? - 19270.500]range1 [-? - 21907077]range1 [-? - 18]range2 [70.500 - ?]range1 [-? - 29076]range1 [-? - 2410000]Sumatra Utara
    range1 [-? - 87.500]range2 [60 - ?]range1 [-? - 19270.500]range1 [-? - 21907077]range1 [-? - 18]range2 [70.500 - ?]range1 [-? - 29076]range1 [-? - 2410000]Sumatera Barat
    range1 [-? - 87.500]range2 [60 - ?]range1 [-? - 19270.500]range1 [-? - 21907077]range1 [-? - 18]range2 [70.500 - ?]range1 [-? - 29076]range1 [-? - 2410000]R i a u
    range1 [-? - 87.500]range1 [-? - 60]range1 [-? - 19270.500]range1 [-? - 21907077]range1 [-? - 18]range2 [70.500 - ?]range1 [-? - 29076]range1 [-? - 2410000]Jambi
    range1 [-? - 87.500]range1 [-? - 60]range1 [-? - 19270.500]range1 [-? - 21907077]range1 [-? - 18]range2 [70.500 - ?]range1 [-? - 29076]range1 [-? - 2410000]Sumatera Selatan
    range1 [-? - 87.500]range1 [-? - 60]range1 [-? - 19270.500]range1 [-? - 21907077]range1 [-? - 18]range2 [70.500 - ?]range1 [-? - 29076]range1 [-? - 2410000]Bengkulu
    range1 [-? - 87.500]range1 [-? - 60]range1 [-? - 19270.500]range1 [-? - 21907077]range1 [-? - 18]range1 [-? - 70.500]range1 [-? - 29076]range1 [-? - 2410000]Lampung
    range1 [-? - 87.500]range1 [-? - 60]range1 [-? - 19270.500]range1 [-? - 21907077]range1 [-? - 18]range2 [70.500 - ?]range1 [-? - 29076]range1 [-? - 2410000]Kep Bangka Belitung
    range1 [-? - 87.500]range2 [60 - ?]range1 [-? - 19270.500]range1 [-? - 21907077]range1 [-? - 18]range2 [70.500 - ?]range1 [-? - 29076]range1 [-? - 2410000]Kepulauan Riau
    range2 [87.500 - ?]range2 [60 - ?]range2 [19270.500 - ?]range1 [-? - 21907077]range1 [-? - 18]range2 [70.500 - ?]range2 [29076 - ?]range2 [2410000 - ?]DKI Jakarta
    range2 [87.500 - ?]range1 [-? - 60]range2 [19270.500 - ?]range2 [21907077 - ?]range1 [-? - 18]range2 [70.500 - ?]range1 [-? - 29076]range2 [2410000 - ?]Jawa Barat
    range2 [87.500 - ?]range1 [-? - 60]range1 [-? - 19270.500]range2 [21907077 - ?]range1 [-? - 18]range2 [70.500 - ?]range1 [-? - 29076]range1 [-? - 2410000]Jawa Tengah
    range1 [-? - 87.500]range1 [-? - 60]range1 [-? - 19270.500]range1 [-? - 21907077]range1 [-? - 18]range2 [70.500 - ?]range1 [-? - 29076]range1 [-? - 2410000]DI Yogyakarta
    range1 [-? - 87.500]range2 [60 - ?]range1 [-? - 19270.500]range2 [21907077 - ?]range1 [-? - 18]range2 [70.500 - ?]range2 [29076 - ?]range2 [2410000 - ?]Jawa Timur
    range1 [-? - 87.500]range1 [-? - 60]range1 [-? - 19270.500]range1 [-? - 21907077]range1 [-? - 18]range1 [-? - 70.500]range1 [-? - 29076]range1 [-? - 2410000]Banten
    range2 [87.500 - ?]range2 [60 - ?]range2 [19270.500 - ?]range1 [-? - 21907077]range1 [-? - 18]range2 [70.500 - ?]range1 [-? - 29076]range2 [2410000 - ?]B a l i
    range1 [-? - 87.500]range1 [-? - 60]range1 [-? - 19270.500]range1 [-? - 21907077]range2 [18 - ?]range2 [70.500 - ?]range1 [-? - 29076]range1 [-? - 2410000]Nusa Tenggara Barat
    range1 [-? - 87.500]range1 [-? - 60]range1 [-? - 19270.500]range1 [-? - 21907077]range2 [18 - ?]range1 [-? - 70.500]range1 [-? - 29076]range1 [-? - 2410000]Nusa Tenggara Timur
    range1 [-? - 87.500]range1 [-? - 60]range1 [-? - 19270.500]range1 [-? - 21907077]range1 [-? - 18]range1 [-? - 70.500]range1 [-? - 29076]range1 [-? - 2410000]Kalimantan Barat
    range1 [-? - 87.500]range1 [-? - 60]range1 [-? - 19270.500]range1 [-? - 21907077]range2 [18 - ?]range1 [-? - 70.500]range1 [-? - 29076]range1 [-? - 2410000]Kalimantan Tengah
    range1 [-? - 87.500]range1 [-? - 60]range1 [-? - 19270.500]range1 [-? - 21907077]range1 [-? - 18]range2 [70.500 - ?]range1 [-? - 29076]range1 [-? - 2410000]Kalimantan Selatan
    range1 [-? - 87.500]range2 [60 - ?]range1 [-? - 19270.500]range1 [-? - 21907077]range1 [-? - 18]range1 [-? - 70.500]range1 [-? - 29076]range1 [-? - 2410000]Kalimantan Timur
    range1 [-? - 87.500]range1 [-? - 60]range1 [-? - 19270.500]range1 [-? - 21907077]range1 [-? - 18]range2 [70.500 - ?]range1 [-? - 29076]range1 [-? - 2410000]Sulawesi Utara
    range1 [-? - 87.500]range1 [-? - 60]range1 [-? - 19270.500]range1 [-? - 21907077]range1 [-? - 18]range2 [70.500 - ?]range1 [-? - 29076]range1 [-? - 2410000]Sulawesi Tengah
    range1 [-? - 87.500]range1 [-? - 60]range1 [-? - 19270.500]range1 [-? - 21907077]range1 [-? - 18]range1 [-? - 70.500]range1 [-? - 29076]range1 [-? - 2410000]Sulawesi Selatan
    range1 [-? - 87.500]range1 [-? - 60]range1 [-? - 19270.500]range1 [-? - 21907077]range1 [-? - 18]range1 [-? - 70.500]range1 [-? - 29076]range1 [-? - 2410000]Sulawesi Tenggara
    range1 [-? - 87.500]range1 [-? - 60]range1 [-? - 19270.500]range1 [-? - 21907077]range1 [-? - 18]range1 [-? - 70.500]range1 [-? - 29076]range1 [-? - 2410000]Gorontalo
    range1 [-? - 87.500]range2 [60 - ?]range1 [-? - 19270.500]range1 [-? - 21907077]range2 [18 - ?]range1 [-? - 70.500]range1 [-? - 29076]range1 [-? - 2410000]M a l u k u
    range1 [-? - 87.500]range2 [60 - ?]range1 [-? - 19270.500]range1 [-? - 21907077]range1 [-? - 18]range1 [-? - 70.500]range1 [-? - 29076]range1 [-? - 2410000]Maluku Utara
    range1 [-? - 87.500]range1 [-? - 60]range1 [-? - 19270.500]range1 [-? - 21907077]range2 [18 - ?]range1 [-? - 70.500]range1 [-? - 29076]range1 [-? - 2410000]Papua Barat
    range1 [-? - 87.500]range1 [-? - 60]range1 [-? - 19270.500]range1 [-? - 21907077]range2 [18 - ?]range1 [-? - 70.500]range1 [-? - 29076]range1 [-? - 2410000]P a p u a
    BUILD SUCCESSFUL (total time: 12 seconds)
    its juts the value of my attribute, and now i want to output the name of my attribute..
    there is no method getAttributeName() in rapidminer,rite? haha...
    so what should i do?
    User: "Marco_Boeck"
    New Altair Community Member
    Hi,
    Did you look at the Api for the Attribute class?
    To get the name of an attribute, you can simply call

    attribute.getName();
    Regards,
    Marco