@jnothman there is something I can't undestand about the example you give in the issue: Even when we are uncommenting the line yy[3,:] = [1,0,0,0,0], the third column of yy is constant, but in that case pls2.fit(xx, yy) works. Do we need two columns to be constant for the PLS to fail?
After taking a deeper look at the problem, the problem is not constant features. The problem is that the first column of the target (yy) is constant. For instance, this case will work (constant features and some constant columns in the target that are not the first column):
This is because the first step of the _nipals_twoblocks_inner_loop algorithm is to calculate y_score = Y[:, ] and this will cause the x_weights = np.dot(X.T, y_score) / np.dot(y_score.T, y_score) to be an array of nan. This happens because _center_scale_xy will cause the first column of yy to be a column of zeros.
Originally reported at #2089 (comment) by @Franck-Dernoncourt. Reproduce with:
The obscure error message is due to the presence of a column containing only 0.
The text was updated successfully, but these errors were encountered: