Skip to content
This repository has been archived by the owner on Apr 2, 2020. It is now read-only.

double_matrix_to_ndarray falsely assumes square matrices #48

Closed
chausner opened this issue Oct 22, 2016 · 1 comment
Closed

double_matrix_to_ndarray falsely assumes square matrices #48

chausner opened this issue Oct 22, 2016 · 1 comment
Assignees
Labels

Comments

@chausner
Copy link

The implementation of double_matrix_to_ndarray assumes that the passed Java matrix is a square matrix. This may be true for confusion matrices but it's definitely an error for Classifier.distributions_for_instances. When there are more instances than class labels, distributions_for_instances works but returns a too big numpy array. When there are less instances than class labels, distributions_for_instances throws an exception:

File "C:\Program Files (x86)\Python27\lib\site-packages\weka\classifiers.py", line 129, in distributions_for_instances
return arrays.double_matrix_to_ndarray(self.__distributions(data.jobject))
File "C:\Program Files (x86)\Python27\lib\site-packages\weka\core\types.py", line 74, in double_matrix_to_ndarray
result[i][n] = element
IndexError: index 3 is out of bounds for axis 0 with size 3

@fracpete
Copy link
Owner

That's fixed now. Thanks for reporting!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants