Tôi đang cố gắng đào tạo một mô hình Keras dựa trên các tính năng từng phần từ tập dữ liệu của tôi. Tôi đã nạp dữ liệu thiết lập và khai thác các tính năng như vậy:Pandas - KeyError: '[] không có trong chỉ số' khi đào tạo một mô hình Keras
train_data = pd.read_csv('../input/data.csv')
X = train_data.iloc[:, 0:30]
Y = train_data.iloc[:,30]
# Code for selecting the important features automatically (removed) ...
# Selectintg important features 14,17,12,11,10,16,18,4,9,3
X = train_data.reindex(columns=['V14','V17','V12','V11','V10','V16','V18','V4','V9','V3'])
print(X.shape[1]) # -> 10
Nhưng khi tôi gọi phương thức phù hợp:
# Fit the model
history = model.fit(X, Y, validation_split=0.33, epochs=10, batch_size=10, verbose=0, callbacks=[early_stop])
tôi nhận được lỗi sau:
KeyError: '[3 2 5 1 0 4] not in index'
Tôi đang thiếu gì?
Kiểm tra [chủ đề này] (https://stackoverflow.com/questions/33564181/keras-gru-nn-keyerror-when-fitting-not-in-index). –