फीचर इम्पॉर्टेन्स और ग्रेडिएंट बूस्टिंग

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

Nathan George

Data Science Professor

सप्ताह के दिन का स्प्लिट

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

200-दिन SMA स्प्लिट

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

फीचर इम्पॉर्टेन्स निकालना

from sklearn.ensemble import RandomForestRegressor

random_forest = RandomForestRegressor()
random_forest.fit(train_features, train_targets)

feature_importances = random_forest.feature_importances_

print(feature_importances)
[0.07586547 0.10697602 0.12215955 0.23969227 0.29010304 0.0314028
 0.11977058 0.00276721 0.00246329 0.0026431  0.00615667]
Python में Finance के लिए Machine Learning

सॉर्टिंग और प्लॉटिंग

# feature importances from random forest model
importances = random_forest.feature_importances_

# index of greatest to least feature importances
sorted_index = np.argsort(importances)[::-1]

x = range(len(importances)) # create tick labels labels = np.array(feature_names)[sorted_index] plt.bar(x, importances[sorted_index], tick_label=labels) # rotate tick labels to vertical plt.xticks(rotation=90) plt.show()
Python में Finance के लिए Machine Learning

फीचर इम्पॉर्टेन्स प्लॉट

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

लिनियर मॉडल बनाम ग्रेडिएंट बूस्टिंग

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

बूस्टिंग डायग्राम

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

बूस्टेड मॉडल

उपलब्ध बूस्टेड मॉडल:

  • Gradient boosting
  • Adaboost
Python में Finance के लिए Machine Learning

ग्रेडिएंट बूस्टिंग मॉडल फिट करना

from sklearn.ensemble import GradientBoostingRegressor

gbr = GradientBoostingRegressor(max_features=4,
                                learning_rate=0.01,
                                n_estimators=200,
                                subsample=0.6,
                                random_state=42)

gbr.fit(train_features, train_targets)
Python में Finance के लिए Machine Learning

Get boosted!

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

Preparing Video For Download...