Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessing statistics of support and confidence for rule classifiers defined in weka.classifiers.rules #29

Closed
Mahima-ai opened this issue Apr 4, 2020 · 5 comments
Labels

Comments

@Mahima-ai
Copy link

Hey @fracpete ,

I am working on the rule generation methods OneR, PRISM, JRIP, PART, Decision list and others available in Weka using python-weka-wrapper. I want to get the basic statistics like coverage, confidence, true positive etc. of the generated rules. I got the rules as a string using toString() method on the Classifier object.

I was trying to use the RuleStats class defined in Weka for this but unable to figure out how to use it. So, can you help me with using RuleStat or suggest a way to get the ruleset for all the rule generation methods and the statistics for each rule?

Any help in this regard will be highly appreciated.

@fracpete
Copy link
Owner

fracpete commented Apr 4, 2020

Due to historic reasons, most classifiers implement their own, independent data structures. The RuleStats class is only used by JRip. Parsing the string representation of rules and then turning them back into Java data structures (from within Python using pww) seems an arduous process.
If you still want to pursue the rule parsing, I'd recommend to use Weka's classes in a more direct way, either through Java, Groovy or Jython (the latter two are scripting languages that run directly in the JVM).

@Mahima-ai
Copy link
Author

Due to historic reasons, most classifiers implement their own, independent data structures. The RuleStats class is only used by JRip. Parsing the string representation of rules and then turning them back into Java data structures (from within Python using pww) seems an arduous process.
If you still want to pursue the rule parsing, I'd recommend to use Weka's classes in a more direct way, either through Java, Groovy or Jython (the latter two are scripting languages that run directly in the JVM).

@fracpete , thanks for the instant reply.

Yes, I am able to get the ruleset for JRIP. For other methods, the rules are as a weka.classifier.Classifier object, so can you tell me which Weka classes should I use to get the ruleset from this classifier object. I need to provide the ruleset as a parameter to the RuleStats class for getting the statistics.

@fracpete
Copy link
Owner

fracpete commented Apr 5, 2020

These other classes do not provide an interface for accessing the rules, as far as I know (maybe there are protected methods, but you'd have to dig in the source code for that).
weka.classifiers.Classifier is the general interface that all classification and regression algorithms share. It does not give you any access to rule sets.

@Mahima-ai
Copy link
Author

These other classes do not provide an interface for accessing the rules, as far as I know (maybe there are protected methods, but you'd have to dig in the source code for that).
weka.classifiers.Classifier is the general interface that all classification and regression algorithms share. It does not give you any access to rule sets.

Thanks a lot for your help. I will try to find out a way for this.

BTW, the python-weka-wrapper3 is of great help to me. It saved the development time for me.

@Mahima-ai
Copy link
Author

Hey,

I solved the issue by parsing the classifier outputs and creating methods for computing the statistics in Python. This is working fine.

I agree to close this issue.

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

No branches or pull requests

2 participants