The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here

Damned Memory Example Table Change

lenoleno Member Posts: 13 Contributor II
edited November 2018 in Help
Hi to all i have done a process that read a model and apply it to the input data that i give from source code.
My code after init():

      // setup your attribute list
        table = new MemoryExampleTable(master.ListaAttrib);
  //My ListaAttrib has 10 attribute

                input = utile.scalavettor(posx, posy, puntioriginali);
                table.addDataRow(new DoubleArrayDataRow(input));
                 
                exSet = table.createExampleSet();
                ioInput = new IOContainer(new IOObject[]{exSet});

                ioResult = master.process.run(ioInput);
                if (ioResult.getElementAt(0) instanceof ExampleSet) {
                    resultSet = (ExampleSet) ioResult.getElementAt(0);
                    e = resultSet.getExample(0);
                    predettoX = e.getPredictedLabel();
                }
The problem is that code is in a loop and at every iteration the MemoryExampleTable has more Attribute, because the apply model add label and confidence.
With a wrong number of attribute my model don't work.
I try removeattribute but seem that nothing change.

I need it for my Master Thesis everyone can help me?

Regards

Nello
Tagged:

Answers

  • Marco_BoeckMarco_Boeck Administrator, Moderator, Employee-RapidMiner, Member, University Professor Posts: 1,996 RM Engineering
    Hi,

    if these attributes are used nowhere else, you can try this line:

    exampleSet.getExampleTable().removeAttribute(existingAttribute);
    However, if this attribute might occur in other exampleSets or other attribute instances might use the same
    ExampleTable's column, you should use this:

    exampleSet.getAttributes().remove(existingAttribute);
    Regards,
    Marco
  • dacamo76dacamo76 Member Posts: 9 Contributor II
    Hi leno,

    I don't quite understand your problem.
    Models don't take into account special attributes. When a model adds a label and confidence, they are added as special attributes. You can pass an example set with predictedLabel and confidence attributes to a model and they will be ignored. Are you sure the problem is with the model? Could it be another operator in your process?

    From what I can see in your example code, it looks like you are adding a single data row to an example set and applying a model on that single example.
    If there is no special need for you to apply a single example every time, you could just add all the examples to the example set and apply the model once on all the examples.
    This should alleviate your problem of looping and having an example set with extra attributes.
Sign In or Register to comment.