Update 5_1_Least_Squares_Loss.ipynb
This commit is contained in:
@@ -539,8 +539,8 @@
|
|||||||
"# Hopefully, you can see that the maximum of the likelihood fn is at the same position as the minimum negative log likelihood\n",
|
"# Hopefully, you can see that the maximum of the likelihood fn is at the same position as the minimum negative log likelihood\n",
|
||||||
"# The least squares solution does not depend on sigma, so it's just flat -- no use here.\n",
|
"# The least squares solution does not depend on sigma, so it's just flat -- no use here.\n",
|
||||||
"# Let's check that:\n",
|
"# Let's check that:\n",
|
||||||
"print(\"Maximum likelihood = %3.3f, at beta_1=%3.3f\"%( (likelihoods[np.argmax(likelihoods)],sigma_vals[np.argmax(likelihoods)])))\n",
|
"print(\"Maximum likelihood = %3.3f, at sigma=%3.3f\"%( (likelihoods[np.argmax(likelihoods)],sigma_vals[np.argmax(likelihoods)])))\n",
|
||||||
"print(\"Minimum negative log likelihood = %3.3f, at beta_1=%3.3f\"%( (nlls[np.argmin(nlls)],sigma_vals[np.argmin(nlls)])))\n",
|
"print(\"Minimum negative log likelihood = %3.3f, at sigma=%3.3f\"%( (nlls[np.argmin(nlls)],sigma_vals[np.argmin(nlls)])))\n",
|
||||||
"# Plot the best model\n",
|
"# Plot the best model\n",
|
||||||
"sigma= sigma_vals[np.argmin(nlls)]\n",
|
"sigma= sigma_vals[np.argmin(nlls)]\n",
|
||||||
"y_model = shallow_nn(x_model, beta_0, omega_0, beta_1, omega_1)\n",
|
"y_model = shallow_nn(x_model, beta_0, omega_0, beta_1, omega_1)\n",
|
||||||
@@ -564,4 +564,4 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user