garydoranjr / misvm

Multiple-Instance Support Vector Machines
BSD 3-Clause "New" or "Revised" License
234 stars 81 forks source link

Attribute Error running example code #5

Closed giffy1 closed 8 years ago

giffy1 commented 8 years ago

Hey there, I was happy to see this extensive work on Multiple Instance Learning, but I ran into an error running your example code. Could it be that I installed it or its dependencies incorrectly? The problem is in cvxopt. Am I not using the correct version?

pcost dcost gap pres dres 0: -4.7135e+01 -1.9465e+00 3e+03 5e+01 4e-09 Traceback (most recent call last):

...

File "/Users/snoran/misvm_example/example.py", line 38, in main classifier.fit(train_bags, train_labels)

File "/Users/snoran/cvxopt-1.1.8/src/misvm/misvm/sil.py", line 44, in fit super(SIL, self).fit(svm_X, svm_y)

File "/Users/snoran/cvxopt-1.1.8/src/misvm/misvm/svm.py", line 67, in fit self.verbose)

File "/Users/snoran/cvxopt-1.1.8/src/misvm/misvm/quadprog.py", line 105, in quadprog return qp.solve(verbose)

File "/Users/snoran/cvxopt-1.1.8/src/misvm/misvm/quadprog.py", line 65, in solve initvals=self.last_results)

File "build/bdist.macosx-10.5-x86_64/egg/cvxopt/coneprog.py", line 4468, in qp return coneqp(P, q, G, h, None, A, b, initvals, options = options)

File "build/bdist.macosx-10.5-x86_64/egg/cvxopt/coneprog.py", line 2243, in coneqp if iters == 0: W = misc.compute_scaling(s, z, lmbda, dims)

File "build/bdist.macosx-10.5-x86_64/egg/cvxopt/misc.py", line 285, in compute_scaling W['d'] = base.sqrt( base.div( s[mnl:mnl+m], z[mnl:mnl+m] ))

AttributeError: 'module' object has no attribute 'div'

garydoranjr commented 8 years ago

Hello,

I haven't seen this error before; it is occurring within CVXOPT as you say (doesn't seem to be a missing dependency). Is it possible you are importing another module named "base" that is conflicting with the CVXOPT "base" module? You can try running the CVXOPT example code to see if that breaks too. Otherwise, you might ask the CVXOPT folks about this: https://github.com/cvxopt/cvxopt

giffy1 commented 8 years ago

Thanks for the help - it turns out that it worked when I installed an older version of cvxopt (1.1.6 instead of 1.1.8).