Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pyclustering.core.metric_wrapper] Callback failure for user-defined function #422

Open
annoviko opened this issue Apr 25, 2018 · 1 comment
Assignees
Labels
Bug Tasks related to found bugs Good First Issue Tasks that can be easily done by contributors

Comments

@annoviko
Copy link
Owner

annoviko commented Apr 25, 2018

Introduction
In case of user-defined metric, algorithms doesn't use core to avoid crash on some platforms.

Description
Investigation is required. See test: 'testUserDefinedMetric'.
Test location: pyclustering/utils/tests/integration/it_metric.py

Ran 6 tests in 0.016s

FAILED (errors=1)

Error
Traceback (most recent call last):
  File "D:\Miniconda3\envs\test-environment\lib\unittest\case.py", line 58, in testPartExecutor
    yield
  File "D:\Miniconda3\envs\test-environment\lib\unittest\case.py", line 580, in run
    testMethod()
  File "D:\workspace\pyclustering\pyclustering\utils\tests\integration\it_metric.py", line 71, in testUserDefinedMetric
    assertion.eq(2.0, metric_instance([0.0, 0.0], [2.0, 0.0]));
  File "D:\workspace\pyclustering\pyclustering\core\metric_wrapper.py", line 65, in __call__
    return ccore.metric_calculate(self.__pointer, point_package1, point_package2);
OSError: [WinError -1073741795] Windows Error 0xc000001d

Technical details
Crash occurs in pyclustering core, interface file: pyclustering/ccore/src/interface/metric_interface.cpp.

            auto functor_wrapper = [p_solver](const point & p1, const point & p2) {
                pyclustering_package * point1 = create_package(&p1);
                pyclustering_package * point2 = create_package(&p2);

                const double distance = p_solver(point1, point2); <--- crash here.

                delete point1;
                delete point2;

                return distance;
            };
@annoviko annoviko self-assigned this Apr 25, 2018
@annoviko annoviko added Bug Tasks related to found bugs Good First Issue Tasks that can be easily done by contributors labels Apr 25, 2018
@annoviko
Copy link
Owner Author

Workaround implemented: user-defined metrics are forbidden for passing to CCORE, in case of user-defined metric python code is used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Tasks related to found bugs Good First Issue Tasks that can be easily done by contributors
Projects
None yet
Development

No branches or pull requests

1 participant