Created using Colab

This commit is contained in:
udlbook
2025-11-27 16:16:07 -05:00
parent afb9ead4d8
commit 01755deefe

View File

@@ -4,7 +4,7 @@
"metadata": {
"colab": {
"provenance": [],
"authorship_tag": "ABX9TyNzwsksM8IfDPg9DEiV++cL",
"authorship_tag": "ABX9TyORO/RUktvUyRPd9NT1GOoz",
"include_colab_link": true
},
"kernelspec": {
@@ -87,15 +87,10 @@
"outputs": [],
"source": [
"def number_regions(Di, D):\n",
" # TODO -- implement Zaslavsky's formula\n",
" # Tou can use math.comb() https://www.w3schools.com/python/ref_math_comb.asp\n",
" # Replace this code\n",
" N = 1;\n",
" # BEGIN_ANSWER\n",
"\n",
" N= 0\n",
" for j in range (Di+1):\n",
" N = N+ math.comb(D, j)\n",
" # END_ANSWER\n",
"\n",
" return N"
]
@@ -306,18 +301,14 @@
"# First let's write a function that computes the number of parameters as a function of the input dimension and number of hidden units (assuming just one output)\n",
"\n",
"def number_parameters(D_i, D):\n",
" # TODO -- replace this code with the proper calculation\n",
" N = 1\n",
" # BEGIN_ANSWER\n",
" N = D_i * D + D + D + 1\n",
" # END_ANSWER\n",
"\n",
" return N ;"
],
"metadata": {
"id": "Pav1OsCnpm6P"
},
"execution_count": 22,
"execution_count": 25,
"outputs": []
},
{
@@ -332,9 +323,9 @@
"base_uri": "https://localhost:8080/"
},
"id": "VbhDmZ1gwkQj",
"outputId": "76de7c87-699a-46ce-d3ff-265000a0ff6c"
"outputId": "d03fe328-1c27-43bf-95f4-5dc01e5e5656"
},
"execution_count": 23,
"execution_count": 26,
"outputs": [
{
"output_type": "stream",
@@ -382,9 +373,9 @@
"height": 541
},
"id": "AH4nA50Au8-a",
"outputId": "533d25e5-68fb-4cad-f605-e6e98f06d79b"
"outputId": "55555d33-f75e-45ef-e197-d48a3c9066d9"
},
"execution_count": 24,
"execution_count": 27,
"outputs": [
{
"output_type": "stream",
@@ -408,6 +399,15 @@
"metadata": {}
}
]
},
{
"cell_type": "code",
"source": [],
"metadata": {
"id": "daA1dAPsLD0h"
},
"execution_count": null,
"outputs": []
}
]
}