Different versions of AbstractExampleTable

maalvarezmaalvarez Member Posts: 4 Contributor I
edited November 2018 in Help

I am developing an operator and I need to do a copy of an ExampleSet.
My code is below:

public static ExampleSet getSubSet(ExampleSet original, String cad) {
MemoryExampleTable table = MemoryExampleTable.createCompleteCopy(original.getExampleTable());
List<Attribute> attributes = Lists.newArrayList(table.getAttributes());
AttributeSet set = new AttributeSet(attributes, new HashMap<String, Attribute>());
Attribute label = original.getAttributes().getLabel();

if(!cad.equals("")) {
DataRow dr = null;
int value = label.getMapping().getIndex(cad);
int i = 0;

while(i < table.size()) {
dr = table.getDataRow(i);

if(dr.get(label) == value) {
else {

ExampleSet copy = table.createExampleSet(set);

return copy;
when "original" is the original ExampleSet. Also, I don't want to delete the examples that contains the label "cad" in case of it is the empty string .
In summary, this method returns a subset of an ExampleSet.

The problem is that method calls "createCompleteCopy" method from MemoryExampleTable and it returns an error.
I have found the error from the next trace:

getSubSet --> createCompleteCopy
-> MemoryExampleTable(List<Attribute> attributes) [Constructor]
-> AbstractExampleTable(List<Attribute> attributes) [Constructor] --> addAttributes --> addAttribute
The version of the repository method "addAttribute" is different from installed version... Why?

PS: can anyone say me another way to get a subset of an ExampleSet?

Sign In or Register to comment.