Options

Using exampleSet to populate CSVExampleSource

ml_guyml_guy Member Posts: 11 Contributor II
edited November 2018 in Help
I have a Java method in which data is passed in a multidimensional array which i use to construct a MemoryExampleTable. I then use the MemoryExampleTable to get an ExampleSet using "MemoryExampleTable.createExampleSet()".
Now I want to use this ExampleSet as input in any of the IO class (preferably CSVExampleSource) so that a supervised learning method can be applied on it. I have searched a lot but am not finding any clue anywhere.

In a nutshell, I need to know how to apply learning algorithm on memory based data.

Can someone please help me in this regard. I would be really really grateful.

Thanks in advance

Answers

  • Options
    landland RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 2,531 Unicorn
    Hi,
    the ExampleSources are made for creating DataTable from files. Since you already have your example set, everything you have to do is to create your Operator using the operator service and then invoking the apply method:
    Operator operator = OperatorService.createOperator(NaiveBayes.class);
    operator.apply(new IOContainer(exampleSet));
    Greetings,
      Sebastian
  • Options
    ml_guyml_guy Member Posts: 11 Contributor II
    Thanks Sabestian.
    It was really helpful.
    If I am not wrong, this method imitates the single operator design (where you take single IOContainer all the way through the operators to produce some output).

    I would like to know whether we can use the MemoryExampleTable as input parameter to any of rapidminer example source classes (e.g. CSVExampleSource, ExcelExampleSource etc).
    My idea is to construct an example source from my memory example table, add other operators and make a process tree which I can then execute via process.run() call.

    Thanks once again.
  • Options
    steffensteffen Member Posts: 347 Maven
    Hello ml_guy

    Please recognize that the operator are mentioned by you are loading data, that is the reason why they are called *source. It makes simply no sense to add data as input to these operators.

    If you have an ExampleSet, you already have data as it is represented in RapidMiner. Now you can apply operators, as Sebastian said.

    You can find more information about this task in the file tutorial.pdf, which is also available on RapidMiner's download page at sourceforge.

    regards,

    Steffen
  • Options
    landland RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 2,531 Unicorn
    Hi,
    you could even build a hole process without any Inputoperator and pass every input as IOContainer:

    ... generating each IOObject using your code ...
    ... building the process ...
    IOContainer result = process.run(new IOContainer(ioobject1, ioobject2));
    Greetings,
      Sebastian
Sign In or Register to comment.