Orange Forum • View topic - random doesnot work

random doesnot work

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

random doesnot work

Postby kepela » Sat Aug 20, 2005 20:39

in the document for beginners,
the script accuracy4.py cant get the random result
the result of document is
Code: Select all
1: [0.9007633587786259, 0.79389312977099236]
2: [0.9007633587786259, 0.79389312977099236]
3: [0.95419847328244278, 0.92366412213740456]
4: [0.87786259541984735, 0.86259541984732824]
5: [0.86259541984732824, 0.80152671755725191]
6: [0.87022900763358779, 0.80916030534351147]
7: [0.87786259541984735, 0.82442748091603058]
8: [0.92366412213740456, 0.93893129770992367]
9: [0.89312977099236646, 0.82442748091603058]
10: [0.92366412213740456, 0.86259541984732824]
Classification accuracies:
bayes 0.898473282443
tree 0.843511450382

bye mine is
Code: Select all
>>> 1: [0.89312977099236646, 0.96183206106870234]
2: [0.89312977099236646, 0.96183206106870234]
3: [0.89312977099236646, 0.96183206106870234]
4: [0.89312977099236646, 0.96183206106870234]
5: [0.89312977099236646, 0.96183206106870234]
6: [0.89312977099236646, 0.96183206106870234]
7: [0.89312977099236646, 0.96183206106870234]
8: [0.89312977099236646, 0.96183206106870234]
9: [0.89312977099236646, 0.96183206106870234]
10: [0.89312977099236646, 0.96183206106870234]
Classification accuracies:
bayes 0.893129770992
tree 0.961832061069


my pc is windows 2000 and installed the orgage all-in-one pacakge from here, and updated to pythonwin2.3.5
why the random can't work? thanks in advance for any advancing

Postby kepela » Sun Aug 21, 2005 8:21

change the source code
from
Code: Select all
    for i in range(n):
        selection = orange.MakeRandomIndices2(data, p)
        train_data = data.select(selection, 0)
        test_data = data.select(selection, 1)


to
Code: Select all
    selection = orange.MakeRandomIndices2(p0 = p)
    selection.randomGenerator = orange.RandomGenerator(7)
    for i in range(n):
        seresult = selection(data)
        train_data = data.select(seresult, 0)
        test_data = data.select(seresult, 1)


and the result is
Code: Select all
1: [0.94656488549618323, 0.93893129770992367]
2: [0.84732824427480913, 0.95419847328244278]
3: [0.9007633587786259, 0.95419847328244278]
4: [0.8854961832061069, 0.94656488549618323]
5: [0.9007633587786259, 0.94656488549618323]
6: [0.91603053435114501, 0.96183206106870234]
7: [0.89312977099236646, 0.95419847328244278]
8: [0.89312977099236646, 0.98473282442748089]
9: [0.90839694656488545, 0.98473282442748089]
10: [0.92366412213740456, 0.94656488549618323]


here is the reason
http://www.ailab.si/orange/doc/reference/randomindices.htm


Return to Questions & Support



cron