|
4 | 4 | "metadata": {
|
5 | 5 | "colab": {
|
6 | 6 | "name": "Pytorch-CustomNN.ipynb",
|
7 |
| - "provenance": [] |
| 7 | + "provenance": [], |
| 8 | + "authorship_tag": "ABX9TyPBW4PQr9fHB137OwCNyfyG", |
| 9 | + "include_colab_link": true |
8 | 10 | },
|
9 | 11 | "kernelspec": {
|
10 | 12 | "name": "python3",
|
11 | 13 | "display_name": "Python 3"
|
12 | 14 | }
|
13 | 15 | },
|
14 | 16 | "cells": [
|
| 17 | + { |
| 18 | + "cell_type": "markdown", |
| 19 | + "metadata": { |
| 20 | + "id": "view-in-github", |
| 21 | + "colab_type": "text" |
| 22 | + }, |
| 23 | + "source": [ |
| 24 | + "<a href=\"https://colab.research.google.com/github/manthanthakker/DeepNeuralNetworks/blob/master/Pytorch_CustomNN.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" |
| 25 | + ] |
| 26 | + }, |
15 | 27 | {
|
16 | 28 | "cell_type": "markdown",
|
17 | 29 | "metadata": {
|
|
85 | 97 | "metadata": {
|
86 | 98 | "id": "ZiE_QO0Yl1OT",
|
87 | 99 | "colab_type": "code",
|
| 100 | + "outputId": "749b54fa-4f0d-4471-b987-c65e6f7150da", |
88 | 101 | "colab": {
|
89 | 102 | "base_uri": "https://localhost:8080/",
|
90 | 103 | "height": 1000
|
91 |
| - }, |
92 |
| - "outputId": "749b54fa-4f0d-4471-b987-c65e6f7150da" |
| 104 | + } |
93 | 105 | },
|
94 | 106 | "source": [
|
95 | 107 | "data = load_breast_cancer()\n",
|
|
102 | 114 | "\n",
|
103 | 115 | "print(data.DESCR)"
|
104 | 116 | ],
|
105 |
| - "execution_count": 264, |
| 117 | + "execution_count": 0, |
106 | 118 | "outputs": [
|
107 | 119 | {
|
108 | 120 | "output_type": "stream",
|
|
290 | 302 | "metadata": {
|
291 | 303 | "id": "IQhRWI7Xo6Ey",
|
292 | 304 | "colab_type": "code",
|
| 305 | + "outputId": "7af48883-5fde-47a0-a946-8115651eecc9", |
293 | 306 | "colab": {
|
294 | 307 | "base_uri": "https://localhost:8080/",
|
295 | 308 | "height": 119
|
296 |
| - }, |
297 |
| - "outputId": "7af48883-5fde-47a0-a946-8115651eecc9" |
| 309 | + } |
298 | 310 | },
|
299 | 311 | "source": [
|
300 | 312 | "print(model.parameters())\n",
|
|
313 | 325 | "# FC 2 Bias Parameters\n",
|
314 | 326 | "print(list(model.parameters())[3].size())"
|
315 | 327 | ],
|
316 |
| - "execution_count": 266, |
| 328 | + "execution_count": 0, |
317 | 329 | "outputs": [
|
318 | 330 | {
|
319 | 331 | "output_type": "stream",
|
|
366 | 378 | "metadata": {
|
367 | 379 | "id": "-Oqroxt4o-fi",
|
368 | 380 | "colab_type": "code",
|
| 381 | + "outputId": "22fa6e3d-dcc1-4546-b7ef-3b354fe13b0e", |
369 | 382 | "colab": {
|
370 | 383 | "base_uri": "https://localhost:8080/",
|
371 | 384 | "height": 952
|
372 |
| - }, |
373 |
| - "outputId": "22fa6e3d-dcc1-4546-b7ef-3b354fe13b0e" |
| 385 | + } |
374 | 386 | },
|
375 | 387 | "source": [
|
376 | 388 | "input_dim = 30\n",
|
|
419 | 431 | " # Print Loss\n",
|
420 | 432 | " print('Iteration: {}. Loss: {}'.format(iter, loss.item()))"
|
421 | 433 | ],
|
422 |
| - "execution_count": 269, |
| 434 | + "execution_count": 0, |
423 | 435 | "outputs": [
|
424 | 436 | {
|
425 | 437 | "output_type": "stream",
|
|
499 | 511 | "metadata": {
|
500 | 512 | "id": "7Fh2KKOxh2uO",
|
501 | 513 | "colab_type": "code",
|
| 514 | + "outputId": "5c7eb9ac-1b39-4025-e7d8-9859df873940", |
502 | 515 | "colab": {
|
503 | 516 | "base_uri": "https://localhost:8080/",
|
504 | 517 | "height": 34
|
505 |
| - }, |
506 |
| - "outputId": "5c7eb9ac-1b39-4025-e7d8-9859df873940" |
| 518 | + } |
507 | 519 | },
|
508 | 520 | "source": [
|
509 | 521 | "with torch.no_grad():\n",
|
|
532 | 544 | " accuracy = 100 * correct / total\n",
|
533 | 545 | " print('Iteration: {}. Loss: {}. Accuracy: {}'.format(iter, loss.item(), accuracy))"
|
534 | 546 | ],
|
535 |
| - "execution_count": 270, |
| 547 | + "execution_count": 0, |
536 | 548 | "outputs": [
|
537 | 549 | {
|
538 | 550 | "output_type": "stream",
|
|
0 commit comments