Spaces:
Sleeping
Sleeping
File size: 23,192 Bytes
e5d1ec4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 |
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "_8ZwOksxZ0-q"
},
"source": [
"# Project: Deep Learning - Calculations"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "_R3K9DR2Z0-r"
},
"source": [
"**Instructions for Students:**\n",
"\n",
"Please carefully follow these steps to complete and submit your project:\n",
"\n",
"1. **Make a copy of the Project**: Please make a copy of this project either to your own Google Drive or download locally. Work on the copy of the project. The master project is **Read-Only**, meaning you can edit, but it will not be saved when you close the master project. To avoid total loss of your work, remember to make a copy.\n",
"\n",
"2. **Completing the Project**: You are required to work on and complete all tasks in the provided project. Be disciplined and ensure that you thoroughly engage with each task.\n",
" \n",
"3. **Creating a Google Drive Folder**: Each of you must create a new folder on your Google Drive. This will be the repository for all your completed project files, aiding you in keeping your work organized and accessible.\n",
" \n",
"4. **Uploading Completed Project**: Upon completion of your project, make sure to upload all necessary files, involving codes, reports, and related documents into the created Google Drive folder. Save this link in the 'Student Identity' section and also provide it as the last parameter in the `submit` function that has been provided.\n",
" \n",
"5. **Sharing Folder Link**: You're required to share the link to your project Google Drive folder. This is crucial for the submission and evaluation of your project.\n",
" \n",
"6. **Setting Permission to Public**: Please make sure your Google Drive folder is set to public. This allows your instructor to access your solutions and assess your work correctly.\n",
"\n",
"Adhering to these procedures will facilitate a smooth project evaluation process for you and the reviewers."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "XeK2fKDrZ0-s"
},
"source": [
"## Project Description\n",
"\n",
"The Deep Learning Projects are divided into two parts, the first is the Calculations worth 30% in this notebook and the second one is Pytorch Project worth 70%.\n",
"\n",
"The two projects will help you gain experience to learn about Deep Learning in detail.\n",
"\n",
"Happy coding!"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "Lgd8szRCZ0-t"
},
"source": [
"## Grading Criteria\n",
"\n",
"There are 4 primary tasks in this project, all have the same weight. Each task will give you either 100 point if you are correct and 0 if you are wrong. The final score for the project will the the average of all 4 tasks.\n",
"\n",
"There is also an optional task (Task 5) that you can do to challenge your understanding.\n",
"\n",
"* Task 1: This task will assess your ability to do basic matrix multiplication which is an important part in machine and deep learning.\n",
"\n",
"* Task 2: This task will assess your ability to understand how a neural network work through weight and biases.\n",
"\n",
"* Task 3: The task will assess your ability to understand how a neural network layer works.\n",
"\n",
"* Task 4: This task will assess your ability to understand how backpropagation works in a neural network.\n",
"\n",
"* Task 5 (optional): This task will assess your ability to understand how to calculate cost and why it's important by using backpropagation in a neural network.\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "W1dT1yHmZ0-t"
},
"source": [
"## Student Identity"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "-Vysq0mbZ0-t"
},
"outputs": [],
"source": [
"# @title #### Student Identity\n",
"student_id = \"\" # @param {type:\"string\"}\n",
"name = \"\" # @param {type:\"string\"}\n",
"drive_link = \"\" # @param {type:\"string\"}"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "TuVolX9FZ0-u"
},
"source": [
"## Import package"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "Pl3QEX2HZ0-u"
},
"outputs": [],
"source": [
"!pip install fastbook\n",
"\n",
"!pip install rggrader\n",
"from rggrader import submit"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "4gtGSA8SZ0-v"
},
"source": [
"\n",
"## Task 1\n",
"\n",
"Given\n",
"\n",
"$$\n",
"X = \\begin{bmatrix}\n",
"a \\\\\n",
"b \\\\\n",
"c \\\\\n",
"d \\\\\n",
"e\n",
"\\end{bmatrix}\n",
"$$\n",
"\n",
"and\n",
"\n",
"$$\n",
"M =\n",
"\\begin{bmatrix}\n",
"-2 & 3 & 3 & 3 & -4 \\\\\n",
"0 & -4 & -1 & 1 & 2 \\\\\n",
"1 & 5 & 4 & 2 & 0 \\\\\n",
"-2 & 5 & -5 & 3 & 1 \\\\\n",
"-3 & 2 & 4 & 3 & 4 \\\\\n",
"\\end{bmatrix}\n",
"$$\n",
"\n",
"and\n",
"\n",
"$$\n",
"M \\cdot X =\n",
" =\n",
"\\begin{bmatrix}\n",
"-33 \\\\\n",
"9 \\\\\n",
"-34 \\\\\n",
"-38 \\\\\n",
" -40\n",
"\\end{bmatrix}\n",
"$$\n",
"\n",
"What is the value of $a + b + c + d + e$?"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "JCwFuKpEZ0-v"
},
"outputs": [],
"source": [
"# You may add any code here to derive your variables\n",
"# Please change this\n",
"a = 0\n",
"b = 0\n",
"c = 0\n",
"d = 0\n",
"e = 0\n",
"total = a + b + c + d + e\n",
"\n",
"print(f\"The total is {total}\")\n",
"\n",
"assignment_id = \"09-deep-learning-project\"\n",
"question_id = \"q1_linear_algebra\"\n",
"submit(student_id, name, assignment_id, str(total), question_id, drive_link)\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "AnzwjHI5Z0-v"
},
"source": [
"## Task 2\n",
"\n",
"What is the output of the following Neural Network?"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "5Dhvs1l-Z0-v",
"outputId": "8fec2c6f-eb16-4791-bcee-d3414a8b7fab"
},
"outputs": [
{
"data": {
"image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
"<!-- Generated by graphviz version 8.1.0 (20230707.0739)\n",
" -->\n",
"<!-- Title: G Pages: 1 -->\n",
"<svg width=\"452pt\" height=\"132pt\"\n",
" viewBox=\"0.00 0.00 451.92 132.40\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 128.4)\">\n",
"<title>G</title>\n",
"<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-128.4 447.92,-128.4 447.92,4 -4,4\"/>\n",
"<!-- z_1 -->\n",
"<g id=\"node1\" class=\"node\">\n",
"<title>z_1</title>\n",
"<polygon fill=\"none\" stroke=\"black\" points=\"209.5,-121.4 123.25,-121.4 119.25,-117.4 119.25,-71 205.5,-71 209.5,-75 209.5,-121.4\"/>\n",
"<polyline fill=\"none\" stroke=\"black\" points=\"205.5,-117.4 119.25,-117.4\"/>\n",
"<polyline fill=\"none\" stroke=\"black\" points=\"205.5,-117.4 205.5,-71\"/>\n",
"<polyline fill=\"none\" stroke=\"black\" points=\"205.5,-117.4 209.5,-121.4\"/>\n",
"<text text-anchor=\"middle\" x=\"164.38\" y=\"-91.15\" font-family=\"Times,serif\" font-size=\"14.00\">b = -2, ReLU</text>\n",
"</g>\n",
"<!-- z_3 -->\n",
"<g id=\"node3\" class=\"node\">\n",
"<title>z_3</title>\n",
"<polygon fill=\"none\" stroke=\"black\" points=\"338,-87.4 256.25,-87.4 252.25,-83.4 252.25,-37 334,-37 338,-41 338,-87.4\"/>\n",
"<polyline fill=\"none\" stroke=\"black\" points=\"334,-83.4 252.25,-83.4\"/>\n",
"<polyline fill=\"none\" stroke=\"black\" points=\"334,-83.4 334,-37\"/>\n",
"<polyline fill=\"none\" stroke=\"black\" points=\"334,-83.4 338,-87.4\"/>\n",
"<text text-anchor=\"middle\" x=\"295.12\" y=\"-57.15\" font-family=\"Times,serif\" font-size=\"14.00\">b = 4, ReLU</text>\n",
"</g>\n",
"<!-- z_1->z_3 -->\n",
"<g id=\"edge5\" class=\"edge\">\n",
"<title>z_1->z_3</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M209.68,-84.5C219.94,-81.79 230.95,-78.88 241.52,-76.09\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"242.13,-79.29 250.91,-73.35 240.34,-72.52 242.13,-79.29\"/>\n",
"<text text-anchor=\"middle\" x=\"230.88\" y=\"-82.4\" font-family=\"Times,serif\" font-size=\"14.00\">2</text>\n",
"</g>\n",
"<!-- z_2 -->\n",
"<g id=\"node2\" class=\"node\">\n",
"<title>z_2</title>\n",
"<polygon fill=\"none\" stroke=\"black\" points=\"209.5,-53.4 123.25,-53.4 119.25,-49.4 119.25,-3 205.5,-3 209.5,-7 209.5,-53.4\"/>\n",
"<polyline fill=\"none\" stroke=\"black\" points=\"205.5,-49.4 119.25,-49.4\"/>\n",
"<polyline fill=\"none\" stroke=\"black\" points=\"205.5,-49.4 205.5,-3\"/>\n",
"<polyline fill=\"none\" stroke=\"black\" points=\"205.5,-49.4 209.5,-53.4\"/>\n",
"<text text-anchor=\"middle\" x=\"164.38\" y=\"-23.15\" font-family=\"Times,serif\" font-size=\"14.00\">b = -6, ReLU</text>\n",
"</g>\n",
"<!-- z_2->z_3 -->\n",
"<g id=\"edge6\" class=\"edge\">\n",
"<title>z_2->z_3</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M209.68,-39.9C219.94,-42.61 230.95,-45.52 241.52,-48.31\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"240.34,-51.88 250.91,-51.05 242.13,-45.11 240.34,-51.88\"/>\n",
"<text text-anchor=\"middle\" x=\"230.88\" y=\"-49.4\" font-family=\"Times,serif\" font-size=\"14.00\">3</text>\n",
"</g>\n",
"<!-- output -->\n",
"<g id=\"node6\" class=\"node\">\n",
"<title>output</title>\n",
"<ellipse fill=\"none\" stroke=\"black\" cx=\"409.46\" cy=\"-62.2\" rx=\"34.46\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"409.46\" y=\"-57.15\" font-family=\"Times,serif\" font-size=\"14.00\">output</text>\n",
"</g>\n",
"<!-- z_3->output -->\n",
"<g id=\"edge7\" class=\"edge\">\n",
"<title>z_3->output</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M338.27,-62.2C346.67,-62.2 355.52,-62.2 363.99,-62.2\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"363.85,-65.7 373.85,-62.2 363.85,-58.7 363.85,-65.7\"/>\n",
"</g>\n",
"<!-- input_1 -->\n",
"<g id=\"node4\" class=\"node\">\n",
"<title>input_1</title>\n",
"<ellipse fill=\"none\" stroke=\"black\" cx=\"36\" cy=\"-99.2\" rx=\"36\" ry=\"25.2\"/>\n",
"<text text-anchor=\"middle\" x=\"36\" y=\"-94.15\" font-family=\"Times,serif\" font-size=\"14.00\">4</text>\n",
"</g>\n",
"<!-- input_1->z_1 -->\n",
"<g id=\"edge1\" class=\"edge\">\n",
"<title>input_1->z_1</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M72.35,-99.96C78.24,-100.06 84.29,-100.15 90,-100.2 95,-100.25 96.25,-100.36 101.25,-100.2 103.49,-100.13 105.77,-100.04 108.07,-99.94\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"108.12,-103.4 117.94,-99.41 107.78,-96.4 108.12,-103.4\"/>\n",
"<text text-anchor=\"middle\" x=\"95.62\" y=\"-103.4\" font-family=\"Times,serif\" font-size=\"14.00\">4</text>\n",
"</g>\n",
"<!-- input_1->z_2 -->\n",
"<g id=\"edge3\" class=\"edge\">\n",
"<title>input_1->z_2</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M64.73,-83.62C77.85,-76.25 93.98,-67.19 109.37,-58.54\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"110.82,-61.18 117.82,-53.23 107.39,-55.08 110.82,-61.18\"/>\n",
"<text text-anchor=\"middle\" x=\"95.62\" y=\"-70.4\" font-family=\"Times,serif\" font-size=\"14.00\">0</text>\n",
"</g>\n",
"<!-- input_2 -->\n",
"<g id=\"node5\" class=\"node\">\n",
"<title>input_2</title>\n",
"<ellipse fill=\"none\" stroke=\"black\" cx=\"36\" cy=\"-25.2\" rx=\"36\" ry=\"25.2\"/>\n",
"<text text-anchor=\"middle\" x=\"36\" y=\"-20.15\" font-family=\"Times,serif\" font-size=\"14.00\">-3</text>\n",
"</g>\n",
"<!-- input_2->z_1 -->\n",
"<g id=\"edge2\" class=\"edge\">\n",
"<title>input_2->z_1</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M71.04,-31.49C81.21,-34.28 92.09,-38.21 101.25,-43.7 111.09,-49.6 110.68,-54.57 119.25,-62.2 119.85,-62.73 120.45,-63.26 121.06,-63.79\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"118.35,-66.93 128.25,-70.69 122.85,-61.57 118.35,-66.93\"/>\n",
"<text text-anchor=\"middle\" x=\"95.62\" y=\"-46.4\" font-family=\"Times,serif\" font-size=\"14.00\">2</text>\n",
"</g>\n",
"<!-- input_2->z_2 -->\n",
"<g id=\"edge4\" class=\"edge\">\n",
"<title>input_2->z_2</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M66.37,-10.95C73.9,-7.96 82.11,-5.24 90,-3.7 95.93,-2.54 102.05,-2.55 108.09,-3.35\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"107.36,-6.97 117.86,-5.55 108.76,-0.12 107.36,-6.97\"/>\n",
"<text text-anchor=\"middle\" x=\"95.62\" y=\"-6.4\" font-family=\"Times,serif\" font-size=\"14.00\">-1</text>\n",
"</g>\n",
"</g>\n",
"</svg>\n"
],
"text/plain": [
"<graphviz.sources.Source at 0x28f274710>"
]
},
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from fastbook import *\n",
"\n",
"\n",
"# Draw neurons with multiple inputs and weights\n",
"gv('''\n",
"z_1[shape=box3d width=1 height=0.7 label=\"b = -2, ReLU\"];\n",
"z_2[shape=box3d width=1 height=0.7 label=\"b = -6, ReLU\"];\n",
"z_3[shape=box3d width=1 height=0.7 label=\"b = 4, ReLU\"];\n",
"input_1[width=1 height=0.7 label=\"4\"];\n",
"input_2[width=1 height=0.7 label=\"-3\"];\n",
"input_1 -> z_1 [label=\"4\"]\n",
"input_2 -> z_1 [label=\"2\"]\n",
"input_1 -> z_2 [label=\"0\"]\n",
"input_2 -> z_2 [label=\"-1\"]\n",
"\n",
"z_1 -> z_3 [label=\"2\"]\n",
"z_2 -> z_3 [label=\"3\"]\n",
"z_3 ->output\n",
"\n",
"\n",
"''')\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "jtzFBQeIZ0-w"
},
"outputs": [],
"source": [
"# You may add any code here to derive your variables\n",
"# Please change this\n",
"output = 0\n",
"\n",
"print(f\"The output is {output}\")\n",
"\n",
"assignment_id = \"09-deep-learning-project\"\n",
"question_id = \"q2_simple_neural_network\"\n",
"submit(student_id, name, assignment_id, str(output), question_id, drive_link)\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "nw5Rc4_QZ0-w"
},
"source": [
"## Task 3\n",
"\n",
"Given the following Neural Networks:\n",
"\n",
"First layer:\n",
"\n",
"$$\n",
"W = \\begin{bmatrix}\n",
"0.23 & 0.67 & 0.12 \\\\\n",
"-0.89 & -0.45 & 0.78 \\\\\n",
"0.34 & 0.56 & -0.90 \\\\\n",
"-0.12 & 0.34 & 0.56 \\\\\n",
"0.78 & -0.90 & 0.23 \\\\\n",
"\\end{bmatrix}\n",
"$$\n",
"\n",
"$$\n",
"bias = \\begin{bmatrix}\n",
"0.23 \\\\\n",
"-0.89 \\\\\n",
"0.34 \\\\\n",
"0.12 \\\\\n",
"-0.78 \\\\\n",
"\\end{bmatrix}\n",
"$$\n",
"\n",
"Second layer:\n",
"\n",
"$$\n",
"W = \\begin{bmatrix}\n",
"0.23 & 0.67 & 0.12 & 0.45 & 0.89 \\\\\n",
"0.12 & 0.34 & 0.56 & 0.78 & 0.90 \\\\\n",
"\\end{bmatrix}\n",
"$$\n",
"\n",
"$$\n",
"bias = \\begin{bmatrix}\n",
"1.96 \\\\\n",
"-1.08 \\\\\n",
"\\end{bmatrix}\n",
"$$\n",
"\n",
"Third layer:\n",
"$$\n",
"W = \\begin{bmatrix}\n",
"1.08 & -0.16\n",
"\\end{bmatrix}\n",
"$$\n",
"\n",
"$$\n",
"bias = \\begin{bmatrix}\n",
"-2.8\n",
"\\end{bmatrix}\n",
"$$\n",
"\n",
"All layers use the ReLU activation function.\n",
"\n",
"What is the output given the following inputs?\n",
"\n",
"$$\n",
"X = \\begin{bmatrix}\n",
"1 \\\\\n",
"2 \\\\\n",
"4 \\\\\n",
"\\end{bmatrix}\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "4d8Oibi1Z0-x"
},
"outputs": [],
"source": [
"# You may add any code here to derive your variables\n",
"\n",
"# Please change this\n",
"output = 0\n",
"\n",
"print(f\"The output is {output}\")\n",
"\n",
"assignment_id = \"09-deep-learning-project\"\n",
"question_id = \"q3_complex_neural_network\"\n",
"submit(student_id, name, assignment_id, str(output), question_id, drive_link)\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "Vn5o5XmfZ0-x"
},
"source": [
"## Task 4\n",
"\n",
"Given [the following sheet (sheet name = Project A)](https://docs.google.com/spreadsheets/d/15JWbRFB4k5CNcfD-2hduHHssXIc1SGhNVSpu_30wVAw/edit#gid=180755192)\n",
"\n",
"Make a backpropagation algorithm to train the network. You can refer to AND and NOT sheet. Use sigmoid activation function for all\n",
"\n",
"Hint: it needs 1 layer with 1 neuron\n",
"\n",
"What is the cost at 10th iteration (the iteration start from 1)?"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "d2aSUbaaZ0-x"
},
"outputs": [],
"source": [
"# Please clone the Google Sheet and do your calculation there\n",
"\n",
"# Please change this\n",
"cost = 0\n",
"\n",
"# Don't forget to fill in the link to your Google Sheet\n",
"link_to_gsheet = \"\"\n",
"\n",
"print(f\"The cost is {cost}\")\n",
"\n",
"assignment_id = \"09-deep-learning-project\"\n",
"\n",
"question_id = \"q4_cost_function_cost\"\n",
"submit(student_id, name, assignment_id, str(cost), question_id)\n",
"\n",
"question_id = \"q4_cost_function_gsheet\"\n",
"submit(student_id, name, assignment_id, str(link_to_gsheet), question_id, drive_link)\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "Kh7uzjtDZ0-x"
},
"source": [
"## Task 5 (Bonus - Optional)\n",
"\n",
"_This task is optional, it will earn you a distinction, but will not give you additional points._\n",
"\n",
"Given [the following sheet (sheet name = Project B)](https://docs.google.com/spreadsheets/d/15JWbRFB4k5CNcfD-2hduHHssXIc1SGhNVSpu_30wVAw/edit#gid=1029811725)\n",
"\n",
"Make a backpropagation algorithm to train the network. You can refer to AND and NOT sheet. Use sigmoid activation function for all\n",
"\n",
"Hint: it needs 2 layer (1 hidden layer + 1 output layer). The hidden layer has 2 neurons\n",
"\n",
"What is the cost at 10th iteration (the iteration start from 1)?"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "KJJOi3V1Z0-x"
},
"outputs": [],
"source": [
"# Please clone the Google Sheet and do your calculation there\n",
"\n",
"# Please change this\n",
"cost = 0\n",
"\n",
"# Don't forget to fill in the link to your Google Sheet\n",
"link_to_gsheet = \"\"\n",
"\n",
"print(f\"The cost is {cost}\")\n",
"\n",
"assignment_id = \"09-deep-learning-project\"\n",
"\n",
"question_id = \"q5_cost_function_cost\"\n",
"submit(student_id, name, assignment_id, str(cost), question_id)\n",
"\n",
"question_id = \"q5_cost_function_gsheet\"\n",
"submit(student_id, name, assignment_id, str(link_to_gsheet), question_id, drive_link)\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.3"
},
"colab": {
"provenance": []
}
},
"nbformat": 4,
"nbformat_minor": 0
} |