Regression coefficients को visualize करें
अब जब आपने मॉडल fit कर लिया है, तो आइए इसके coefficients को visualize करें। यह मशीन लर्निंग का एक महत्वपूर्ण हिस्सा है क्योंकि इससे आपको अंदाज़ा होता है कि मॉडल की अलग-अलग features परिणाम को कैसे प्रभावित करती हैं.
Shifted time series DataFrame (prices_perc_shifted) और regression मॉडल (model) आपके workspace में उपलब्ध हैं.
इस अभ्यास में, आप एक फंक्शन बनाएँगे जो दिए गए coefficients और feature नामों के आधार पर coefficients के मानों को visualize करता है.
यह अभ्यास पाठ्यक्रम का हिस्सा है
Python में Time Series Data के लिए Machine Learning
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
def visualize_coefficients(coefs, names, ax):
# Make a bar plot for the coefficients, including their names on the x-axis
ax.bar(____, ____)
ax.set(xlabel='Coefficient name', ylabel='Coefficient value')
# Set formatting so it looks nice
plt.setp(ax.get_xticklabels(), rotation=45, horizontalalignment='right')
return ax