neurodata / mgcpy-old

MGCPY WILL NO LONGER BE UPDATED. THE NEW REPO CAN BE FOUND HERE:
https://github.com/neurodata/hyppo
Apache License 2.0
31 stars 45 forks source link

type error when using MGC.p_value() on longs #153

Open tathey1 opened 5 years ago

tathey1 commented 5 years ago

Describe the bug data type error when using MGC.p_value() on long type

To Reproduce from mgcpy.independence_tests.mgc import MGC a = np.array([[1.,1.],[1.,1.]]) b = np.array([[2.,2.],[2.,2.]]) mgc.p_value(a,b) Expected behavior I expected this to work.

Error output

ValueError Traceback (most recent call last) in 8 a = np.array([[1.,1.],[1.,1.]]) 9 b = np.array([[2.,2.],[2.,2.]]) ---> 10 mgc.p_value(a,b) 11 12 indices_1 = np.cumsum(n1)

~\Anaconda3\lib\site-packages\mgcpy-0.3.0-py3.7-win-amd64.egg\mgcpy\independence_tests\mgc.py in p_value(self, matrix_X, matrix_Y, replication_factor, is_fast, fast_mgc_data) 226 return p_value, p_value_metadata 227 else: --> 228 return super(MGC, self).p_value(matrix_X, matrix_Y) 229 230 def _fast_mgc_p_value(self, matrix_X, matrix_Y, sub_samples=10):

~\Anaconda3\lib\site-packages\mgcpy-0.3.0-py3.7-win-amd64.egg\mgcpy\independence_tests\abstract_class.py in p_value(self, matrix_X, matrix_Y, replication_factor) 89 90 # calculte the test statistic with the given data ---> 91 test_statistic, independence_test_metadata = self.test_statistic(matrix_X, matrix_Y) 92 93 if self.get_name() == "unbiased":

~\Anaconda3\lib\site-packages\mgcpy-0.3.0-py3.7-win-amd64.egg\mgcpy\independence_tests\mgc.py in test_statistic(self, matrix_X, matrix_Y, is_fast, fast_mgc_data) 88 distance_matrix_X, distance_matrix_Y = compute_distance(matrix_X, matrix_Y, self.compute_distance_matrix) 89 local_correlation_matrix = local_correlations(distance_matrix_X, distance_matrix_Y, ---> 90 base_global_correlation=self.base_global_correlation)["local_correlation_matrix"] 91 m, n = local_correlation_matrix.shape 92 if m == 1 or n == 1:

mgcpy\independence_tests\mgc_utils\local_correlation.pyx in mgcpy.independence_tests.mgc_utils.local_correlation.local_correlations()

mgcpy\independence_tests\mgc_utils\local_correlation.pyx in mgcpy.independence_tests.mgc_utils.local_correlation.local_correlations()

mgcpy\independence_tests\mgc_utils\local_correlation.pyx in mgcpy.independence_tests.mgc_utils.local_correlation.local_covariance()

ValueError: Buffer dtype mismatch, expected 'int_t' but got 'long long'

Desktop (please complete the following information): -Recently downloaded off pip, using Windows 10

benfreoa commented 5 years ago

Did you find a solution ? I have the same error ...

shiyussy commented 5 years ago

I have the same error. I think that may be caused by that it has to do with how python interprets types, and how C interprets types when using Cython.

sampan501 commented 5 years ago

I've fixed this and should be in the next release

sampan501 commented 4 years ago

Since you are using Windows 10, I think you might also need to install a compiler for Cython. I can update these instructions in the ReadMe. Instructions for this can be found here: https://wiki.python.org/moin/WindowsCompilers