Closed lichunown closed 3 years ago
what do you mean by "will not select features"? The #solve bug is for solving the reshape label issue but not selected features.
Your code is working well. However, I had also tested my code and it can select the features. Maybe you can show the issue in detail?
Sorry, I‘m misunderstood. In this scene, if x.shape
is [n]
, the code xt[:, x == 1]
performed correctly.
However, if x.shape
is [1, n]
, numpy will raise IndexError
. In addition, if the x
is a tensor, the mechanism seems to change. I had experienced similar bugs. So I still suggest to use np.where
instead of matlib-like coding.
lichunown, thank you for your advice and suggestion.
the origin code is:
However, the code such as
xt[:, x == 1]
will not select the features. The solve bug codes are still wrong.In face, the code should be: