convert collection to a single table (ExampleSet)

acurielacuriel Member Posts: 13 Contributor I
edited November 2018 in Help
I'm using loop values and it generates different tables (ExampleSet) by value with the same attributes.
I need to have a table with all.

my out is

collection

table value 23: 
                  USER_ID  ITEM_ID
                  1          23

table value 54:
              USER_ID  ITEM_ID
                  1          54
...                     

I need this

ExampleSet
 
              USER_ID  ITEM_ID
                  1          23
                  1          54
                  ...        ...

Thanks
Tagged:

Answers

  • Marco_BoeckMarco_Boeck Team Lead Software Engineering Moderator, Employee, Member, University Professor Posts: 1,782   RM Engineering
    Hi,

    you've posted in the Development forum, so I'm assuming you want to know how to do it in Java. You will need to create a new ExampleSet with the same attributes as your existing sets have. You can then loop over each example (row) of each example set and add a row for each to the new one. See below for a quick example:

    MemoryExampleTable table = new MemoryExampleTable(listOfAtts);

    for (ExampleSet exSet : listOfExampleSets) {
    for (Example e : exSet) {
    table.addDataRow(e.getDataRow());
    }
    }

    ExampleSet exSet = table.createExampleSet();
    In case you were looking for a solution inside RapidMiner Studio, just use the "Append" operator.

    Regards,
    Marco
Sign In or Register to comment.