java - Weka instance.setValue arrayIndexOutOfBounsException -


good afternoon! have such method:

private instances getoneinstanceinstances(map<string, double> attributesmap) {     fastvector fvwekaattributes = new fastvector(attributesmap.size() + 1);      (string attributename : attributesmap.keyset()) {         attribute attribute = new attribute(attributename);         fvwekaattributes.addelement(attribute);     }      fastvector fvclassval = new fastvector(2);     fvclassval.addelement(integer.tostring(0));     fvclassval.addelement(integer.tostring(1));     fvwekaattributes.addelement(new attribute("class", fvclassval));      instances instances = new instances("features", fvwekaattributes,1);     instances.setclassindex(instances.attribute("class"));      instance instance = new instance(fvwekaattributes.capacity());     instance.setdataset(instances);      (string attributename : attributesmap.keyset()) {         attribute attribute = new attribute(attributename);         instance.setvalue(attribute, attributesmap.get(attributename));;     }      instance.setclassmissing();     instances.add(instance);          return instances; } 

and when run it, throw

java.lang.arrayindexoutofboundsexception: -1 @ weka.core.instance.setvalue(instance.java:643) @ weka.core.instance.setvalue(instance.java:716) @ uir.prunning.prunner.getoneinstanceinstances(prunner.java:189) 

as think, instance know it's attributes, , looks ok me, doesn't work. what's problem , how can fix it? thank you!


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -