Machine Learning สำหรับการเงินด้วย Python
Nathan George
Data Science Professor


วิธีแก้ปัญหา Overfitting:

from keras.layers import Dense, Dropoutmodel = Sequential() model.add(Dense(500, input_dim=scaled_train_features.shape[1], activation='relu')) model.add(Dropout(0.5)) model.add(Dense(100, activation='relu')) model.add(Dense(1, activation='linear'))
ค่า R$^2$ บน AMD โดยไม่ใช้ Dropout:
เมื่อใช้ Dropout:

# make predictions from 2 neural net models test_pred1 = model_1.predict(scaled_test_features) test_pred2 = model_2.predict(scaled_test_features)# horizontally stack predictions and take the average across rows test_preds = np.mean(np.hstack((test_pred1, test_pred2)), axis=1)
คะแนน R$^2$ ของ model 1 บน test set:
model 2:
ensemble (ค่าเฉลี่ยของการพยากรณ์):
Machine Learning สำหรับการเงินด้วย Python