Due to recent updates, all users are required to create an Altair One account to login to the RapidMiner community. Click the Register button to create your account using the same email that you have previously used to login to the RapidMiner community. This will ensure that any previously created content will be synced to your Altair One account. Once you login, you will be asked to provide a username that identifies you to other Community users. Email us at Community with questions.

Different versions of AbstractExampleTable

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

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) {
table.removeDataRow(i);
}
else {
i++;
}
}
}

ExampleSet copy = table.createExampleSet(set);
copy.getAttributes().setLabel(label);

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?

Thanks.
Sign In or Register to comment.