Orange Forum • View topic - How to import results made from orange to my program?

How to import results made from orange to my program?

A place to ask questions about methods in Orange and how they are used and other general support.

How to import results made from orange to my program?

Postby iscream » Mon Jan 09, 2012 9:12

Hello,

I'm a university student who is working on spam detection system with my thesis mates.

In the orange canvas, we get AUC from the "Test Learner Widget" and spam detection results from "Confusion Matrix Widget".

We would like to import these results to our program coded in Python to store every test we conduct.

I hope you have understood my question...

Thank you in advance.

Re: How to import results made from orange to my program?

Postby Ales » Mon Jan 09, 2012 14:59

This is currently not possible, but I am working on it.

Re: How to import results made from orange to my program?

Postby iscream » Tue Jan 10, 2012 7:29

Thank you for your effort on developing Orange. Hope to see the new features soon.

Re: How to import results made from orange to my program?

Postby Ales » Wed Jan 25, 2012 16:30

Sorry I could have reported this earlier, but I had no time to test this until now.

This is very basic, but you can now save the experiment results output from the TestLearners widget using the 'Save Object' widget (you need to have Prototypes section enabled: go to Menu -> Options -> Canvas Options (or Orange-> Preferences on Mac), click the 'Widget tab order' tab and check the 'Prototypes' item in the list).

This widget saves any object using the standard Python pickle protocol so you can reload it in your program.

You will have to re compute the AUC and the confusion matrices though. Some code to help you.
Code: Select all
import cPickle
import Orange

res = cPickle.load(open("eval_res.pck", "rb")) # The saved results
# Note the order of the learners and scores might be different then the one reported in the TestLearners widget
print res.learners
auc_scores = Orange.evaluation.scoring.AUC(res)
print auc_scores
matrices = Orange.evaluation.scoring.confusion_matrices(res)
for learner, m in zip(res.learners, matrices):
    print "Learner:", learner
    print m # m is a simple list of lists matrix
    print


Return to Questions & Support



cron