शुरू करेंमुफ़्त में शुरू करें

नई फीचर्स के correlations जाँचें

अब जब हमारे पास volume और datetime फीचर्स हैं, तो हम अपनी नई फीचर्स (जो new_features list में संग्रहीत हैं) और target (5d_close_future_pct) के बीच correlations जाँचना चाहते हैं ताकि समझ सकें कि वे कितने मज़बूती से संबंधित हैं। याद करें कि pandas में DataFrames के लिए बिल्ट-इन .corr() मेथड होता है, और seaborn में correlations दिखाने के लिए बढ़िया heatmap() फंक्शन है.

यह अभ्यास पाठ्यक्रम का हिस्सा है

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

पाठ्यक्रम देखें

अभ्यास निर्देश

  • हमारे new_features वैरिएबल को बढ़ाकर weekdays के कॉलम नाम, जैसे weekday_1, शामिल कीजिए — इसके लिए weekday नंबर को 'weekday_' string से जोड़ें.
  • Seaborn के heatmap का उपयोग करके new_features और target 5d_close_future_pct के correlations प्लॉट कीजिए.

इंटरैक्टिव व्यावहारिक अभ्यास

इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।

# Add the weekday labels to the new_features list
new_features.extend([____ + ____ for i in range(1, 5)])

# Plot the correlations between the new features and the targets
sns.____(lng_df[____ + ['5d_close_future_pct']].corr(), annot=True)
plt.yticks(rotation=0)  # ensure y-axis ticklabels are horizontal
plt.xticks(rotation=90)  # ensure x-axis ticklabels are vertical
plt.tight_layout()
plt.show()
कोड संपादित करें और चलाएँ