ValueError:输入形状错误(4、3)
我尝试了此功能:
X_train = np.argmax(X_train, axis=1)
Y_train = np.argmax(Y_train)
但在调用fit函数时不会更改错误。
X_train = np.array(X[0:int(0.80*len(X))])
Y_train = np.array(Y[0:int(0.80*len(Y))])
print (X_train.shape, Y_train.shape)
#Output: (4, 3) (4,)
from sklearn import preprocessing
lab_enc = preprocessing.LabelEncoder()
X_train = lab_enc.fit_transform(X_train)
Y_train = lab_enc.fit_transform(Y_train)
我期望:
X_train = lab_enc.fit_transform(X_train)
Y_train = lab_enc.fit_transform(Y_train)
接受numpy数组格式