python shape too large to be a matrix
Just guessing, but since the data comes from a csv file, it was converted to np.matrix
, which have the restriction to be 2-dimensional.
Internally numpy will try to keep the dimensions of the matrix, so to reshape to higher dimensions, you will need to convert it to a ndarray
like this:
X_Train = np.array(X_Train)X_Test = np.array(X_Test)X_Train40 = X_Train.reshape(10074, 3, 6, 1)X_Test40 = X_Test.reshape(4319, 3, 6, 1)
You know... I had this problem today and I could not find a single answer that helped.
Your problem is probably solved at this point, but one thing to look at when python complains about "shape too large to be a matrix" is the type of your variable, namely, is it a numpy.matrix data type or a numpy.ndarray?
If it is the former, then you are in troubles.
Try to avoid numpy.matrix type, specially if you want to do any linear algebra operations, or stack them (with (d/v/h)stack, etc) and stick to numpy.ndarray