Skip to content
This repository has been archived by the owner on Apr 2, 2020. It is now read-only.

number of selected attributes is wrong in this example #38

Closed
srvanrell opened this issue Dec 9, 2015 · 2 comments
Closed

number of selected attributes is wrong in this example #38

srvanrell opened this issue Dec 9, 2015 · 2 comments
Labels

Comments

@srvanrell
Copy link

it should be 5 instead of 4, am I right?

data = loader.load_file(data_dir + "vote.arff")
data.class_is_last()

from weka.attribute_selection import ASSearch, ASEvaluation, AttributeSelection
search = ASSearch(classname="weka.attributeSelection.BestFirst", options=["-D", "1", "-N", "5"])
evaluator = ASEvaluation(classname="weka.attributeSelection.CfsSubsetEval", options=["-P", "1", "-E", "1"])
attsel = AttributeSelection()
attsel.search(search)
attsel.evaluator(evaluator)
attsel.select_attributes(data)

print("# attributes: " + str(attsel.number_attributes_selected))
print("selected: " + str(attsel.selected_attributes))
print("result string:\n" + attsel.results_string)
@srvanrell srvanrell changed the title number of selected attributes is wrong in this example () number of selected attributes is wrong in this example Dec 9, 2015
@fracpete
Copy link
Owner

fracpete commented Dec 9, 2015

5 including the class attribute, 4 excluding. The array that is returned by Weka contains the class attribute (#16).

@fracpete fracpete closed this as completed Dec 9, 2015
@srvanrell
Copy link
Author

Sorry, Peter, I noticed it late.
The enumeration used in weka vs the one used in python (zero based) confused me.
output wrapper: [ 2 3 9 10 16]
output in results string: 3,4,10,11

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants