Created using Colaboratory

This commit is contained in:
udlbook
2022-10-25 12:25:23 +01:00
parent 60d8923b16
commit 90dfbb2f5d

View File

@@ -5,7 +5,7 @@
"colab": { "colab": {
"provenance": [], "provenance": [],
"collapsed_sections": [], "collapsed_sections": [],
"authorship_tag": "ABX9TyOE0qm8aIpEaNh/aI9gnlkY", "authorship_tag": "ABX9TyMLgMUtCcJHjIzHTTqjKVt1",
"include_colab_link": true "include_colab_link": true
}, },
"kernelspec": { "kernelspec": {
@@ -244,6 +244,24 @@
"id": "R5z_0dzQMF35" "id": "R5z_0dzQMF35"
} }
}, },
{
"cell_type": "code",
"source": [
"# Return the likelihood of all of the data under the model\n",
"def compute_likelihood(y_train, lambda_param):\n",
" # TODO -- compute the likelihood of the data -- the product of the Bernoullis probabilities for each data point\n",
" # Top line of equation 5.3 in the notes\n",
" # You will need np.prod() and the bernoulli_distribution function you used above\n",
" # Replace the line below\n",
" likelihood = 0\n",
" return likelihood"
],
"metadata": {
"id": "sk4EJSPQ41CK"
},
"execution_count": null,
"outputs": []
},
{ {
"cell_type": "code", "cell_type": "code",
"source": [ "source": [