Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
fig, ax1 = plt.subplots()
color = 'tab:red'
ax1.set_xlabel('λ (Inverse Model Complexity)')
ax1.set_ylabel('Prediction Bias', color=color)
ax1.plot(lambdas, bias, color=color)
ax1.tick_params(axis='y', labelcolor=color)
ax2 = ax1.twinx()
color = 'tab:blue'
ax2.set_ylabel('Prediction Variance', color=color)
ax2.plot(lambdas, variance, color=color)
ax2.tick_params(axis='y', labelcolor=color)
fig.tight_layout()
plt.title("Relationship Between Bias, Variance, and Model Complexity")
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment