├── 2018-2022_Handouts_QuesSols
├── BITSF312_201819_1_C.pdf
├── BITSF312_201819_1_H.pdf
├── BITSF312_201920_1_C.pdf
├── BITSF312_201920_1_H.pdf
├── CSF425_202122_1_C.pdf
├── CSF425_202122_1_H.pdf
├── CSF425_202122_2_C.pdf
├── CSF425_202122_2_H.pdf
└── README.txt
├── DL_Lectures.zip
├── DL_handout.pdf
├── Demos
└── vectorisation
│ ├── matmul.py
│ ├── matmul_gpu.py
│ └── vec.py
├── Extras
├── Lecture3_hw.pdf
├── YisSampled.pdf
├── perceptron.pdf
└── vectorisation.pdf
├── LICENSE
├── Lectures
├── AISymp22_GNNs.pdf
├── Lecture0.pdf
├── Lecture1.pdf
├── Lecture10.pdf
├── Lecture11.pdf
├── Lecture12.pdf
├── Lecture13.pdf
├── Lecture16.pdf
├── Lecture17.pdf
├── Lecture18.pdf
├── Lecture19.pdf
├── Lecture2.pdf
├── Lecture20.pdf
├── Lecture21.pdf
├── Lecture22.pdf
├── Lecture23.pdf
├── Lecture24.pdf
├── Lecture25.pdf
├── Lecture26.pdf
├── Lecture3.pdf
├── Lecture4.pdf
├── Lecture5.pdf
├── Lecture6.pdf
├── Lecture7.pdf
├── Lecture8.pdf
└── Lecture9.pdf
├── Projects
├── CS_F425_DL_Assignment_1.pdf
└── CS_F425_DL__Major_Project.pdf
├── README.md
└── Tutorials
├── GNN.ipynb
├── NN_basics_Tut1.pdf
├── NN_basics_Tut2.pdf
└── Opt_Tut1.pdf
/2018-2022_Handouts_QuesSols/BITSF312_201819_1_C.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/2018-2022_Handouts_QuesSols/BITSF312_201819_1_C.pdf
--------------------------------------------------------------------------------
/2018-2022_Handouts_QuesSols/BITSF312_201819_1_H.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/2018-2022_Handouts_QuesSols/BITSF312_201819_1_H.pdf
--------------------------------------------------------------------------------
/2018-2022_Handouts_QuesSols/BITSF312_201920_1_C.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/2018-2022_Handouts_QuesSols/BITSF312_201920_1_C.pdf
--------------------------------------------------------------------------------
/2018-2022_Handouts_QuesSols/BITSF312_201920_1_H.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/2018-2022_Handouts_QuesSols/BITSF312_201920_1_H.pdf
--------------------------------------------------------------------------------
/2018-2022_Handouts_QuesSols/CSF425_202122_1_C.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/2018-2022_Handouts_QuesSols/CSF425_202122_1_C.pdf
--------------------------------------------------------------------------------
/2018-2022_Handouts_QuesSols/CSF425_202122_1_H.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/2018-2022_Handouts_QuesSols/CSF425_202122_1_H.pdf
--------------------------------------------------------------------------------
/2018-2022_Handouts_QuesSols/CSF425_202122_2_C.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/2018-2022_Handouts_QuesSols/CSF425_202122_2_C.pdf
--------------------------------------------------------------------------------
/2018-2022_Handouts_QuesSols/CSF425_202122_2_H.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/2018-2022_Handouts_QuesSols/CSF425_202122_2_H.pdf
--------------------------------------------------------------------------------
/2018-2022_Handouts_QuesSols/README.txt:
--------------------------------------------------------------------------------
1 | This directory contains course files (mainly, Handouts and Question papers) for the courses taken by AS and TD.
2 | The courses are: Machine Learning, Deep Learning (or Neural Networks) and AI.
3 |
4 | ---------------
5 | Missing files:
6 | ---------------
7 | 2019-20 S1 ML (BITS F464) Compre (probably with Prof. Ashwin)
8 | 2021-22 S2 DL (CS F425) Handout (probably with Tanmay)
9 |
10 | 2022-23 S1, S2 Courses: I am not involved.
11 | 2023-24 S1, S2 Courses: I am not involved.
12 |
--------------------------------------------------------------------------------
/DL_Lectures.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/DL_Lectures.zip
--------------------------------------------------------------------------------
/DL_handout.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/DL_handout.pdf
--------------------------------------------------------------------------------
/Demos/vectorisation/matmul.py:
--------------------------------------------------------------------------------
1 | import torch
2 | import time
3 |
4 | n = 100000
5 |
6 | A = torch.rand(n, n)
7 | B = torch.rand(n, n)
8 |
9 | tic = time.time()
10 | Z = torch.matmul(A, B)
11 | toc = time.time()
12 |
13 | print('Time:',(toc-tic),'s.')
14 |
--------------------------------------------------------------------------------
/Demos/vectorisation/matmul_gpu.py:
--------------------------------------------------------------------------------
1 | import torch
2 | import time
3 |
4 | device = torch.cuda.current_device()
5 |
6 | n = 10000
7 |
8 | A = torch.rand(n, n).to(device)
9 | B = torch.rand(n, n).to(device)
10 |
11 | tic = time.time()
12 | Z = torch.matmul(A, B)
13 | toc = time.time()
14 |
15 | print('Time:',(toc-tic),'s.')
16 |
17 |
--------------------------------------------------------------------------------
/Demos/vectorisation/vec.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 | import time
3 |
4 | n = 1000000000
5 |
6 | A = np.random.rand(n)
7 | B = np.random.rand(n)
8 |
9 | tic = time.time()
10 | C = np.dot(A, B)
11 | toc = time.time()
12 |
13 | print(C)
14 | print('Duration: ',(toc-tic),'s')
15 |
16 |
17 | tic = time.time()
18 | C = 0
19 | for i in range(n):
20 | C += A[i]*B[i]
21 | toc = time.time()
22 |
23 | print(C)
24 | print('Duration: ',(toc-tic),'s')
25 |
--------------------------------------------------------------------------------
/Extras/Lecture3_hw.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/Extras/Lecture3_hw.pdf
--------------------------------------------------------------------------------
/Extras/YisSampled.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/Extras/YisSampled.pdf
--------------------------------------------------------------------------------
/Extras/perceptron.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/Extras/perceptron.pdf
--------------------------------------------------------------------------------
/Extras/vectorisation.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/Extras/vectorisation.pdf
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Tirtharaj Dash
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Lectures/AISymp22_GNNs.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/Lectures/AISymp22_GNNs.pdf
--------------------------------------------------------------------------------
/Lectures/Lecture0.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/Lectures/Lecture0.pdf
--------------------------------------------------------------------------------
/Lectures/Lecture1.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/Lectures/Lecture1.pdf
--------------------------------------------------------------------------------
/Lectures/Lecture10.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/Lectures/Lecture10.pdf
--------------------------------------------------------------------------------
/Lectures/Lecture11.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/Lectures/Lecture11.pdf
--------------------------------------------------------------------------------
/Lectures/Lecture12.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/Lectures/Lecture12.pdf
--------------------------------------------------------------------------------
/Lectures/Lecture13.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/Lectures/Lecture13.pdf
--------------------------------------------------------------------------------
/Lectures/Lecture16.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/Lectures/Lecture16.pdf
--------------------------------------------------------------------------------
/Lectures/Lecture17.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/Lectures/Lecture17.pdf
--------------------------------------------------------------------------------
/Lectures/Lecture18.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/Lectures/Lecture18.pdf
--------------------------------------------------------------------------------
/Lectures/Lecture19.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/Lectures/Lecture19.pdf
--------------------------------------------------------------------------------
/Lectures/Lecture2.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/Lectures/Lecture2.pdf
--------------------------------------------------------------------------------
/Lectures/Lecture20.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/Lectures/Lecture20.pdf
--------------------------------------------------------------------------------
/Lectures/Lecture21.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/Lectures/Lecture21.pdf
--------------------------------------------------------------------------------
/Lectures/Lecture22.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/Lectures/Lecture22.pdf
--------------------------------------------------------------------------------
/Lectures/Lecture23.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/Lectures/Lecture23.pdf
--------------------------------------------------------------------------------
/Lectures/Lecture24.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/Lectures/Lecture24.pdf
--------------------------------------------------------------------------------
/Lectures/Lecture25.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/Lectures/Lecture25.pdf
--------------------------------------------------------------------------------
/Lectures/Lecture26.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/Lectures/Lecture26.pdf
--------------------------------------------------------------------------------
/Lectures/Lecture3.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/Lectures/Lecture3.pdf
--------------------------------------------------------------------------------
/Lectures/Lecture4.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/Lectures/Lecture4.pdf
--------------------------------------------------------------------------------
/Lectures/Lecture5.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/Lectures/Lecture5.pdf
--------------------------------------------------------------------------------
/Lectures/Lecture6.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/Lectures/Lecture6.pdf
--------------------------------------------------------------------------------
/Lectures/Lecture7.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/Lectures/Lecture7.pdf
--------------------------------------------------------------------------------
/Lectures/Lecture8.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/Lectures/Lecture8.pdf
--------------------------------------------------------------------------------
/Lectures/Lecture9.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/Lectures/Lecture9.pdf
--------------------------------------------------------------------------------
/Projects/CS_F425_DL_Assignment_1.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/Projects/CS_F425_DL_Assignment_1.pdf
--------------------------------------------------------------------------------
/Projects/CS_F425_DL__Major_Project.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/Projects/CS_F425_DL__Major_Project.pdf
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## Welcome to CS F425 at BITS Pilani, Goa Campus!
2 |
3 | | Primary Instructor (IC) | [Tirtharaj Dash](https://www.bits-pilani.ac.in/goa/tirtharaj/profile) |
4 | |---------------------------|---|
5 | | Teaching Assistants (TAs) | [Atharv Sonwane](https://threewisemonkeys-as.github.io/) [Anmol Agarwal](https://www.linkedin.com/in/anmol-agarwal-041098/) [Ameya Laad](http://ameyalaad.github.io/) [Akhilesh Adithya](https://akhileshadithya.github.io/)|
6 |
7 | Course handout can be found [here](https://github.com/tirtharajdash/CS-F425_Deep-Learning/blob/main/DL_handout.pdf).
8 |
9 |
10 | ## Scope and Objective of the course
11 |
12 | Neural Networks has had a long and rich history, and the reincarnated
13 | viewpoint has shifted towards "Deep Neural Networks\" or "Deep
14 | Learning\", primarily due to, (a) availability of the large amount of
15 | data, (b) extensive use of powerful graphics processors, (c)
16 | availability of software libraries to facilitate deep network
17 | implementations, and (d) significant involvement of industrial research
18 | labs in deep learning research.
19 |
20 | This course on "Deep Learning" would focus on the conceptual and
21 | mathematical foundation and computational investigations of recent deep
22 | models as part of a series of laboratory experiments and projects. For
23 | instance, we will focus on newer convolutional neural networks such as
24 | VGG Net, ResNet; various sequence models including attention-based
25 | models such as transformers; and also we will touch upon graph
26 | representation learning using graph neural networks.
27 |
28 | At the end of this course, students should be able to (0) pose
29 | real-world problems in deep learning, (1) source and prepare datasets,
30 | (2) design suitable deep network architecture, (3) prepare input-output
31 | representation (and encodings), (4) decide and design a suitable loss
32 | function for training a deep network, (5) training and deploying deep
33 | models.
34 |
35 | ## Book(s)
36 |
37 | Primary textbooks:
38 |
39 | 1. A. Zhang, Z.C. Lipton, M. Li, A.J. Smola, [Dive into Deep
40 | Learning](https://d2l.ai/index.html).
41 | 2. Ian Goodfellow, Yoshua Bengio, Aaron Courville, [Deep
42 | Learning](http://www.deeplearningbook.org/front_matter.pdf), MIT
43 | Press.
44 | 3. Aggarwal, C. C. (2018). Neural networks and deep learning, Springer.
45 | 4. W.L. Hamilton, [Graph Representation Learning
46 | Book](https://www.cs.mcgill.ca/~wlh/grl_book/).
47 |
48 | Other good reference books include:
49 |
50 | 1. Graves, A. (2012). [Supervised sequence labelling with recurrent
51 | neural networks](https://www.cs.toronto.edu/~graves/preprint.pdf).
52 | 2. Francois Chollet, [Deep Learning with
53 | Python](http://faculty.neu.edu.cn/yury/AAI/Textbook/Deep%20Learning%20with%20Python.pdf),
54 | Manning Publishers.
55 | 3. E. Stevens, L. Antiga, T. Viehmann, [Deep Learning with
56 | PyTorch](https://pytorch.org/assets/deep-learning/Deep-Learning-with-PyTorch.pdf),
57 | Manning Publishers.
58 |
59 | Textbook-3 is available in our library. Other books are available as
60 | e-books as href-ed.\
61 | Additioanlly, we may also look at relevant papers from
62 | [NeurIPS](https://nips.cc/), [ICLR](https://iclr.cc/),
63 | [ICML](https://icml.cc/), [IJCAI](https://www.ijcai.org/),
64 | [AAAI](https://aaai.org/Conferences/AAAI/aaai.php). These will be
65 | primarily used during major and minor projects design.
66 |
67 |
68 | ## Theory Materials
69 |
70 | References to the relevent study materials are provided in the lecture slides and in some cases,
71 | these are made available separately.
72 | Duration of each lecture is 50 min, which may get extended by 10-15 min. I am thankful to
73 | my students for tolerating this aspect of my teaching.
74 | The recoded videos of live lectures are accessible to the registered students only.
75 | The slides and videos may not be in sync in some cases; that is, any slide may span
76 | over multiple lecture slots.
77 |
78 |
79 | | Lecture | In-class Lecture | Extra Materials |
80 | |-----------|------------------|-----------------|
81 | | Lecture 0: Introducing the course | [slides](https://github.com/tirtharajdash/CS-F425_Deep-Learning/blob/main/Lectures/Lecture0.pdf), [video](https://drive.google.com/file/d/1QXLGrSHwjWdS4gvDWeYjh9zj5Dihd3it/view?usp=sharing) | |
82 | | Tutorial 1: NN Basics | [slides](https://github.com/tirtharajdash/CS-F425_Deep-Learning/blob/main/Tutorials/NN_basics_Tut1.pdf), [video](https://drive.google.com/file/d/1s7uPfKM53_5PN30IbrK2chLIPqUvp4of/view?usp=sharing) | |
83 | | Tutorial 2: NN Basics | [slides](https://github.com/tirtharajdash/CS-F425_Deep-Learning/blob/main/Tutorials/NN_basics_Tut2.pdf), [video1](https://drive.google.com/file/d/1HXjtGyx_dSlF_XSmxj3xlZBliNeLYmQm/view?usp=sharing), [video2](https://drive.google.com/file/d/1zq0jROhsIK51DQhCP4m3x0x2Uiqn8QJJ/view?usp=sharing) | [A note on Perceptron](https://github.com/tirtharajdash/CS-F425_Deep-Learning/blob/main/Extras/perceptron.pdf) |
84 | | Tutorial 3: Optimisation Basics | [slides](https://github.com/tirtharajdash/CS-F425_Deep-Learning/blob/main/Tutorials/Opt_Tut1.pdf) |
85 | | Lecture 1: DL Components and a Bayesian view | [slides](https://github.com/tirtharajdash/CS-F425_Deep-Learning/blob/main/Lectures/Lecture1.pdf), [video](https://drive.google.com/file/d/1lYs0VouCJ-e2BPlDPV8r2O6v-aGTJh1u/view?usp=sharing) | |
86 | | Lecture 2: Deep Feedforward Nets (MLPs) | [slides](https://github.com/tirtharajdash/CS-F425_Deep-Learning/blob/main/Lectures/Lecture2.pdf), [video](https://drive.google.com/file/d/10eJe8EjPyaNCYiLHmFFEjQPlT1D9JOby/view?usp=sharing) | |
87 | | Lecture 3: Backpropagation in MLP(1) | [slides](https://github.com/tirtharajdash/CS-F425_Deep-Learning/blob/main/Lectures/Lecture3.pdf), [video](https://drive.google.com/file/d/1-Eh_2lAW3m_WICtf4hOrZdiCU3f7KtOK/view?usp=sharing) | [Homework](https://github.com/tirtharajdash/CS-F425_Deep-Learning/blob/main/Extras/Lecture3_hw.pdf) |
88 | | Lecture 4: Backpropagation in MLP(2) | [slides](https://github.com/tirtharajdash/CS-F425_Deep-Learning/blob/main/Lectures/Lecture4.pdf), [video](https://drive.google.com/file/d/1HCZ8ir6p_KqsMVePknsmWhFhwkDKPF4l/view?usp=sharing) | [Vectorisation](https://github.com/tirtharajdash/CS-F425_Deep-Learning/blob/main/Extras/vectorisation.pdf), [codes](https://github.com/tirtharajdash/CS-F425_Deep-Learning/tree/main/Demos/vectorisation) |
89 | | Lecture 5: Generalisation(1) | [slides](https://github.com/tirtharajdash/CS-F425_Deep-Learning/blob/main/Lectures/Lecture5.pdf), [video](https://drive.google.com/file/d/1yR_s6YjoeFVe8SUQDjJDJmGyM1qnSwqt/view?usp=sharing) | [What is a dataset?](https://github.com/tirtharajdash/CS-F425_Deep-Learning/blob/main/Extras/YisSampled.pdf) |
90 | | Lecture 6: Generalisation(2) | [slides](https://github.com/tirtharajdash/CS-F425_Deep-Learning/blob/main/Lectures/Lecture6.pdf), [video](https://drive.google.com/file/d/1VTaFv1TgZeriO9569Iffe-9huKCDFfSN/view?usp=sharing) | |
91 | | Lecture 7: Dropout, Early Stopping | [slides](https://github.com/tirtharajdash/CS-F425_Deep-Learning/blob/main/Lectures/Lecture7.pdf), [video](https://drive.google.com/file/d/1RzVKVfSRbPThViZxFBpwQHdkXlTtFpTU/view?usp=sharing) | [Dropout Paper](https://jmlr.org/papers/volume15/srivastava14a/srivastava14a.pdf) |
92 | | Lecture 8: Optimisation and Parameter Initialisation | [slides](https://github.com/tirtharajdash/CS-F425_Deep-Learning/blob/main/Lectures/Lecture8.pdf), [video](https://drive.google.com/file/d/1xbwu334-iVoIGiy11YXXOyD-ndrfjwWU/view?usp=sharing) | |
93 | | Lecture 9: Adaptive Optimisation Methods | [slides](https://github.com/tirtharajdash/CS-F425_Deep-Learning/blob/main/Lectures/Lecture9.pdf), [video](https://drive.google.com/file/d/1jAyfnim6WiHJM0kzsNnFS9S-Lxr1H72d/view?usp=sharing) | [Adam Paper](https://arxiv.org/pdf/1412.6980.pdf) |
94 | | Lecture 10: Template Matching and CNNs | [slides](https://github.com/tirtharajdash/CS-F425_Deep-Learning/blob/main/Lectures/Lecture10.pdf), [video](https://drive.google.com/file/d/1odQ-rnu1pTJ_wmw-6Me2GYVmQCF7UxV_/view?usp=sharing) | [Yann LeCun's CNN Paper](http://yann.lecun.com/exdb/publis/pdf/lecun-99.pdf) |
95 | | Lecture 11: Fully-Connected Layers to Convolutions | [slides](https://github.com/tirtharajdash/CS-F425_Deep-Learning/blob/main/Lectures/Lecture11.pdf), [video](https://drive.google.com/file/d/1rKlFf-TLDccHEXSxySr-_fDiJReq6HOd/view?usp=sharing) | |
96 | | Lecture 12: CNN Operators (Convolution, Pooling) | [slides](https://github.com/tirtharajdash/CS-F425_Deep-Learning/blob/main/Lectures/Lecture12.pdf), [video](https://drive.google.com/file/d/1LzKvF1B8XiuFJ7C9kcgM8ZoAAqP5A6_4/view?usp=sharing) | |
97 | | Lecture 13: Gradient Computation in CNNs | [Notes](https://github.com/tirtharajdash/CS-F425_Deep-Learning/blob/main/Lectures/Lecture13.pdf), [video](https://drive.google.com/file/d/1ZDRPzNG70scT6pOV5VTa-XMK_gIaLeUP/view?usp=sharing) | |
98 | | Lecture 14: Modern Convolutional Neural Networks | [materials](https://d2l.ai/chapter_convolutional-modern/index.html), [video](https://drive.google.com/file/d/1xTd-igaWdmmdJ5YvSIp9VdOJblWkY2Nr/view?usp=drivesdk) | [AlexNet](https://colab.research.google.com/github/d2l-ai/d2l-pytorch-colab/blob/master/chapter_convolutional-modern/alexnet.ipynb), [VGG](https://colab.research.google.com/github/d2l-ai/d2l-pytorch-colab/blob/master/chapter_convolutional-modern/vgg.ipynb), [NiN](https://colab.research.google.com/github/d2l-ai/d2l-pytorch-colab/blob/master/chapter_convolutional-modern/nin.ipynb), [GoogLeNet](https://colab.research.google.com/github/d2l-ai/d2l-pytorch-colab/blob/master/chapter_convolutional-modern/googlenet.ipynb), [ResNet](https://colab.research.google.com/github/d2l-ai/d2l-pytorch-colab/blob/master/chapter_convolutional-modern/resnet.ipynb)
99 | | Lecture 15: Transfer Learning | [video](https://drive.google.com/file/d/1NfjxSbLdMHGFBC9-din6DBLPB3Phn97K/view?usp=sharing)|[Notebook](https://colab.research.google.com/drive/1D-8H41zXHnsmjeaoOaqcZqIJH08aSbtY?usp=sharing)|
100 | | Lecture 16: Sequence Learning | [materials:8.1-8.3](https://d2l.ai/chapter_recurrent-neural-networks/index.html), [video](https://drive.google.com/file/d/1jgUZhOKi4rV3kAfM47VhGHjPUZoaaoF_/view?usp=sharing) | [board](https://github.com/tirtharajdash/CS-F425_Deep-Learning/blob/main/Lectures/Lecture16.pdf) |
101 | | Lecture 17: Recurrent Neural Nets | [video](https://drive.google.com/file/d/1gz4SMrueMBxg-ccP63qi9wN1pV9YBiIg/view?usp=sharing) | [board]() |
102 | | Lecture 18: Backprop Through Time (BPTT) | [slides](https://github.com/tirtharajdash/CS-F425_Deep-Learning/blob/main/Lectures/Lecture17.pdf), [video](https://drive.google.com/file/d/1uettbMlL2Q9KoS0LmyO6dK4ubiQPtM_1/view?usp=sharing) | |
103 | | Midsem solution discussion | [video](https://drive.google.com/file/d/14m0TA0YVqFAD5DyP5BqleFmoMIr18c47/view?usp=sharing) | |
104 | | Lecture 19: Dealing with Vanishing Gradients in RNN | [slides](https://github.com/tirtharajdash/CS-F425_Deep-Learning/blob/main/Lectures/Lecture18.pdf), [video](https://drive.google.com/file/d/1Bht-fF8Od2YFBBYwAGzablnONg-p72G5/view?usp=sharing) | |
105 | | Lecture 20: Seq-to-Seq Learning, Attention Mechanism | [slides](https://github.com/tirtharajdash/CS-F425_Deep-Learning/blob/main/Lectures/Lecture19.pdf), [video](https://drive.google.com/file/d/1rgtQA_7efylMz0ysqGQPk-MDQNusXyp6/view?usp=sharing) | |
106 | | Lecture 21: Attention and Self-attention | [slides](https://github.com/tirtharajdash/CS-F425_Deep-Learning/blob/main/Lectures/Lecture20.pdf), [video](https://drive.google.com/file/d/1elHRINYDPe3lRH818wL0bPDaGJtdxXSO/view?usp=sharing) | [Attention is all you need.](https://arxiv.org/abs/1706.03762) |
107 | | Lecture 22: Multi-head Attention and Transformer | [slides](https://github.com/tirtharajdash/CS-F425_Deep-Learning/blob/main/Lectures/Lecture21.pdf), [video](https://drive.google.com/file/d/1K--MH8oxbL4yj7OgjjlIMC-C8S1Wh08f/view?usp=sharing) | [Layer Normalisation](https://arxiv.org/abs/1607.06450) |
108 | | Lecture 23: Representation Learning | [slides](https://github.com/tirtharajdash/CS-F425_Deep-Learning/blob/main/Lectures/Lecture22.pdf), [video](https://drive.google.com/file/d/1W9EkIwCgGTWrIu2_wV7ffpm9ep58ryaa/view?usp=sharing) | |
109 | | Lecture 24: Representation Learning | [slides](https://github.com/tirtharajdash/CS-F425_Deep-Learning/blob/main/Lectures/Lecture23.pdf), [video](https://drive.google.com/file/d/1lgtMVD-jRiG7TbAWgNSsZSfHEym5q3Yb/view?usp=sharing) | |
110 | | Lecture 25: Generative Modelling (Intro. to VAE) | [slides](https://github.com/tirtharajdash/CS-F425_Deep-Learning/blob/main/Lectures/Lecture24.pdf), [video](https://drive.google.com/file/d/1pjDez6Sk2rF5MK2fekuIJipI4e_lnajr/view?usp=sharing) | |
111 | | Lecture 26: Variational AE | [slides](https://github.com/tirtharajdash/CS-F425_Deep-Learning/blob/main/Lectures/Lecture25.pdf), [video](https://drive.google.com/file/d/1mqO0l54JsqqZYnIyOgb--6VYu5jDN-KA/view?usp=sharing) | |
112 | | Lecture 27: Generative Adversarial Network (GAN) | [slides](https://github.com/tirtharajdash/CS-F425_Deep-Learning/blob/main/Lectures/Lecture26.pdf), [video](https://drive.google.com/file/d/1hY8JTKpTPIEIYhlujrEXcVTQN6E2_tDi/view?usp=sharing) | |
113 | | Lecture 28: Energy-based Generative Modelling (RBM) | [materials](https://www.deeplearningbook.org/contents/generative_models.html) | |
114 | | AI Symp 22: [Tutorial Talk on GNNs](https://sites.google.com/goa.bits-pilani.ac.in/aisymposium2022/home?authuser=0) | [slides](https://github.com/tirtharajdash/CS-F425_Deep-Learning/blob/main/Lectures/AISymp22_GNNs.pdf), [video](https://youtu.be/rnM6WwJbkF8)| |
115 |
116 |
117 |
118 | These slides and videos are not really optimised for general public; so, please email me directly if you find
119 | any error or mistake in my lecture slides or videos. This will help me correct these the next time. I sincerely
120 | thank the [MathCha Editor](https://www.mathcha.io/editor) which I use extensively to draw most of the diagrams.
121 |
122 |
123 | ## Lab Materials
124 |
125 | All our labs will be based on PyTorch. See the official [PyTorch Tutorials](https://pytorch.org/tutorials/).
126 | We will also have 1 lab on basic Python and PyTorch.
127 |
128 | Update: According to students' votes, we are fixing the lab timing to be: **Wednesday 6-8 PM**. Please make sure to go through the reading materials (given below) before the lab.
129 |
130 | To run/edit the colab notebooks, please create a copy in your drive and work on that copy.
131 |
132 | | Lab | Reading Material | Recording | Exercise Material |
133 | |-------|------------------|-----------|-------------------|
134 | | Lab 0: Basics of Python and PyTorch | [Python Tutorial Series](https://pythonprogramming.net/introduction-learn-python-3-tutorials/) by Sentdex
[Python Intro](https://cs231n.github.io/python-numpy-tutorial) by Justin Johnson
Section 2.1-2.3 of [d2l.ai](http://d2l.ai/) | [video](https://drive.google.com/file/d/1Be1aqGczs2d8pLkyvPESxyGjYSNonnZK/view?usp=sharing) | [Notebook1](https://colab.research.google.com/drive/1HvAnGuGy6PaZyBtPNtYGUmvH-6CVDn5H?usp=sharing)
[Notebook2](https://colab.research.google.com/drive/1UQYTwZ6_y3ifZBfgIbn0INC87EmjPPtD?usp=sharing) |
135 | | Lab 1: Autograd and MLP | Section 2.4 - 2.5 of [d2l.ai](http://d2l.ai/)
[Intro to Autograd](https://pytorch.org/tutorials/beginner/blitz/autograd_tutorial.html#sphx-glr-beginner-blitz-autograd-tutorial-py) | [video](https://drive.google.com/file/d/19YQLqth--2q7xdBER-632GW-kNmT9ayG/view?usp=sharing) | [Notebook](https://colab.research.google.com/drive/15L51sdwIeylKQV-BZm2wCEfR9dJT7-Zi?usp=sharing) |
136 | | Lab 2: Regularisation | Section 4.5.2 - 4.5.3 of [d2l.ai](http://d2l.ai/) | [video](https://drive.google.com/file/d/1F8XRs73Tqsat2rtUyNye6ZY9s6EMpNOt/view?usp=sharing) | [Notebook](https://colab.research.google.com/drive/1X4kl7nGtj_q1rumvZHEsUeSzX1BJ9kJ6?usp=sharing) |
137 | | Lab 3: Hyperparameter Tuning | Section 4.4, 4.6 and 7.5 from [d2l.ai](http://d2l.ai/)
[Hyperparameter tuning](https://www.oreilly.com/library/view/evaluating-machine-learning/9781492048756/ch04.html) | [video](https://drive.google.com/file/d/1fIfybjRUXG4btOvBM9E_90Cpx7YLlvjN/view?usp=sharing) | [Notebook 1](https://colab.research.google.com/drive/1S0Y8xiaBaI6p1Y74MiNnCio6IuOE4Eto?usp=sharing)
[Notebook 2](https://colab.research.google.com/drive/1UHsM00OTT19FexEHwSkrydo13pfvUKXO?usp=sharing) |
138 | | Lab 4: Intro to CNNs | Section 6 from [d2l.ai](http://d2l.ai/) | [video](https://drive.google.com/file/d/1ScRQRsN3zt_Ye6mMD0uC1SHouQCkJyZJ/view?usp=sharing) |[Notebook](https://colab.research.google.com/drive/10afSD0wjQinhHug8RPlPSvooK8ZGfVgc?usp=sharing) |
139 | | Lab 5: Intro to CNNs (Continued) | Section 6 from [d2l.ai](http://d2l.ai/) | [video](https://drive.google.com/file/d/1xNE06_1z7p1POk7BkG9QhJYMM_H1r9gd/view?usp=sharing) |[Notebook](https://colab.research.google.com/drive/10afSD0wjQinhHug8RPlPSvooK8ZGfVgc?usp=sharing) |
140 | | Lab 6: Intro to RNNs | Section 8 from [d2l.ai](http://d2l.ai/) | [part 1](https://drive.google.com/file/d/1ckNOAf1_GfDcQzI-wwqfu6YLIJjttMN4/view?usp=sharing) |[Intro](https://colab.research.google.com/drive/1r4zC-g578oCFTzu8MNmRUQ6aKKrM56mZ?usp=sharing), [Exercises](https://colab.research.google.com/drive/1r4zC-g578oCFTzu8MNmRUQ6aKKrM56mZ?usp=sharing) |
141 | | Lab 7: Intro to Transformers and BERT | NeurIPS Paper: [Attention is all you need](https://proceedings.neurips.cc/paper/2017/file/3f5ee243547dee91fbd053c1c4a845aa-Paper.pdf) | [video](https://drive.google.com/file/d/1eZg5a9SPZVN5wwOW63nidjCLKOJdP7b2/view?usp=sharing) |[Official Pytorch Notebook](https://colab.research.google.com/github/pytorch/pytorch.github.io/blob/master/assets/hub/huggingface_pytorch-transformers.ipynb) |
142 | | Extra 1: AI Symposium 2022 Talk-GNNs |Presentation: [slides](https://github.com/tirtharajdash/CS-F425_Deep-Learning/blob/main/Lectures/AISymp22_GNNs.pdf)| [video](https://youtu.be/rnM6WwJbkF8) |[Official Pytorch Notebook](https://github.com/tirtharajdash/CS-F425_Deep-Learning/blob/main/Tutorials/GNN.ipynb) |
143 |
144 |
145 | ## Lab Projects
146 |
147 | | Lab Project | Details | Submission Date | Submission Link |
148 | |-------------|---------|-----------------|-----------------|
149 | | Project 1: Residual MLPs | [Assignment 1](https://github.com/tirtharajdash/CS-F425_Deep-Learning/blob/main/Projects/CS_F425_DL_Assignment_1.pdf) | **Sep 25, 11:59 PM IST** | [Google Classroom](https://classroom.google.com/c/MzgzNTE2MTc5NzE5/a/Mzk4ODI1MzU2MTAw/details) |
150 | | Project 2: Major Project | [Assignment 2](https://github.com/tirtharajdash/CS-F425_Deep-Learning/blob/main/Projects/CS_F425_DL__Major_Project.pdf) | **Dec 7, 11:59 PM IST** | [Google Classroom](https://classroom.google.com/u/1/c/MzgzNTE2MTc5NzE5/a/NDM2NTM4NjQ4MDE4/details) |
151 |
152 | ## Previous year Questions and Solutions
153 |
154 | Handouts, Questions and Solutions from previous years (2018-2022) are available [here](https://github.com/tirtharajdash/CS-F425_Deep-Learning/blob/main/2018-2022_Handouts_QuesSols/).
155 |
156 |
157 | ## Using our course materials
158 |
159 | Non-profitable usage of the materials from this course is absolutely free. However,
160 | if you are tech-blogger or a course instructor or a student outside BITS Pilani (Goa Campus)
161 | and you are using our course materials for any non-profitable purposes,
162 | please credit this course page by providing a proper reference to this page.
163 | Any profitable usage of these materials needs permission from the owner ([Tirtharaj Dash](https://tirtharajdash.github.io/)).
164 | Refer the license for more details.
165 |
--------------------------------------------------------------------------------
/Tutorials/GNN.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "nbformat": 4,
3 | "nbformat_minor": 0,
4 | "metadata": {
5 | "colab": {
6 | "provenance": [],
7 | "collapsed_sections": []
8 | },
9 | "kernelspec": {
10 | "name": "python3",
11 | "display_name": "Python 3"
12 | },
13 | "language_info": {
14 | "name": "python"
15 | }
16 | },
17 | "cells": [
18 | {
19 | "cell_type": "markdown",
20 | "source": [
21 | "# Installing Pytorch Geometric"
22 | ],
23 | "metadata": {
24 | "id": "wif3_5wnQsfL"
25 | }
26 | },
27 | {
28 | "cell_type": "code",
29 | "source": [
30 | "import os\n",
31 | "import torch\n",
32 | "os.environ['TORCH'] = torch.__version__\n",
33 | "print(torch.__version__)\n",
34 | "\n",
35 | "!pip install torch-scatter torch-sparse torch-cluster torch-spline-conv torch-geometric -f https://data.pyg.org/whl/torch-${TORCH}.html"
36 | ],
37 | "metadata": {
38 | "colab": {
39 | "base_uri": "https://localhost:8080/"
40 | },
41 | "id": "Fcme4GOqEfU8",
42 | "outputId": "f85d4581-ecf4-45ac-ff36-9ea9646be5ec"
43 | },
44 | "execution_count": null,
45 | "outputs": [
46 | {
47 | "output_type": "stream",
48 | "name": "stdout",
49 | "text": [
50 | "1.12.1+cu113\n",
51 | "Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n",
52 | "Looking in links: https://data.pyg.org/whl/torch-1.12.1+cu113.html\n",
53 | "Collecting torch-scatter\n",
54 | " Downloading https://data.pyg.org/whl/torch-1.12.0%2Bcu113/torch_scatter-2.0.9-cp37-cp37m-linux_x86_64.whl (7.9 MB)\n",
55 | "\u001b[K |████████████████████████████████| 7.9 MB 1.7 MB/s \n",
56 | "\u001b[?25hCollecting torch-sparse\n",
57 | " Downloading https://data.pyg.org/whl/torch-1.12.0%2Bcu113/torch_sparse-0.6.15-cp37-cp37m-linux_x86_64.whl (3.5 MB)\n",
58 | "\u001b[K |████████████████████████████████| 3.5 MB 48.5 MB/s \n",
59 | "\u001b[?25hCollecting torch-cluster\n",
60 | " Downloading https://data.pyg.org/whl/torch-1.12.0%2Bcu113/torch_cluster-1.6.0-cp37-cp37m-linux_x86_64.whl (2.4 MB)\n",
61 | "\u001b[K |████████████████████████████████| 2.4 MB 59.8 MB/s \n",
62 | "\u001b[?25hCollecting torch-spline-conv\n",
63 | " Downloading https://data.pyg.org/whl/torch-1.12.0%2Bcu113/torch_spline_conv-1.2.1-cp37-cp37m-linux_x86_64.whl (709 kB)\n",
64 | "\u001b[K |████████████████████████████████| 709 kB 51.0 MB/s \n",
65 | "\u001b[?25hCollecting torch-geometric\n",
66 | " Downloading torch_geometric-2.1.0.post1.tar.gz (467 kB)\n",
67 | "\u001b[K |████████████████████████████████| 467 kB 6.5 MB/s \n",
68 | "\u001b[?25hRequirement already satisfied: scipy in /usr/local/lib/python3.7/dist-packages (from torch-sparse) (1.7.3)\n",
69 | "Requirement already satisfied: tqdm in /usr/local/lib/python3.7/dist-packages (from torch-geometric) (4.64.1)\n",
70 | "Requirement already satisfied: numpy in /usr/local/lib/python3.7/dist-packages (from torch-geometric) (1.21.6)\n",
71 | "Requirement already satisfied: jinja2 in /usr/local/lib/python3.7/dist-packages (from torch-geometric) (2.11.3)\n",
72 | "Requirement already satisfied: requests in /usr/local/lib/python3.7/dist-packages (from torch-geometric) (2.23.0)\n",
73 | "Requirement already satisfied: pyparsing in /usr/local/lib/python3.7/dist-packages (from torch-geometric) (3.0.9)\n",
74 | "Requirement already satisfied: scikit-learn in /usr/local/lib/python3.7/dist-packages (from torch-geometric) (1.0.2)\n",
75 | "Requirement already satisfied: MarkupSafe>=0.23 in /usr/local/lib/python3.7/dist-packages (from jinja2->torch-geometric) (2.0.1)\n",
76 | "Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.7/dist-packages (from requests->torch-geometric) (3.0.4)\n",
77 | "Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python3.7/dist-packages (from requests->torch-geometric) (1.24.3)\n",
78 | "Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.7/dist-packages (from requests->torch-geometric) (2.10)\n",
79 | "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.7/dist-packages (from requests->torch-geometric) (2022.9.24)\n",
80 | "Requirement already satisfied: joblib>=0.11 in /usr/local/lib/python3.7/dist-packages (from scikit-learn->torch-geometric) (1.2.0)\n",
81 | "Requirement already satisfied: threadpoolctl>=2.0.0 in /usr/local/lib/python3.7/dist-packages (from scikit-learn->torch-geometric) (3.1.0)\n",
82 | "Building wheels for collected packages: torch-geometric\n",
83 | " Building wheel for torch-geometric (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
84 | " Created wheel for torch-geometric: filename=torch_geometric-2.1.0.post1-py3-none-any.whl size=689859 sha256=83b564b9b300929ddf05da8ffb37aafa7214bc2a976174a1fe70169298cd8c7f\n",
85 | " Stored in directory: /root/.cache/pip/wheels/d1/cb/43/f7f2e472de4d7cff31bceddadc36d634e1e545fbc17961c282\n",
86 | "Successfully built torch-geometric\n",
87 | "Installing collected packages: torch-spline-conv, torch-sparse, torch-scatter, torch-geometric, torch-cluster\n",
88 | "Successfully installed torch-cluster-1.6.0 torch-geometric-2.1.0.post1 torch-scatter-2.0.9 torch-sparse-0.6.15 torch-spline-conv-1.2.1\n"
89 | ]
90 | }
91 | ]
92 | },
93 | {
94 | "cell_type": "markdown",
95 | "source": [
96 | "# Data Handling"
97 | ],
98 | "metadata": {
99 | "id": "FaldyXENaiEG"
100 | }
101 | },
102 | {
103 | "cell_type": "code",
104 | "source": [
105 | "from torch_geometric.data import Data\n",
106 | "\n",
107 | "edge_index = torch.tensor([[0, 0, 0, 1, 2, 3, 4],\n",
108 | " [2, 1, 3, 2, 1, 3, 1]], dtype=torch.long)\n",
109 | "x = torch.tensor([[10], [0], [1],[6], [3]], dtype=torch.float)\n",
110 | "\n",
111 | "data = Data(x=x, edge_index=edge_index.contiguous())\n",
112 | "print(data)"
113 | ],
114 | "metadata": {
115 | "colab": {
116 | "base_uri": "https://localhost:8080/"
117 | },
118 | "id": "oSSqMPplKfDV",
119 | "outputId": "ca23fc1a-9ef0-4c86-a1f8-747abae196ce"
120 | },
121 | "execution_count": null,
122 | "outputs": [
123 | {
124 | "output_type": "stream",
125 | "name": "stdout",
126 | "text": [
127 | "Data(x=[5, 1], edge_index=[2, 7])\n"
128 | ]
129 | }
130 | ]
131 | },
132 | {
133 | "cell_type": "code",
134 | "source": [
135 | "import networkx as nx\n",
136 | "from torch_geometric.utils import to_networkx\n",
137 | "G = to_networkx(data,to_undirected=data.is_undirected())\n",
138 | "pos = nx.shell_layout(G)\n",
139 | "nx.draw(G, pos, with_labels=True, font_weight='bold') #self loop on 3; bidirectional "
140 | ],
141 | "metadata": {
142 | "colab": {
143 | "base_uri": "https://localhost:8080/",
144 | "height": 319
145 | },
146 | "id": "gEUBljY76P0o",
147 | "outputId": "25aedb33-8f79-4164-8989-78788b5aa55e"
148 | },
149 | "execution_count": null,
150 | "outputs": [
151 | {
152 | "output_type": "display_data",
153 | "data": {
154 | "text/plain": [
155 | ""
156 | ],
157 | "image/png": "iVBORw0KGgoAAAANSUhEUgAAAb4AAAEuCAYAAADx63eqAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nO3deXhU5fk+8HsyWSYrCSEQQgIBshMmy8xYFhFsASEssiSIEFyRKopSRVtL3aHVSxG01a+CdsP6UzaVJS6sgiI1eyBkBQIJZIUkk22SWc7vD8zU4wTCksyZydyf6/KCnpw580w79c77nvd5j0wQBAFEREQOwknqAoiIiKyJwUdERA6FwUdERA6FwUdERA6FwUdERA6FwUdERA6FwUdERA6FwUdERA6FwUdERA6FwUdERA6FwUdERA6FwUdERA6FwUdERA6FwUdERA6FwUdERA6FwUdERA6FwUdERA6FwUdERA6FwUdERA6FwUdERA6FwUdERA6FwUdERA7FWeoCiHpCXXM7tmVWoLBKC63OAB+FM6ICfZCiCoa/l5vU5RGRDZEJgiBIXQTRjcotb8A7h0rxbXEtAKDdYDL/TOHsBAHApMgALJ8YhrgQX4mqJCJbwuAju/XRsTKsTSuEzmDE1b7FMhmgcJZjdVIUUseEWq0+IrJNnOoku3Q59ArQpjd1e64gAG16I9amFQAAw4/IwXHER3Ynt7wBCzcdQ5veaPGzlpPfom7n6wAAb/Vs9J+8TPRzdxc5Pl02BspgTn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Bi0n9qOj+rTFuQKA5MSur0NEfR/7+MjudNXHd606+/jeS+U9PSJHxREf2Z1HJ4VB4Sy/odcqnOVYPimshysiInvC4CO7Exfii9VJUXB3ub6v7+W9OqOgDO7dpzQQkW3j4hayS50bTUv1dAYisl+8x0d2La+iAe8eKsXBolrIAOi6eB7f7ZEBWD4pjCM9IgLA4KM+4mJzO7ZlVaCwsglanR4+ChdEDfZGcqK0T2AnItvD4CMiIofCxS1ERORQGHxERORQGHxERORQGHxERORQGHxERORQGHxERORQGHxERORQGHxERORQGHxERORQGHxERORQGHxERORQGHxERORQGHxERORQGHxERORQGHxERORQGHxERORQGHxERORQGHxERORQGHxERORQGHxERORQGHxERORQ/j/ueTUGvWlLUAAAAABJRU5ErkJggg==\n"
158 | },
159 | "metadata": {}
160 | }
161 | ]
162 | },
163 | {
164 | "cell_type": "code",
165 | "source": [
166 | "print(f\"Keys: {data.keys}\")\n",
167 | "print(f\"Edge_attr: {'edge_attr' in data}\")\n",
168 | "print(f\"Number of Nodes: {data.num_nodes}\")\n",
169 | "print(f\"Number of Edges: {data.num_edges}\")\n",
170 | "print(f\"Number of Node features: {data.num_node_features}\")\n",
171 | "print(f\"Isolated Nodes: {data.has_isolated_nodes()}\")\n",
172 | "print(f\"Self Loops: {data.has_self_loops()}\")\n",
173 | "print(f\"Directed graph: {data.is_directed()}\")"
174 | ],
175 | "metadata": {
176 | "colab": {
177 | "base_uri": "https://localhost:8080/"
178 | },
179 | "id": "QY0rcLAMNDUk",
180 | "outputId": "9295cc43-d504-4a13-de32-d06fd9149975"
181 | },
182 | "execution_count": null,
183 | "outputs": [
184 | {
185 | "output_type": "stream",
186 | "name": "stdout",
187 | "text": [
188 | "Keys: ['x', 'edge_index']\n",
189 | "Edge_attr: False\n",
190 | "Number of Nodes: 3\n",
191 | "Number of Edges: 4\n",
192 | "Number of Node features: 1\n",
193 | "Isolated Nodes: False\n",
194 | "Self Loops: False\n",
195 | "Directed graph: False\n"
196 | ]
197 | }
198 | ]
199 | },
200 | {
201 | "cell_type": "markdown",
202 | "source": [
203 | "# Common Benchmark Datasets\n"
204 | ],
205 | "metadata": {
206 | "id": "Q2mocCG3Qeeo"
207 | }
208 | },
209 | {
210 | "cell_type": "markdown",
211 | "source": [
212 | "\n",
213 | "\n",
214 | "> torch_geometric also supports some common datasets. One of such dataset is `Enzymes`. `Enzyme` contains total 600 graphs with 6 classes. We will split this data into training set and test set. Training set contains 540 graphs (90%) and test set contains 60 graphs (10%). \n",
215 | "\n",
216 | "\n",
217 | "\n"
218 | ],
219 | "metadata": {
220 | "id": "SlRRI6d-16vQ"
221 | }
222 | },
223 | {
224 | "cell_type": "code",
225 | "source": [
226 | "from torch_geometric.datasets import TUDataset\n",
227 | "\n",
228 | "dataset = TUDataset(root='ENZYMES', name='ENZYMES')\n",
229 | "dataset = dataset.shuffle()\n",
230 | "train_dataset = dataset[:540]\n",
231 | "test_dataset = dataset[540:]"
232 | ],
233 | "metadata": {
234 | "colab": {
235 | "base_uri": "https://localhost:8080/"
236 | },
237 | "id": "pzwGM7i6Ntsx",
238 | "outputId": "7e8626e8-4ad5-4cf1-d496-d1a6b9e381e8"
239 | },
240 | "execution_count": null,
241 | "outputs": [
242 | {
243 | "output_type": "stream",
244 | "name": "stderr",
245 | "text": [
246 | "Downloading https://www.chrsmrrs.com/graphkerneldatasets/ENZYMES.zip\n",
247 | "Extracting ENZYMES/ENZYMES/ENZYMES.zip\n",
248 | "Processing...\n",
249 | "Done!\n"
250 | ]
251 | }
252 | ]
253 | },
254 | {
255 | "cell_type": "markdown",
256 | "source": [
257 | "# Mini-Batch & Dataloader"
258 | ],
259 | "metadata": {
260 | "id": "IbF-1cQ8bBft"
261 | }
262 | },
263 | {
264 | "cell_type": "markdown",
265 | "source": [
266 | " > We will use the dataloader to split the training and testing set into batches. This is exactly same as normal pytorch dataloader."
267 | ],
268 | "metadata": {
269 | "id": "0unTSrsG2xHN"
270 | }
271 | },
272 | {
273 | "cell_type": "code",
274 | "source": [
275 | "from torch_geometric.loader import DataLoader\n",
276 | "train_loader = DataLoader(dataset = train_dataset, batch_size = 128)\n",
277 | "test_loader = DataLoader(dataset = test_dataset, batch_size = 1)"
278 | ],
279 | "metadata": {
280 | "id": "l1zPTJrVN5yA"
281 | },
282 | "execution_count": null,
283 | "outputs": []
284 | },
285 | {
286 | "cell_type": "markdown",
287 | "source": [
288 | "# Training GNN"
289 | ],
290 | "metadata": {
291 | "id": "haAuh0BGO6qT"
292 | }
293 | },
294 | {
295 | "cell_type": "markdown",
296 | "source": [
297 | "> Now we will train a simple Graph Neural Network on Cora dataset, Cora dataset is supported by torch_geometric"
298 | ],
299 | "metadata": {
300 | "id": "MQkSnkL_6zfY"
301 | }
302 | },
303 | {
304 | "cell_type": "code",
305 | "source": [
306 | "from torch_geometric.datasets import Planetoid\n",
307 | "\n",
308 | "dataset = Planetoid(root='data', name='Cora')"
309 | ],
310 | "metadata": {
311 | "id": "l_8xaXnuJKnc",
312 | "colab": {
313 | "base_uri": "https://localhost:8080/"
314 | },
315 | "outputId": "e94062c5-b950-49f4-88b2-71ff6091995a"
316 | },
317 | "execution_count": null,
318 | "outputs": [
319 | {
320 | "output_type": "stream",
321 | "name": "stderr",
322 | "text": [
323 | "Downloading https://github.com/kimiyoung/planetoid/raw/master/data/ind.cora.x\n",
324 | "Downloading https://github.com/kimiyoung/planetoid/raw/master/data/ind.cora.tx\n",
325 | "Downloading https://github.com/kimiyoung/planetoid/raw/master/data/ind.cora.allx\n",
326 | "Downloading https://github.com/kimiyoung/planetoid/raw/master/data/ind.cora.y\n",
327 | "Downloading https://github.com/kimiyoung/planetoid/raw/master/data/ind.cora.ty\n",
328 | "Downloading https://github.com/kimiyoung/planetoid/raw/master/data/ind.cora.ally\n",
329 | "Downloading https://github.com/kimiyoung/planetoid/raw/master/data/ind.cora.graph\n",
330 | "Downloading https://github.com/kimiyoung/planetoid/raw/master/data/ind.cora.test.index\n",
331 | "Processing...\n",
332 | "Done!\n"
333 | ]
334 | }
335 | ]
336 | },
337 | {
338 | "cell_type": "markdown",
339 | "source": [
340 | " > What is Graph Convolution? and How is it different from Convolutions. \n",
341 | "\n",
342 | "\n",
343 | " \n",
344 | "\n"
345 | ],
346 | "metadata": {
347 | "id": "nsHIiW7h8ZrJ"
348 | }
349 | },
350 | {
351 | "cell_type": "code",
352 | "source": [
353 | "import torch\n",
354 | "import torch.nn.functional as F\n",
355 | "from torch_geometric.nn import GCNConv\n",
356 | "\n",
357 | "class GCN(torch.nn.Module):\n",
358 | " def __init__(self):\n",
359 | " super().__init__()\n",
360 | " self.conv1 = GCNConv(dataset.num_node_features, 16)\n",
361 | " self.conv2 = GCNConv(16, dataset.num_classes)\n",
362 | "\n",
363 | " def forward(self, data):\n",
364 | " x, edge_index = data.x, data.edge_index\n",
365 | "\n",
366 | " x = self.conv1(x, edge_index)\n",
367 | " x = F.relu(x)\n",
368 | " x = F.dropout(x, training=self.training)\n",
369 | " x = self.conv2(x, edge_index)\n",
370 | "\n",
371 | " return F.log_softmax(x, dim=1)\n"
372 | ],
373 | "metadata": {
374 | "id": "NtYP8WqlMgPD"
375 | },
376 | "execution_count": null,
377 | "outputs": []
378 | },
379 | {
380 | "cell_type": "code",
381 | "source": [
382 | "device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')\n",
383 | "model = GCN().to(device)\n",
384 | "data = dataset[0].to(device)\n",
385 | "optimizer = torch.optim.Adam(model.parameters(), lr=0.01, weight_decay=5e-4)\n",
386 | "\n",
387 | "for epoch in range(200):\n",
388 | " model.train()\n",
389 | " optimizer.zero_grad()\n",
390 | " out = model(data)\n",
391 | " loss = F.nll_loss(out[data.train_mask], data.y[data.train_mask])\n",
392 | " loss.backward()\n",
393 | " optimizer.step()\n",
394 | " model.eval()\n",
395 | " pred = model(data).argmax(dim=1)\n",
396 | " correct = (pred[data.test_mask] == data.y[data.test_mask]).sum()\n",
397 | " acc = int(correct) / int(data.test_mask.sum())\n",
398 | " if epoch%20==0:\n",
399 | " print(f'Epoch: {epoch} Accuracy: {acc:.4f}')\n"
400 | ],
401 | "metadata": {
402 | "colab": {
403 | "base_uri": "https://localhost:8080/"
404 | },
405 | "id": "LtQDIhp1ReIU",
406 | "outputId": "bdd81d54-1847-4526-953f-d896da95b588"
407 | },
408 | "execution_count": null,
409 | "outputs": [
410 | {
411 | "output_type": "stream",
412 | "name": "stdout",
413 | "text": [
414 | "Epoch: 0 Accuracy: 0.3140\n",
415 | "Epoch: 20 Accuracy: 0.8130\n",
416 | "Epoch: 40 Accuracy: 0.7950\n",
417 | "Epoch: 60 Accuracy: 0.7910\n",
418 | "Epoch: 80 Accuracy: 0.7970\n",
419 | "Epoch: 100 Accuracy: 0.8020\n",
420 | "Epoch: 120 Accuracy: 0.7990\n",
421 | "Epoch: 140 Accuracy: 0.8130\n",
422 | "Epoch: 160 Accuracy: 0.8040\n",
423 | "Epoch: 180 Accuracy: 0.8110\n"
424 | ]
425 | }
426 | ]
427 | },
428 | {
429 | "cell_type": "markdown",
430 | "source": [
431 | "Paper:\n",
432 | "* [DeepWalk: Online Learning of Social Representation](https://arxiv.org/pdf/1403.6652.pdf) \n",
433 | "* [node2vec: Scalable Feature Learning for Networks](https://arxiv.org/pdf/1607.00653.pdf) "
434 | ],
435 | "metadata": {
436 | "id": "N0TI1NFxn71f"
437 | }
438 | }
439 | ]
440 | }
--------------------------------------------------------------------------------
/Tutorials/NN_basics_Tut1.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/Tutorials/NN_basics_Tut1.pdf
--------------------------------------------------------------------------------
/Tutorials/NN_basics_Tut2.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/Tutorials/NN_basics_Tut2.pdf
--------------------------------------------------------------------------------
/Tutorials/Opt_Tut1.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tirtharajdash/CS-F425_Deep-Learning/39bf555a77f8624f00b9bfccaa79c881c56c8d63/Tutorials/Opt_Tut1.pdf
--------------------------------------------------------------------------------