garydoranjr / misvm

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

Different results in python 2.7.8 and python 3.6.8 #19

Open RedonaBrahimetaj opened 5 years ago

RedonaBrahimetaj commented 5 years ago

Hello, I have noticed a considerable difference on my results when running the exact same code in python 2.7.8 and python 3.6.8. I have been considering results as correct when running on python 3.6.8 taking into account that the support/test for the used libraries is better for python 3.6.8 but I would like to ask whether you have fully tested your implementation for python 3.6 or i should consider python 2.7. Does anyone come across the same issue? Or, are there specific versions of libraries that I should use? Thanks in advance, Redona

garydoranjr commented 5 years ago

Hello @RedonaBrahimetaj, thank you for letting me know about the discrepancy in results between Python 2.7 and Python 3.6.

Is this specifically when running the included example, or in other scenarios as well? If it occurs in other scenarios, would you share example code that reproduces the behavior?

I was able to reproduce the discrepancy when running this example, but I traced it back to differences in ordering of the bags when the example code is run (since the example only does one train/test split, there is a lot of variance in the result given changes in the ordering of the examples). Specifically, when I sort the items of the dictionary in this line:

https://github.com/garydoranjr/misvm/blob/edde284f597799b1910941c2d44de71f815ea0b7/example/misvmio.py#L262

the results agree across Python versions.

That being said, I originally wrote the library in Python 2.7 and I'm more confident in the correctness of the code when running under that version. Other developers have contributed to making the code compatible with Python 3, but I have not personally tested extensively running this library under Python 3.