Damned Memory Example Table Change
leno
New Altair Community Member
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():
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
My code after init():
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.
// 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();
}
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
0
Answers
-
Hi,
if these attributes are used nowhere else, you can try this line:
However, if this attribute might occur in other exampleSets or other attribute instances might use the same
exampleSet.getExampleTable().removeAttribute(existingAttribute);
ExampleTable's column, you should use this:
Regards,
exampleSet.getAttributes().remove(existingAttribute);
Marco0 -
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.0