Created
May 12, 2019 18:11
-
-
Save ychennay/dba39c9fc9be5b868c661e8698b2a375 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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