pattern3 / pattern

Goal: make Pattern compatible with Python 3.
http://www.clips.ua.ac.be/pages/pattern
BSD 3-Clause "New" or "Revised" License
59 stars 35 forks source link

Vector #17

Open hayd opened 9 years ago

hayd commented 9 years ago

There's a failing test on py3, classification correct 50% of the time (always correct on python 2).

hayd commented 9 years ago

@tom-de-smedt It would be good to get some expert eyes on this! (tbh I'm not sure what I'm looking for whilst debugging.) The test is nosetests test/test_vector.py:TestClassifier.test_igtree. :)

hayd commented 9 years ago

bump. @tom-de-smedt ?

hayd commented 9 years ago

Actually on looking again the tests are intermittant failures. This makes me think a. we aren't seeding enough (perhaps as python 3 walks tests/dicts in a different/random order). But also there is some hidden logic failures (which may also exist on python 2).

Run a few times... (nearly) all different :cry::

(py34) % nosetests test/test_vector.py
.............................F.............................
======================================================================
FAIL: test_model_reduce (test_vector.TestLSA)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/andy/proj/pattern/test/test_vector.py", line 784, in test_model_reduce
    self.assertTrue(t2 * 2 < t1)       # KNN over 2x faster.
AssertionError: False is not true

----------------------------------------------------------------------
Ran 59 tests in 40.858s

FAILED (failures=1)
(py34) % nosetests test/test_vector.py
..F........................................................
======================================================================
FAIL: test_igtree (test_vector.TestClassifier)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/andy/proj/pattern/test/test_vector.py", line 984, in test_igtree
    self._test_classifier(vector.IGTREE, method=vector.GAINRATIO)
  File "/Users/andy/proj/pattern/test/test_vector.py", line 938, in _test_classifier
    self.assertEqual(v.classify(message), type)
AssertionError: False != True

----------------------------------------------------------------------
Ran 59 tests in 37.582s

FAILED (failures=1)
(py34) % nosetests test/test_vector.py
..E........................................................
======================================================================
ERROR: test_igtree (test_vector.TestClassifier)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/andy/proj/pattern/test/test_vector.py", line 984, in test_igtree
    self._test_classifier(vector.IGTREE, method=vector.GAINRATIO)
  File "/Users/andy/proj/pattern/test/test_vector.py", line 945, in _test_classifier
    v.save(Classifier.__name__)
  File "/Users/andy/proj/pattern/test/../pattern/vector/__init__.py", line 2430, in save
    f.write(cPickle.dumps(self, 1))  # 1 = binary
RuntimeError: maximum recursion depth exceeded while calling a Python object

----------------------------------------------------------------------
Ran 59 tests in 31.865s

FAILED (errors=1)
(py34) % nosetests test/test_vector.py
...........................................................
----------------------------------------------------------------------
Ran 59 tests in 44.550s

OK
(py34) % nosetests test/test_vector.py
..F........................................................
======================================================================
FAIL: test_igtree (test_vector.TestClassifier)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/andy/proj/pattern/test/test_vector.py", line 984, in test_igtree
    self._test_classifier(vector.IGTREE, method=vector.GAINRATIO)
  File "/Users/andy/proj/pattern/test/test_vector.py", line 938, in _test_classifier
    self.assertEqual(v.classify(message), type)
AssertionError: False != True

----------------------------------------------------------------------
Ran 59 tests in 29.723s

FAILED (failures=1)

Perhaps there is a cache which is getting propogated in a random (due to python dict no longer being ordered)... Eeeep.