-
Notifications
You must be signed in to change notification settings - Fork 214
Open
Description
training = np.array(training)
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 2 dimensions. The detected shape was (29, 2) + inhomogeneous part.
Try these !!! If u encounter an error above.
#reaplace code
training = np.array(training)
train_x = list(training[:, 0])
train_y = list(training[:, 1])
#as below
train_x = np.array([pair[0] for pair in training])
train_y = np.array([pair[1] for pair in training])
I think it raise valueerror due to array element not match.
#For example:
# Invalid (sublists have different lengths)
data = [[1, 2], [3], [4, 5, 6]]
np.array(data) # Will raise the error
# Valid (all sublists have the same length)
data = [[1, 2], [3,4], [5, 6]]
np.array(data) # OK
Metadata
Metadata
Assignees
Labels
No labels