After searching for more than 2 hours, the problem of code error reporting was finally solved. Let me commemorate it

The final reason is that I am not skilled in building the database myself, ┭┮﹏┭┮

First, the error message: IndexError: index 4392 is out of bounds for axis 0 with size 20.

It means that the index of the first dimension of the array overflows. For example, the index of the first dimension of the array a is only 20, but a [4392] appears, so an error is reported.

When I saw this line of error reporting, I was completely at a loss. I didn’t know how to start. I repeatedly checked whether the data in my dataset was constructed incorrectly. I never thought that the label was wrong, because it was doing self-encoding and unsupervised learning. The participation of the label is not required, so it is completely ignored. When writing this line, I did not think carefully, so I must take it as a warning, and the thinking must be clear.

How should I modify it in the end?

label = np.zeros([num, length])

should be changed to

label = np.zeros([num, 1])

The data and target returned to the database are as follows

# data[num,len],label[num]

Guess you like

Origin blog.csdn.net/giaogiaoxiong/article/details/127308098