"recreate exampleset after feature selection in javacode"

mwmw Member Posts: 2 Contributor I
edited May 2019 in Help
Hi all,

I can't find out how to rebuild or reduce my exampleset after feature selection in javacode, I've been trying for days. In Weka's AttributeSelection you can do that by using reduceDimensionality. My features are numeric and my classlabel is nominal. Before feature selection I have about 500 examples in my exampleset each represented by over a thousand attributes. Attribute selection reduces those thousand attributes to, say, 20 attributes. How can I represent the 500 examples in my exampleset represent with the 20 attributes in javacode?

Any suggestion will be much appreciated,

Martine

Answers

  • landland RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 2,531 Unicorn
    Hi Martine,
    if you want to remove an attribute from a given example set, simply use this code:
    Attributes attributes = exampleSet.getAttributes();
    Iterator<Attribute> iterator = attributes.iterator();
    while(iterator.hasNext()) {
      Attribute attribute = iterator.next();
      if (matchesSomeCondition(attribute)) {
        iterator.remove();
      }
    }
    Greetings,
      Sebastian
  • landland RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 2,531 Unicorn
    Hi,
    since I noticed your other post that you are still using RapidMiner 4.2, I must append, that I'm not sure if it works this way in this ancient version.

    Greetings,
      Sebastian
Sign In or Register to comment.