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

CCA error handling for too few rows #503

Closed
pjcross opened this issue Sep 30, 2015 · 3 comments
Closed

CCA error handling for too few rows #503

pjcross opened this issue Sep 30, 2015 · 3 comments
Assignees

Comments

@pjcross
Copy link
Contributor

pjcross commented Sep 30, 2015

Currently, when the number of inputs or outputs selected in CCA is greater than the number of rows in the table, the CCA model creation will fail and the user will see an error that the number of rows cannot be less than the X/Y variables. Since this problem could be predicted during ingestion, we should catch it up front when the user is making their selections. Also, I am puzzled by a hard failure here. We used to allow this sort of CCA model to be created, it just wasn't very informative because it would always return multiple perfect correlations. I think that the interface should inform the user that this result will be produced given their current set of choices (and allow them to modify their choices) and then if they still want to create the model, we should let them do it.

@alexsielicki
Copy link
Collaborator

Here is the server error when I stopped checking for inputs and outputs <= number of rows:

Traceback (most recent call last):
  File "/home/slycat/src/slycat/web-server/plugins/slycat-cca/slycat-cca.py", line 51, in compute
    x, y, x_loadings, y_loadings, r, wilks = slycat.cca.cca(X, Y, scale_inputs=scale_inputs)
  File "/home/slycat/src/slycat/packages/slycat/cca.py", line 109, in cca
    A = numpy.linalg.solve(R1, L)
  File "/home/slycat/install/conda/lib/python2.7/site-packages/numpy/linalg/linalg.py", line 355, in solve
    _assertNdSquareness(a)
  File "/home/slycat/install/conda/lib/python2.7/site-packages/numpy/linalg/linalg.py", line 212, in _assertNdSquareness
    raise LinAlgError('Last 2 dimensions of the array must be square')
LinAlgError: Last 2 dimensions of the array must be square

@alexsielicki
Copy link
Collaborator

When using 2 inputs and 2 outputs on data that contains 2 rows, I get the following server error:

Traceback (most recent call last):
  File "/home/slycat/src/slycat/web-server/plugins/slycat-cca/slycat-cca.py", line 51, in compute
    x, y, x_loadings, y_loadings, r, wilks = slycat.cca.cca(X, Y, scale_inputs=scale_inputs)
  File "/home/slycat/src/slycat/packages/slycat/cca.py", line 109, in cca
    A = numpy.linalg.solve(R1, L)
  File "/home/slycat/install/conda/lib/python2.7/site-packages/numpy/linalg/linalg.py", line 381, in solve
    r = gufunc(a, b, signature=signature, extobj=extobj)
  File "/home/slycat/install/conda/lib/python2.7/site-packages/numpy/linalg/linalg.py", line 90, in _raise_linalgerror_singular
    raise LinAlgError("Singular matrix")
LinAlgError: Singular matrix

@alexsielicki
Copy link
Collaborator

1 input and 1 output with 2 rows of data creates a model.

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

No branches or pull requests

2 participants