Reputation: 157
Hi I'am trying to run script for a Kaggle competition.
you can see the whole script here
But when I run this script i get an ValueError
ValueError: n_components must be < n_features; got 1 >= 1
Can somebody tell me please how to find out how many features there are at this point. I don't think it will be usefull when I set n_components to 0. I also read the documentation but I can't solve that issue. Greetz Alex
Upvotes: 2
Views: 4991
Reputation: 14377
It is highly likely that the shape of your data matrix is wrong: It seems to have only one column. That needs to be fixed. Use a debugger to figure out what goes into the fit
method of the TruncatedSVD
, or unravel the pipeline and do the steps by hand.
As for the error message, if it is due to a matrix with one column, this makes sense: You can only have maximally as many components as features. Since you are using TruncatedSVD
it additionally assumes that you don't want the full feature space, hence the strict inequality.
Upvotes: 1