Skip to content

failing region_k_means test with bleeding edge libpysal #346

@jGaboardi

Description

@jGaboardi

This seems to have started failing with pysal/libpysal#511. However, adding either sort_joins={True, False} to this line results in the same failure. Perhaps I am missing an obvious detail?

[gw1] darwin -- Python 3.11.0 /Users/the-gaboardi/miniconda3/envs/py311_spopt/bin/python3.11

self = <spopt.tests.test_region_k_means.TestRegionKMeansHeuristic object at 0x168a95f90>

    @pytest.mark.filterwarnings("ignore:The weights matrix is not fully")
    def test_region_k_means_heuristic_synth_small(self):
        model = RegionKMeansHeuristic(
            self.data_small, self.reg_small, self.w_small, seed=RANDOM_STATE
        )
        model.solve()
    
>       numpy.testing.assert_equal(model.labels_, self.known_labels_small)

spopt/tests/test_region_k_means.py:45: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

args = (<built-in function eq>, array([1, 0, 0, 0, 1, 2, 1, 0, 2]), [1, 1, 1, 0, 1, 2, ...])
kwds = {'err_msg': '', 'header': 'Arrays are not equal', 'strict': False, 'verbose': True}

    @wraps(func)
    def inner(*args, **kwds):
        with self._recreate_cm():
>           return func(*args, **kwds)
E           AssertionError: 
E           Arrays are not equal
E           
E           Mismatched elements: 3 / 9 (33.3%)
E           Max absolute difference: 1
E           Max relative difference: 1.
E            x: array([1, 0, 0, 0, 1, 2, 1, 0, 2])
E            y: array([1, 1, 1, 0, 1, 2, 0, 0, 2])

../miniconda3/envs/py311_spopt/lib/python3.11/contextlib.py:81: AssertionError

cc @knaaptime

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions