ओवरफिटिंग और एन्सेम्बलिंग

Python में Finance के लिए Machine Learning

Nathan George

Data Science Professor

ओवरफिटिंग

Python में Finance के लिए Machine Learning

अपने मॉडल को सरल बनाएँ

सीमित नेट

Python में Finance के लिए Machine Learning

न्यूरल नेटवर्क के विकल्प

ओवरफिटिंग से निपटने के विकल्प:

  • नोड्स की संख्या घटाएँ
  • L1/L2 regularization उपयोग करें
  • Dropout
  • Autoencoder आर्किटेक्चर
  • Early stopping
  • डेटा में noise जोड़ें
  • Max norm constraints
  • Ensembling
Python में Finance के लिए Machine Learning

ड्रॉपआउट

ड्रॉपआउट

Python में Finance के लिए Machine Learning

keras में ड्रॉपआउट

from keras.layers import Dense, Dropout

model = 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'))
Python में Finance के लिए Machine Learning

टेस्ट सेट तुलना

AMD पर बिना ड्रॉपआउट के R$^2$ मान:

  • train: 0.91
  • test: -0.72

ड्रॉपआउट के साथ:

  • train: 0.46
  • test: -0.22
Python में Finance के लिए Machine Learning

एन्सेम्बलिंग

रैंडम फॉरेस्ट

Python में Finance के लिए Machine Learning

एन्सेम्बलिंग लागू करना

# 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)
Python में Finance के लिए Machine Learning

एन्सेम्बल की तुलना

टेस्ट सेट पर मॉडल 1 का R$^2$ स्कोर:

  • -0.179

मॉडल 2:

  • -0.148

एन्सेम्बल (औसत पूर्वानुमान):

  • -0.146
Python में Finance के लिए Machine Learning

ड्रॉपआउट और एन्सेम्बल!

Python में Finance के लिए Machine Learning

Preparing Video For Download...