garydoranjr / misvm

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

BUG: Fix Python 3 compatibility #17

Closed nwschurink closed 5 years ago

nwschurink commented 5 years ago

For Python 3 support map() function should be explicitly converted to a list if the object that is mapped is used more than once. In the old implementation of e.g. smil.py, bs.neg_bags evaluates the mapped input: map(np.asmatrix,bags); then this same input is evaluated by bs.pos_bags. However, because in Python 3 map() returns an iterator, this iterator object was destroyed at the first evaluation and returns an empty object at the second evaluation. There are several of these issues throughout the code, which have been resolved in this commit.

garydoranjr commented 5 years ago

Thanks, @nwschurink!