Orange Forum • View topic - Weired errors with orngSVM

Weired errors with orngSVM

Report bugs (or imagined bugs).
(Archived/read-only, please use our ticketing system for reporting bugs and their discussion.)
Forum rules
Archived/read-only, please use our ticketing system for reporting bugs and their discussion.

Weired errors with orngSVM

Postby aonlazio » Sat Aug 01, 2009 1:58

I tried to save an SVM classifier in MySQL using cPickle module with this code

rs_table = 'test'

create table %s
ident int not null auto_increment,name char(100),ablob LONGBLOB,
primary key (ident)
""" % rs_table )

data = orange.ExampleTable('iris')

learner = orngSVM.SVMLearner(svm_type=orange.SVMLearner.C_SVC,kernel_type = orange.SVMLearner.RBF)
classifier = learner(data)
cc = cPickle.dumps(classifier,2)

cursor.execute("""insert into %s (%s,%s) values ("%s","%s")""" % (rs_table,'name','ablob','one',MySQLdb.escape_string(cc)))

cursor.execute("""select * from %s""" % rs_table)

row = cursor.fetchone()
tesid = row['name']
return_classifier = cPickle.loads(row['ablob'])
print return_classifier(data[0])

Then I got this weired errors

File "C:\Python25\lib\site-packages\orange\", line 130, in __getattr__
return getattr(self.classifier, name)
File "C:\Python25\lib\site-packages\orange\", line 130, in __getattr__
return getattr(self.classifier, name)
RuntimeError: maximum recursion depth exceeded

The line 130 error repeated lilke 200 times before maximum recursion depth error

I then went to comment out the __getattr__ method in orngSVM line 130 then everything works fine. I did not understand this behaviour and the mechanism behind it. Did I do it right or this is a real bug?
Thanks in advance

Postby Janez » Sat Aug 01, 2009 8:48

The builtin function getattr calls the class' __getattr__, so this is definitely an infinite recursion. __getattr__ should call the inherited __getattr__. (This is not to say that I'm not prone to make exactly the same mistake now and then.)

But as I can see the method doesn't add anything to the method it overloads (except for causing the error, that is), so commenting it out should be OK. The method might be a remnant of something that was intended but later removed.


Postby Ales » Tue Aug 18, 2009 15:51

Actually it was the
Code: Select all
part that was the problem and this bug only expresses it self during unpickling. It is fixed now.

BTW. This function just exposes some members (supportVectors, coef, ...) from orange.SVMClassifier to the wrapper.

Postby aonlazio » Mon Sep 21, 2009 2:47

Thanks so much, this fix take the mountain off my chest

Return to Bugs